Skip to main content

Command-line tool for MetaTrader 5

Project description

mt5cli

CI/CD

Command-line tool for exporting MetaTrader 5 data to CSV, JSON, Parquet, and SQLite3.

Built on top of pdmt5, a pandas-based data handler for MetaTrader 5.

Features

  • 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

Installation

pip install -U mt5cli MetaTrader5

Usage

# 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 credentials
mt5cli --login 12345 --password mypass --server MyBroker-Demo \
  -o positions.csv positions

Run as a Python module:

python -m mt5cli -o account.csv account-info

Commands

Command Description
rates-from Export rates from a start date
rates-from-pos Export rates from a start position
rates-range Export rates for a date range
ticks-from Export ticks from a start date
ticks-range Export ticks for a date range
account-info Export account information
terminal-info Export terminal information
version Export MetaTrader 5 version information
last-error Export the last error information
symbols Export symbol list
symbol-info Export symbol details
symbol-info-tick Export the last tick for a symbol
market-book Export market depth (order book)
orders Export active orders
positions Export open positions
history-orders Export historical orders
history-deals Export historical deals
order-check Check funds sufficiency for a trade request
order-send Send a trade request to the trade server (--yes required)

Use order-check to validate a request payload before running order-send --yes.

Requirements

  • Python 3.11+
  • Windows OS (MetaTrader 5 requirement)
  • MetaTrader 5 platform installed

Development

git clone https://github.com/dceoy/mt5cli.git
cd mt5cli
uv sync

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mt5cli-0.2.0.tar.gz (80.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mt5cli-0.2.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file mt5cli-0.2.0.tar.gz.

File metadata

  • Download URL: mt5cli-0.2.0.tar.gz
  • Upload date:
  • Size: 80.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for mt5cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 58e87e25542ead2f3d03b67b3ce72b0d1d307c08ca7472d43e80914d5ed89ba1
MD5 a6b28d12a595214eb379ef5f33f0404f
BLAKE2b-256 4edaac9abc3d1d1956bc6d66ae65a8a098f8a482c981d92e8fe146fab1c77c98

See more details on using hashes here.

Provenance

The following attestation bundles were made for mt5cli-0.2.0.tar.gz:

Publisher: release.yml on dceoy/mt5cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mt5cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mt5cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for mt5cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67676299dc26b42bb4e3ff58d834935485f514ab5924840f52f55714987faa22
MD5 22089a0a2f1f9018fe2c5e26b02d6479
BLAKE2b-256 4c43ba24e32a7482859945a45cc66f53ec2ddf5eb85aa7cb200a68d341505859

See more details on using hashes here.

Provenance

The following attestation bundles were made for mt5cli-0.2.0-py3-none-any.whl:

Publisher: release.yml on dceoy/mt5cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page