Files
mt5cli/search/search_index.json
T

1 line
438 KiB
JSON
Raw Normal View History

2026-06-11 14:23:26 +00:00
{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"mt5cli \u00b6 Command-line tool for MetaTrader 5 data export. Overview \u00b6 mt5cli is a CLI application that exports MetaTrader 5 trading data to multiple file formats. It is built on top of pdmt5 , a pandas-based data handler for MetaTrader 5. Architecture \u00b6 pdmt5 \u2014 canonical MT5 client, DataFrame/trading primitives, and MT5 constant parsing ( TIMEFRAME_* , COPY_TICKS_* , order types). mt5cli \u2014 CLI commands, CSV/JSON/Parquet/SQLite export, SQLite history collection, rate views, and local batch/automation SDK helpers built on pdmt5. mt5api \u2014 sibling HTTP adapter for remote MT5 access; not a dependency of mt5cli. Features \u00b6 Multi-format export : CSV, JSON, Parquet, and SQLite3 output formats Auto-detection : Format detection from file extensions Comprehensive data access : Rates, ticks, account info, symbols, orders, positions, and trading history Flexible timeframes : Named timeframes (M1, H1, D1, etc.) and numeric values Connection management : Optional credentials, server, and timeout configuration SQLite rate loading : Load mt5cli-managed rate tables/views for offline workflows Installation \u00b6 pip install mt5cli Programmatic usage / SDK usage \u00b6 mt5cli can be used as a small Python SDK for read-only MetaTrader 5 data collection. SDK functions return pandas DataFrames without writing files. Use export_dataframe or export_dataframe_to_sqlite when you need to persist results. from datetime import UTC , datetime from pathlib import Path from mt5cli import ( Mt5CliClient , collect_history , copy_rates_range , export_dataframe , export_dataframe_to_sqlite , load_rate_data , minimum_margins , recent_ticks , ) from mt5cli.history import resolve_rate_view_name # One-off fetch with module-level helpers rates = copy_rates_range ( \"EURUSD\" , timeframe = \"H1\" , date_from = \"2024-01-01\" , date_to = \"2024-02-01\" , ) export_dataframe ( rates , Path ( \"rates.csv\" ), \"csv\" ) # Resolve SQLite rate compatibility views for downstream tools view = resolve_rate_view_name ( Path ( \"history.db\" ), \"EURUSD\" , \"M1\" , require_existing = True ) offline_rates = load_rate_data ( Path ( \"history.db\" ), view , count = 1000 ) # Recent tick window and minimum margin summary ticks = recent_ticks ( \"EURUSD\" , seconds = 300 ) margins = minimum_margins ( \"EURUSD\" ) # Reuse one MT5 connection for multiple calls with Mt5CliClient ( login = 12345 , password = \"secret\" , server = \"Broker-Demo\" ) as client : account = client . account_info () positions = client . positions () latest = client . latest_rates ( \"EURUSD\" , \"M1\" , count = 100 ) summary = client . mt5_summary () summary_table = client . mt5_summary_as_df () # Bulk SQLite collection (same behavior as the collect-history CLI command) collect_history ( Path ( \"history.db\" ), symbols = [ \"EURUSD\" , \"GBPUSD\" ], date_from = datetime ( 2024 , 1 , 1 , tzinfo = UTC ), date_to = datetime ( 2024 , 2 , 1 , tzinfo = UTC ), timeframe = \"M1\" , flags = \"ALL\" , with_views = True , ) Timeframes, tick flags, and ISO 8601 date strings are accepted wherever noted in the SDK API. Mt5CliClient.mt5_summary() returns the SDK structured form as plain nested Python values. Use Mt5CliClient.mt5_summary_as_df() when you need a one-row DataFrame for export. The mt5-summary CLI command uses this tabular form, so nested terminal/account fields are JSON-encoded strings that are safe for CSV, JSON, Parquet, and SQLite output. Quick Start \u00b6 # Export account information to CSV mt5cli -o account.csv account-info # Export EURUSD M1 rates to Parquet mt5cli -o rates.parquet rates-from --symbol EURUSD --timeframe M1 \\ --date-from 2024 -01-01 --count 1000 # Export ticks to JSON mt5cli -o ticks.json ticks-from --symbol EURUSD \\ --date-from 2024 -01-01 --count 500 --flags ALL # Export symbols to SQLite3 with custom table name mt5cli -o data.db --table symbols symbols --group \"*USD*\" # Export with connection credentia