Skip to content

Instantly share code, notes, and snippets.

@ochsec
Created September 25, 2020 18:49
Show Gist options
  • Save ochsec/1f06aca33e4187a94f30695df376ee7c to your computer and use it in GitHub Desktop.
Save ochsec/1f06aca33e4187a94f30695df376ee7c to your computer and use it in GitHub Desktop.
df.sort_values(by='YTDchange', inplace=True)
output = []
for index in range(10):
company = df.iloc[[index]]
est = estimates.get_stock_estimates(company['Symbol'].values[0])
recs = est['recommendations'][0]
targets = est['price_target']
row = [
company['Symbol'].values[0],
company['Company'].values[0],
company['Price'].values[0],
company['YTDchange'].values[0],
recs['strongBuy'] + recs['buy'],
recs['hold'],
recs['sell'] + recs['strongSell'],
targets['targetHigh'],
targets['targetMean'],
targets['targetLow'],
targets['lastUpdated'],
]
output.append(row)
tt.print(output, header=[
'Symbol',
'Company',
'Price',
'YTDchange',
'Buy',
'Hold',
'Sell',
'Target High',
'Target Mean',
'Target Low',
'Last Updated'
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment