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
239 stars 42 forks source link

Column('Change (1,5, etc)m, %') always returns an error when using .get_scanner_data() #20

Closed Frank-Raddi closed 6 months ago

Frank-Raddi commented 7 months ago

I was testing with the scanner and can't seem to get get passed this error. It seems to be occurring for all the 'Change xm, %'s.

Error: Exception has occurred: HTTPError 400 Client Error: Bad Request Body: {"totalCount":0,"error":"Unknown field \"change.5\"","data":null} for url: https://scanner.tradingview.com/america/scan File "N:\StockTrading\Live\StockScreener\StockScreener.py", line 20, in <module> .get_scanner_data()) requests.exceptions.HTTPError: 400 Client Error: Bad Request Body: {"totalCount":0,"error":"Unknown field \"change.5\"","data":null} for url: https://scanner.tradingview.com/america/scan

Full code:

from tradingview_screener import Scanner, Query, Column

_, scalpers = (Query()
 .select('name')
 .where(
     Column('Relative Volume') > 1.5,
     Column('relative_volume_10d_calc') > 1.5,
     Column('Change %') >= 8,
 )
 .get_scanner_data())

breakouts = (Query()
 .select('name')
 .where(
     Column('Relative Volume') > 3,
     Column('relative_volume_10d_calc') > 3,
     Column('Relative Volume at Time') > 3,
     Column('Change 5m, %') >= 5
 )
 .get_scanner_data())
#
#_, breakouts = breakouts  # Unpack the tuple to ignore the count and get the DataFrame
## Extract the 'name' column
#tickers = tickers.extend(breakouts['name'].tolist())

print(scalpers['name'].tolist())
shner-elmo commented 6 months ago

I fixed it. (A lot of the fields have been renamed from name.timeframe to name|timeframe)

Frank-Raddi commented 6 months ago

Awesome. Great work!

On Fri, Mar 15, 2024, 11:32 AM Shneor E. @.***> wrote:

I fixed it. (A lot of the fields have been renamed from name.timeframe to name|timeframe)

— Reply to this email directly, view it on GitHub https://github.com/shner-elmo/TradingView-Screener/issues/20#issuecomment-1999916811, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3MGUK6SLFDJOODYURFC3FDYYMIA7AVCNFSM6AAAAABEGK6KGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZHEYTMOBRGE . You are receiving this because you authored the thread.Message ID: @.***>

shner-elmo commented 6 months ago

Thanks. I released version 2.4.1 which has the updated columns, good luck.