For get_data I have values for TLSA.O for the fields I have chosen.
#import packages
import eikon as ek # the Eikon Python wrapper package
import pandas as pd
import numpy as np
import datetime
from datetime import timedelta, date, datetime
from dateutil.relativedelta import relativedelta
#connects to Bill's Eikon terminal
ek.set_app_key('72d2821f21064a0b8890860db39e375eacd87e24')
df = pd.DataFrame(df)
df = ek.get_data('TSLA.O',
['TR.NumOfStrongBuy',
'TR.NumOfBuy',
'TR.NumOfHold',
'TR.NumOfSell',
'TR.NumOfStrongSell'])
print(df)
Output:
( Instrument Recommendation - Number Of Strong Buy \ 0 TSLA.O 6 Recommendation - Number Of Buy Recommendation - Number Of Hold \ 0 3 11 Recommendation - Number Of Sell Recommendation - Number Of Strong Sell 0 10 3 , None)
However, when requesting this data using get_timeseries all of the outputs are NaN. Why is this and how do I get it to give numbers in the same way that get_data() does?
#get dates and format as strings
end_date = datetime.now()
start_date = end_date - relativedelta(months=1)
end_date_str = datetime.strftime(end_date, "%Y-%m-%d")
start_date_str = datetime.strftime(start_date, "%Y-%m-%d")
#retreive time series
df = pd.DataFrame()
df = ek.get_timeseries('TSLA.O',
['TR.NumOfStrongBuy',
'TR.NumOfBuy',
'TR.NumOfHold',
'TR.NumOfSell',
'TR.NumOfStrongSell'],
start_date = start_date_str,
end_date = end_date_str)
df
Output:
TSLA.OTR.NUMOFSTRONGBUYTR.NUMOFBUYTR.NUMOFHOLDTR.NUMOFSELLTR.NUMOFSTRONGSELLDate
2020-06-12NaNNaNNaNNaNNaN2020-06-15NaNNaNNaNNaNNaN2020-06-16NaNNaNNaNNaNNaN2020-06-17NaNNaNNaNNaNNaN2020-06-18NaNNaNNaNNaNNaN2020-06-19NaNNaNNaNNaNNaN2020-06-22NaNNaNNaNNaNNaN2020-06-23NaNNaNNaNNaNNaN2020-06-24NaNNaNNaNNaNNaN2020-06-25NaNNaNNaNNaNNaN2020-06-26NaNNaNNaNNaNNaN2020-06-29NaNNaNNaNNaNNaN2020-06-30NaNNaNNaNNaNNaN2020-07-01NaNNaNNaNNaNNaN2020-07-02NaNNaNNaNNaNNaN2020-07-06NaNNaNNaNNaNNaN2020-07-07NaNNaNNaNNaNNaN2020-07-08NaNNaNNaNNaNNaN2020-07-09NaNNaNNaNNaNNaN2020-07-10NaNNaNNaNNaNNaN