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

Can I get the Analyst rating data by this project? #12

Closed jet-c-21 closed 9 months ago

jet-c-21 commented 9 months ago

I want to select the symbol is in strong buy rating

jet-c-21 commented 9 months ago

But I don't want the rating of "Technical Rating", I want to find the rating of "Analyst Rating", like the rating in the stock forecast page

shner-elmo commented 9 months ago

@jet-c-21 Sorry I misunderstood your initial question. I did some digging and I found the fields you are looking for:

cols = [
    'recommendation_over',
    'recommendation_total',
    'recommendation_sell',
    'recommendation_under',
    'recommendation_hold',
    'recommendation_mark',
    'recommendation_buy',
]

_, df = Query().select( *cols).set_tickers('NASDAQ:AAPL').get_scanner_data()
df.to_dict('records')
[{'ticker': 'NASDAQ:AAPL',
  'recommendation_over': 5,
  'recommendation_total': 44,
  'recommendation_sell': 2,
  'recommendation_under': 1,
  'recommendation_hold': 14,
  'recommendation_mark': 1.5,
  'recommendation_buy': 22}]

image

And you can use the formatter from above for the recommendation_mark column. cheers