I started using this api yesterday and everything worked fine but starting today, the historical data started acting weird. It doesn't bring the latest bar and the bar range of the output is more than requested. No matter what timeframe or range of dates requested, it brings this same constant output of M1 bars requested over a day. It was the last request I made yesterday:
historic_data: EURUSD M1 1434 bars
{'EURUSD_M1': {'2023.03.08 10:53': {'open': 1.05407, 'high': 1.05413, 'low': 1.05398, 'close': 1.05407, 'tick_volume': 73.0}, '2023.03.08 10:54': {'open': 1.05408, 'high': 1.05413, 'low': 1.05394, 'close': 1.05413, 'tick_volume': 76.0}, '2023.03.08 10:55': {'open': 1.05413, 'high': 1.05414, 'low': 1.05397, 'close': 1.05412, 'tick_volume': 62.0}, '2023.03.08 10:56': {'open': 1.05412, 'high': 1.05428, 'low': 1.05385, 'close': 1.05385, 'tick_volume': 79.0}, '2023.03.08 10:57': {'open': 1.05386, 'high': 1.05386, 'low': 1.05367, 'close': 1.05372, 'tick_volume': 43.0},
... ... ... ... ... ...
'2023.03.09 10:50': {'open': 1.0557, 'high': 1.0557, 'low': 1.05548, 'close': 1.05554, 'tick_volume': 55.0}, '2023.03.09 10:51': {'open': 1.05555, 'high': 1.05588, 'low': 1.05555, 'close': 1.05588, 'tick_volume': 32.0}, '2023.03.09 10:52': {'open': 1.0559, 'high': 1.05595, 'low': 1.0559, 'close': 1.05595, 'tick_volume': 12.0}}}
Time : 2023-03-10 13:43:49.481380
class tick_processor():
def __init__(self, MT4_directory_path,
sleep_delay=0.005, # 5 ms for time.sleep()
max_retry_command_seconds=10, # retry to send the commend for 10 seconds if not successful.
verbose=True
):
self.dwx = dwx_client(self, MT4_directory_path, sleep_delay,
max_retry_command_seconds, verbose=verbose)
sleep(1)
self.dwx.start()
# request historic data:
end = datetime.utcnow()
start = end - timedelta(hours=2)
self.dwx.get_historic_data('EURUSD', 'M15', start.timestamp(), end.timestamp())
def on_historic_data(self, symbol, time_frame, data):
data_ = self.dwx.historic_data
print('historic_data:', symbol, time_frame, f'{len(data)} bars')
print(data_)
print(f"Time : {datetime.utcnow()}")