Код: Выделить всё
historical_data_chf = mt5.copy_rates_from_pos("USDCHF", mt_timeframe, 0, 100)
histor_frame_chf = pd.DataFrame(historical_data_chf)
while True:
try:
last_candle_chf = mt5.copy_rates_from_pos("USDCHF", mt_timeframe, 0, 1)
last_frame = pd.Dataframe(last_candle_chf)
updated_frame = pd.concat(last_frame , histor_frame_chf)
print(updated_frame_chf.tail())
print(f"Seconds until next candle: {seconds_until_next_candle}")
time.sleep(10)
Код: Выделить всё
2024-09-20 10:45:00 0.84706 0.84808 0.84692 0.84792 2330 0 0 0.846639 0.000099 0 0.847360 1 0
2024-09-20 11:00:00 0.84793 0.84807 0.84744 0.84783 2243 0 0 0.846745 0.000105 0 0.847595 1 0
2024-09-20 11:15:00 0.84784 0.84811 0.84760 0.84769 2230 0 0 0.846837 0.000092 0 0.847642 1 0
2024-09-20 11:30:00 0.84768 0.84771 0.84710 0.84732 1772 1 0 0.846895 0.000058 0 0.847481 1 0
2024-09-20 12:45:00 0.84735 0.84744 0.84730 0.84743 40 1 0 0.846947 0.000052 0 0.847456
Подробнее здесь: https://stackoverflow.com/questions/790 ... -trade-bot