Files
AlphaFlow-MT5-ML-DL-Trading…/data/__pycache__/data_loader.cpython-311.pyc
T

15 lines
1.6 KiB
Plaintext
Raw Normal View History

2025-03-02 22:25:33 +01:00
§
?$Ãg»ãóJddlZddlZddlZddlmZddededej fdZ
dS)éN)ÚdatetimeÚsymbolÚn_barsÚreturncó$|tj||d|¦«}ntj||||¦«}|td|¦«tj|¦«}tj|dd¬¦«|d<| dd¬¦«|S) aé
Fetch historical data from MetaTrader 5.
- `symbol`: Trading instrument (e.g., "BTCUSD").
- `n_bars`: Number of bars to retrieve.
- `timeframe`: MT5 timeframe (e.g., mt5.TIMEFRAME_H1).
- `start_pos`: Offset from the most recent bar (default `None` for live trading).
If `start_pos` is `None`, fetches the latest `n_bars` (useful for live trading).
If `start_pos` is given, fetches `n_bars` from that historical position (useful for backtesting).
NrzCould not retrieve data for ÚtimeÚs)ÚunitT)Úinplace)Úmt5Úcopy_rates_from_posÚ
ValueErrorÚpdÚ DataFrameÚ to_datetimeÚ set_index)rrÚ timeframeÚ start_posÚratesÚdfs úAc:\Users\moham\OneDrive\AlphaFlow Trading Bot\data\data_loader.pyÚ get_data_mt5rðÐÝÔ° ¸1¸fÑEˆˆåÔ° ¸9ÀfÑà €}ÝÐÐ ŒÔ €BÝ  6¤
°Ð5€B€v‡LL €LÑ