Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shner-elmo committed Nov 28, 2024
1 parent cebf716 commit 82c31f1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/tradingview_screener/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ def set_tickers(self, *tickers: str) -> Self:
"""
Set the tickers you wish to receive information on.
Note that this resets the markets and sets the URL market to `global`.
Examples:
>>> q = Query().select('name', 'market', 'close', 'volume', 'VWAP', 'MACD.macd')
Expand Down Expand Up @@ -431,6 +433,8 @@ def set_index(self, *indexes: str) -> Self:
"""
Scan only the equities that are in in the given index (or indexes).
Note that this resets the markets and sets the URL market to `global`.
Examples:
>>> Query().set_index('SYML:SP;SPX').get_scanner_data()
Expand Down Expand Up @@ -505,10 +509,6 @@ def set_index(self, *indexes: str) -> Self:
# self.query['price_conversion'] = {'to_currency': currency}
# return self

# TODO: add tests for set_ticker() and set_index() and make sure if its necessary to reset the
# URL or markets property
# and review the docs again

def set_property(self, key: str, value: Any) -> Self:
self.query[key] = value
return self
Expand Down Expand Up @@ -547,18 +547,16 @@ def get_scanner_data_raw(self, **kwargs) -> ScreenerDict:

def get_scanner_data(self, **kwargs) -> tuple[int, pd.DataFrame]:
"""
Perform a POST web-request and return the data from the API as a DataFrame.
This returns a Pandas DataFrame, so make sure you have `pandas` installed.
Perform a POST web-request and return the data from the API as a DataFrame (along with
the number of rows/tickers that matched your query).
Note that you can pass extra keyword-arguments that will be forwarded to `requests.post()`,
this can be very useful if you want to pass your own headers/cookies.
### Live/Delayed data
If you have paid for a live data add-on with TradingView, you want to pass your own
headers and cookies to access that real-time data, otherwise you
# TODO finish this and add to the README too
Note that to get live-data you have to authenticate, which is done by passing your cookies.
Have a look in the README at the "Real-Time Data Access" sections.
:param kwargs: kwargs to pass to `requests.post()`
:return: a tuple consisting of: (total_count, dataframe)
Expand Down

0 comments on commit 82c31f1

Please sign in to comment.