How to get market data for the new IQOption-Api-async
Opened this issue · 0 comments
MightyMaxSaviorOfTheUniverse commented
I see the old method is as follows:
You need to subscribe to the market before accessing the market data.
This is what is needed to get market data.
api.subscribe_market("EURUSD")
time.sleep(1) ## Artificial delay due to socket
eur_usd_market_data = api.market_data["EURUSD"] ## a dictionary with timestamp as keys
or you can get candle data for a market using this
# api.update_candle_data(market_name,interval,start_time,end_time)
api.update_candle_data("EURUSD",1,0,int(time.time())) ## get latest 1000 candles with 1 second interval
time.sleep(1) ## Artificial delay
# api.candle_data[market_name][interval] # list of lists [time,open,close,high,low]
print(api.candle_data["EURUSD][1]) # prints candles
Originally posted by @harwee in #8 (comment)