shner-elmo / TradingView-Screener

A package that lets you create TradingView screeners in Python
https://shner-elmo.github.io/TradingView-Screener/2.5.0/tradingview_screener.html
MIT License
282 stars 44 forks source link

Scanner does not return data but Website does #19

Closed optional12 closed 9 months ago

optional12 commented 9 months ago

I observed that not always data gets returned. _, df = Query().select('name', 'close', 'earnings_release_date',, 'earnings_release_next_date').get_scanner_data()

On 07. Feb 2024 for eaxmple for CRUS: df[df.name == 'CRUS'][['name', 'close', 'earnings_release_date', 'earnings_release_next_date']] Empty DataFrame Columns: [name, close, earnings_release_date, earnings_release_next_date] Index: []

but on TradingView Earnings View/Screener page they are listed for today after Market image

Why is this? Anything else required to retrieve the data?

shner-elmo commented 9 months ago

So whats happening here is that you are selecting a slice (0 to 50) and sometimes the ticker appears there, and other times it doesn't. This happens because there is a default limit of 50.

Now I'm sure that your first thought is to extend the limit, for example to set it to 100k:

(Query()
 .select('name', 'close', 'earnings_release_date', 'earnings_release_next_date')
 .limit(100_000)
 .get_scanner_data())

But this is not a good idea for two reasons:

  1. The significant increase in data requests (2000 times more) puts a strain on the server, resulting in longer wait times for the latest data retrieval.
  2. The intensified server load raises the likelihood of being blacklisted or blocked, as it exceeds typical usage limits and could be seen as abusive behavior.

Not to mention that its very inefficient to process all that data locally to just find one single ticker (or even a few ...). It would be both more performant and efficient to use the set_tickers() method:

  (Query()
   .select('name', 'close', 'earnings_release_date', 'earnings_release_next_date')
   .set_tickers('NASDAQ:CRUS')
   .get_scanner_data())
(1,
         ticker  name  close  earnings_release_date  earnings_release_next_date
 0  NASDAQ:CRUS  CRUS  93.25             1707339780                  1714564800)

Hope this solves your issue.

optional12 commented 9 months ago

Yes that helps. Final question: Is there a way to determine the ticker when just the name/symbol is known? In my example I asked for name/symbol CRUS and you provided the query to use for ticker NASDAQ:CRUS.

optional12 commented 9 months ago

Sorry, just found it. There is a function get_all_symbols() :-)

shner-elmo commented 9 months ago

Is there a way to determine the ticker when just the name/symbol is known?

Generally I would just google the exchange. But you can also do this:

(Query()
 .where(Column('name') == 'CRUS')
 .get_scanner_data())
(1,
         ticker  name  close  volume  market_cap_basic
 0  NASDAQ:CRUS  CRUS  93.06  725539        5019189676)
optional12 commented 9 months ago

Oh yeah. Sure. Thank you. Sometimes I do not see the trees in Front of a Forrest 😊

Btw: Do you know how to create a screener based ON protected indicators? The values are available in Objekt & Data tree But TV Screener does Not provide this capability. Are these values accessible via the Database?

"Shneor E." @.***> schrieb am 11.02.2024:

Is there a way to determine the ticker when just the name/symbol is known?

Generally I would just google the exchange. But you can also do this:

(Query()
.where(Column('name') == 'CRUS')
.get_scanner_data())
(1,
        ticker  name  close  volume  market_cap_basic
0  NASDAQ:CRUS  CRUS  93.06  725539        5019189676)

-- Diese Nachricht wurde mit K-@ Mail gesendet. ------10998CU6AQPH2Y2Y1RV4GTSIMU757C Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Oh yeah. Sure. Thank you.
Sometimes I do not see the trees in Front of a Forrest 😊

Btw: Do you know how to create a screener based ON protected indicators?
The values are available in Objekt & Data tree
But TV Screener does Not provide this capability.
Are these values accessible via the Database?

"Shneor E." ***@***.***> schrieb am 11.02.2024:

Is there a way to determine the ticker when just the name/symbol is known?

Generally I would just google the exchange. But you can also do this:

(Query()
 .where(Column('name') == 'CRUS')
 .get_scanner_data())
(1,
         ticker  name  close  volume  market_cap_basic
 0  NASDAQ:CRUS  CRUS  93.06  725539        5019189676)


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: <shner-elmo/TradingView-Screener/issues/19/1937866973@github.com>


-- Diese Nachricht wurde mit K-@ Mail gesendet.

------10998CU6AQPH2Y2Y1RV4GTSIMU757C--

shner-elmo commented 9 months ago

protected indicators

No worries. If you mean closed-source indicators then no, it's not possible to my knowledge.