...le, EUR, be able to download the last 2 days on 1 minute data and keep getting the real time updates?
Hi @fredy.sarmiento
First, you can use get_timeseries to get 2 days amount of 1-minute data.
Then if you still want 1-minute data, you can loop the call every 1 minute to get 1-minute data
Or if you need realtime data, you can use StreamingPrice API call to get the realtime data. Please refer to this document.
Hi @fredy.sarmiento Replying to you in this thread, since it is more relevant to your new question. As Chavalit mentioned, you can use the get_timeseries API call to get the historical data and combine it with get_data call as described in other thread to get minute updates.
So essentially:
df = ek.get_timeseries('EUR=', fields=['CLOSE'], count=10, interval='minute')while True: df2,err = ek.get_data('EUR=', ['CF_CLOSE']) print(df2) time.sleep(60)
You might want to append to the dataframe, if you need one continuous series:
df2.columns = ['Instrument', 'CLOSE']df.append(df2) CLOSE Instrument2020-01-21 16:04:00 1.1098 NaN2020-01-21 16:05:00 1.1098 NaN2020-01-21 16:06:00 1.1097 NaN2020-01-21 16:07:00 1.1096 NaN2020-01-21 16:08:00 1.1097 NaN2020-01-21 16:09:00 1.1099 NaN2020-01-21 16:10:00 1.1096 NaN2020-01-21 16:11:00 1.1097 NaN2020-01-21 16:12:00 1.1097 NaN2020-01-21 16:13:00 1.1095 NaN0 1.1094 EUR=
There is technical analysis fields available as well (don't seem to be working for FX instruments though):
Get Moving averages:
>>> df3,err = ek.get_data('IBM.N', fields=['TR.Price200DayAverage','TR.Price50DayAverage', 'TR.MovAvgCDSignal', 'TR.PriceMoVolatilityDly'])>>> df3 Instrument 200-day SMA 50-day SMA MACD - Signal Price Momentum Daily Volatility0 IBM.N 137.9519 134.8674 0.391135 1.19946
Thanks a lot !!
@Gurpreet !
Many thanks !! much appreciated it.