2026-04-22 17:11:38 +00:00
<!doctype html>
< html lang = "en" class = "no-js" >
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width,initial-scale=1" >
< meta name = "description" content = "Command-line tool for MetaTrader 5" >
< meta name = "author" content = "dceoy" >
< link rel = "canonical" href = "https://github.com/dceoy/mt5cli/" >
< link rel = "next" href = "api/" >
< link rel = "icon" href = "assets/images/favicon.png" >
< meta name = "generator" content = "mkdocs-1.6.1, mkdocs-material-9.7.6" >
< title > mt5cli API Documentation</ title >
< link rel = "stylesheet" href = "assets/stylesheets/main.484c7ddc.min.css" >
< link rel = "preconnect" href = "https://fonts.gstatic.com" crossorigin >
< link rel = "stylesheet" href = "https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback" >
< style >: root { --md-text-font : "Roboto" ; --md-code-font : "Roboto Mono" }</ style >
< link rel = "stylesheet" href = "assets/_mkdocstrings.css" >
< script > __md_scope = new URL ( "." , location ), __md_hash = e =>[... e ]. reduce ((( e , _ )=>( e << 5 ) - e + _ . charCodeAt ( 0 )), 0 ), __md_get = ( e , _ = localStorage , t = __md_scope )=> JSON . parse ( _ . getItem ( t . pathname + "." + e )), __md_set = ( e , _ , t = localStorage , a = __md_scope )=>{ try { t . setItem ( a . pathname + "." + e , JSON . stringify ( _ ))} catch ( e ){}}</ script >
</ head >
< body dir = "ltr" >
< input class = "md-toggle" data-md-toggle = "drawer" type = "checkbox" id = "__drawer" autocomplete = "off" >
< input class = "md-toggle" data-md-toggle = "search" type = "checkbox" id = "__search" autocomplete = "off" >
< label class = "md-overlay" for = "__drawer" ></ label >
< div data-md-component = "skip" >
< a href = "#mt5cli" class = "md-skip" >
Skip to content
</ a >
</ div >
< div data-md-component = "announce" >
</ div >
< header class = "md-header md-header--shadow" data-md-component = "header" >
< nav class = "md-header__inner md-grid" aria-label = "Header" >
< a href = "." title = "mt5cli API Documentation" class = "md-header__button md-logo" aria-label = "mt5cli API Documentation" data-md-component = "logo" >
< svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" >< path d = "M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54" /></ svg >
</ a >
< label class = "md-header__button md-icon" for = "__drawer" >
< svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" >< path d = "M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z" /></ svg >
</ label >
< div class = "md-header__title" data-md-component = "header-title" >
< div class = "md-header__ellipsis" >
< div class = "md-header__topic" >
< span class = "md-ellipsis" >
mt5cli API Documentation
</ span >
</ div >
< div class = "md-header__topic" data-md-component = "header-topic" >
< span class = "md-ellipsis" >
Home
</ span >
</ div >
</ div >
</ div >
< script > var palette = __md_get ( "__palette" ); if ( palette && palette . color ){ if ( "(prefers-color-scheme)" === palette . color . media ){ var media = matchMedia ( "(prefers-color-scheme: light)" ), input = document . querySelector ( media . matches ? "[data-md-color-media='(prefers-color-scheme: light)']" : "[data-md-color-media='(prefers-color-scheme: dark)']" ); palette . color . media = input . getAttribute ( "data-md-color-media" ), palette . color . scheme = input . getAttribute ( "data-md-color-scheme" ), palette . color . primary = input . getAttribute ( "data-md-color-primary" ), palette . color . accent = input . getAttribute ( "data-md-color-accent" )} for ( var [ key , value ] of Object . entries ( palette . color )) document . body . setAttribute ( "data-md-color-" + key , value )}</ script >
< label class = "md-header__button md-icon" for = "__search" >
< svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" >< path d = "M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5" /></ svg >
</ label >
< div class = "md-search" data-md-component = "search" role = "dialog" >
< label class = "md-search__overlay" for = "__search" ></ label >
< div class = "md-search__inner" role = "search" >
< form class = "md-search__form" name = "search" >
< input type = "text" class = "md-search__input" name = "query" aria-label = "Search" placeholder = "Search" autocapitalize = "off" autocorrect = "off" autocomplete = "off" spellcheck = "false" data-md-component = "search-query" required >
< label class = "md-search__icon md-icon" for = "__search" >
< svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" >< path d = "M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5" /></ svg >
< svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" >< path d = "M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z" /></ svg >
</ label >
< nav class = "md-search__options" aria-label = "Search" >
< button type = "reset" class = "md-search__icon md-icon" title = "Clear" aria-label = "Clear" tabindex = "-1" >
< svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" >< path d = "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" /></ svg >
</ button >
</ nav >
</ form >
< div class = "md-search__output" >
< div class = "md-search__scrollwrap" tabindex = "0" data-md-scrollfix >
< div class = "md-search-result" data-md-component = "search-result" >
< div class = "md-search-result__meta" >
Initializing search
</ div >
< ol class = "md-search-result__list" role = "presentation" ></ ol >
</ div >
</ div >
</ div >
</ div >
</ div >
< div class = "md-header__source" >
< a href = "https://github.com/dceoy/mt5cli" title = "Go to repository" class = "md-source" data-md-component = "source" >
< div class = "md-source__icon md-icon" >
< svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 448 512" > <!--! Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--> < path d = "M439.6 236.1 244 40.5c-5.4-5.5-12.8-8.5-20.4-8.5s-15 3-20.4 8.4L162.5 81l51.5 51.5c27.1-9.1 52.7 16.8 43.4 43.7l49.7 49.7c34.2-11.8 61.2 31 35.5 56.7-26.5 26.5-70.2-2.9-56-37.3L240.3 199v121.9c25.3 12.5 22.3 41.8 9.1 55-6.4 6.4-15.2 10.1-24.3 10.1s-17.8-3.6-24.3-10.1c-17.6-17.6-11.1-46.9 11.2-56v-123c-20.8-8.5-24.6-30.7-18.6-45L142.6 101 8.5 235.1C3 240.6 0 247.9 0 255.5s3 15 8.5 20.4l195.6 195.7c5.4 5.4 12.7 8.4 20.4 8.4s15-3 20.4-8.4l194.7-194.7c5.4-5.4 8.4-12.8 8.4-20.4s-3-15-8.4-20.4" /></ svg >
</ div >
< div class = "md-source__repository" >
dceoy/mt5cli
</ div >
</ a >
</ div >
</ nav >
</ header >
< div class = "md-container" data-md-component = "container" >
< main class = "md-main" data-md-component = "main" >
< div class = "md-main__inner md-grid" >
< div class = "md-sidebar md-sidebar--primary" data-md-component = "sidebar" data-md-type = "navigation" >
< div class = "md-sidebar__scrollwrap" >
< div class = "md-sidebar__inner" >
< nav class = "md-nav md-nav--primary" aria-label = "Navigation" data-md-level = "0" >
< label class = "md-nav__title" for = "__drawer" >
< a href = "." title = "mt5cli API Documentation" class = "md-nav__button md-logo" aria-label = "mt5cli API Documentation" data-md-component = "logo" >
< svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" >< path d = "M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54" /></ svg >
</ a >
mt5cli API Documentation
</ label >
< div class = "md-nav__source" >
< a href = "https://github.com/dceoy/mt5cli" title = "Go to repository" class = "md-source" data-md-component = "source" >
< div class = "md-source__icon md-icon" >
< svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 448 512" > <!--! Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--> < path d = "M439.6 236.1 244 40.5c-5.4-5.5-12.8-8.5-20.4-8.5s-15 3-20.4 8.4L162.5 81l51.5 51.5c27.1-9.1 52.7 16.8 43.4 43.7l49.7 49.7c34.2-11.8 61.2 31 35.5 56.7-26.5 26.5-70.2-2.9-56-37.3L240.3 199v121.9c25.3 12.5 22.3 41.8 9.1 55-6.4 6.4-15.2 10.1-24.3 10.1s-17.8-3.6-24.3-10.1c-17.6-17.6-11.1-46.9 11.2-56v-123c-20.8-8.5-24.6-30.7-18.6-45L142.6 101 8.5 235.1C3 240.6 0 247.9 0 255.5s3 15 8.5 20.4l195.6 195.7c5.4 5.4 12.7 8.4 20.4 8.4s15-3 20.4-8.4l194.7-194.7c5.4-5.4 8.4-12.8 8.4-20.4s-3-15-8.4-20.4" /></ svg >
</ div >
< div class = "md-source__repository" >
dceoy/mt5cli
</ div >
</ a >
</ div >
< ul class = "md-nav__list" data-md-scrollfix >
< li class = "md-nav__item md-nav__item--active" >
< input class = "md-nav__toggle md-toggle" type = "checkbox" id = "__toc" >
< label class = "md-nav__link md-nav__link--active" for = "__toc" >
< span class = "md-ellipsis" >
Home
</ span >
< span class = "md-nav__icon md-icon" ></ span >
</ label >
< a href = "." class = "md-nav__link md-nav__link--active" >
< span class = "md-ellipsis" >
Home
</ span >
</ a >
< nav class = "md-nav md-nav--secondary" aria-label = "Table of contents" >
< label class = "md-nav__title" for = "__toc" >
< span class = "md-nav__icon md-icon" ></ span >
Table of contents
</ label >
< ul class = "md-nav__list" data-md-component = "toc" data-md-scrollfix >
< li class = "md-nav__item" >
< a href = "#overview" class = "md-nav__link" >
< span class = "md-ellipsis" >
Overview
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#features" class = "md-nav__link" >
< span class = "md-ellipsis" >
Features
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#installation" class = "md-nav__link" >
< span class = "md-ellipsis" >
Installation
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#quick-start" class = "md-nav__link" >
< span class = "md-ellipsis" >
Quick Start
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#commands" class = "md-nav__link" >
< span class = "md-ellipsis" >
Commands
</ span >
</ a >
< nav class = "md-nav" aria-label = "Commands" >
< ul class = "md-nav__list" >
< li class = "md-nav__item" >
< a href = "#rates" class = "md-nav__link" >
< span class = "md-ellipsis" >
Rates
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#ticks" class = "md-nav__link" >
< span class = "md-ellipsis" >
Ticks
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#information" class = "md-nav__link" >
< span class = "md-ellipsis" >
Information
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#trading" class = "md-nav__link" >
< span class = "md-ellipsis" >
Trading
</ span >
</ a >
</ li >
</ ul >
</ nav >
</ li >
< li class = "md-nav__item" >
< a href = "#global-options" class = "md-nav__link" >
< span class = "md-ellipsis" >
Global Options
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#requirements" class = "md-nav__link" >
< span class = "md-ellipsis" >
Requirements
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#api-reference" class = "md-nav__link" >
< span class = "md-ellipsis" >
API Reference
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#development" class = "md-nav__link" >
< span class = "md-ellipsis" >
Development
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#license" class = "md-nav__link" >
< span class = "md-ellipsis" >
License
</ span >
</ a >
</ li >
</ ul >
</ nav >
</ li >
< li class = "md-nav__item md-nav__item--nested" >
< input class = "md-nav__toggle md-toggle " type = "checkbox" id = "__nav_2" >
< label class = "md-nav__link" for = "__nav_2" id = "__nav_2_label" tabindex = "0" >
< span class = "md-ellipsis" >
API Reference
</ span >
< span class = "md-nav__icon md-icon" ></ span >
</ label >
< nav class = "md-nav" data-md-level = "1" aria-labelledby = "__nav_2_label" aria-expanded = "false" >
< label class = "md-nav__title" for = "__nav_2" >
< span class = "md-nav__icon md-icon" ></ span >
API Reference
</ label >
< ul class = "md-nav__list" data-md-scrollfix >
< li class = "md-nav__item" >
< a href = "api/" class = "md-nav__link" >
< span class = "md-ellipsis" >
Overview
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "api/cli/" class = "md-nav__link" >
< span class = "md-ellipsis" >
CLI
</ span >
</ a >
</ li >
</ ul >
</ nav >
</ li >
</ ul >
</ nav >
</ div >
</ div >
</ div >
< div class = "md-sidebar md-sidebar--secondary" data-md-component = "sidebar" data-md-type = "toc" >
< div class = "md-sidebar__scrollwrap" >
< div class = "md-sidebar__inner" >
< nav class = "md-nav md-nav--secondary" aria-label = "Table of contents" >
< label class = "md-nav__title" for = "__toc" >
< span class = "md-nav__icon md-icon" ></ span >
Table of contents
</ label >
< ul class = "md-nav__list" data-md-component = "toc" data-md-scrollfix >
< li class = "md-nav__item" >
< a href = "#overview" class = "md-nav__link" >
< span class = "md-ellipsis" >
Overview
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#features" class = "md-nav__link" >
< span class = "md-ellipsis" >
Features
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#installation" class = "md-nav__link" >
< span class = "md-ellipsis" >
Installation
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#quick-start" class = "md-nav__link" >
< span class = "md-ellipsis" >
Quick Start
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#commands" class = "md-nav__link" >
< span class = "md-ellipsis" >
Commands
</ span >
</ a >
< nav class = "md-nav" aria-label = "Commands" >
< ul class = "md-nav__list" >
< li class = "md-nav__item" >
< a href = "#rates" class = "md-nav__link" >
< span class = "md-ellipsis" >
Rates
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#ticks" class = "md-nav__link" >
< span class = "md-ellipsis" >
Ticks
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#information" class = "md-nav__link" >
< span class = "md-ellipsis" >
Information
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#trading" class = "md-nav__link" >
< span class = "md-ellipsis" >
Trading
</ span >
</ a >
</ li >
</ ul >
</ nav >
</ li >
< li class = "md-nav__item" >
< a href = "#global-options" class = "md-nav__link" >
< span class = "md-ellipsis" >
Global Options
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#requirements" class = "md-nav__link" >
< span class = "md-ellipsis" >
Requirements
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#api-reference" class = "md-nav__link" >
< span class = "md-ellipsis" >
API Reference
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#development" class = "md-nav__link" >
< span class = "md-ellipsis" >
Development
</ span >
</ a >
</ li >
< li class = "md-nav__item" >
< a href = "#license" class = "md-nav__link" >
< span class = "md-ellipsis" >
License
</ span >
</ a >
</ li >
</ ul >
</ nav >
</ div >
</ div >
</ div >
< div class = "md-content" data-md-component = "content" >
< article class = "md-content__inner md-typeset" >
< h1 id = "mt5cli" > mt5cli< a class = "headerlink" href = "#mt5cli" title = "Permanent link" > ¶ </ a ></ h1 >
< p > Command-line tool for MetaTrader 5 data export.</ p >
< h2 id = "overview" > Overview< a class = "headerlink" href = "#overview" title = "Permanent link" > ¶ </ a ></ h2 >
< p > mt5cli is a CLI application that exports MetaTrader 5 trading data to multiple file formats. It is built on top of < a href = "https://github.com/dceoy/pdmt5" > pdmt5</ a > , a pandas-based data handler for MetaTrader 5.</ p >
< h2 id = "features" > Features< a class = "headerlink" href = "#features" title = "Permanent link" > ¶ </ a ></ h2 >
< ul >
< li >< strong > Multi-format export</ strong > : CSV, JSON, Parquet, and SQLite3 output formats</ li >
< li >< strong > Auto-detection</ strong > : Format detection from file extensions</ li >
< li >< strong > Comprehensive data access</ strong > : Rates, ticks, account info, symbols, orders, positions, and trading history</ li >
< li >< strong > Flexible timeframes</ strong > : Named timeframes (M1, H1, D1, etc.) and numeric values</ li >
< li >< strong > Connection management</ strong > : Optional credentials, server, and timeout configuration</ li >
</ ul >
< h2 id = "installation" > Installation< a class = "headerlink" href = "#installation" title = "Permanent link" > ¶ </ a ></ h2 >
< div class = "highlight" >< pre >< span ></ span >< code >< a id = "__codelineno-0-1" name = "__codelineno-0-1" href = "#__codelineno-0-1" ></ a > pip< span class = "w" > </ span > install< span class = "w" > </ span > mt5cli
</ code ></ pre ></ div >
< h2 id = "quick-start" > Quick Start< a class = "headerlink" href = "#quick-start" title = "Permanent link" > ¶ </ a ></ h2 >
< div class = "highlight" >< pre >< span ></ span >< code >< a id = "__codelineno-1-1" name = "__codelineno-1-1" href = "#__codelineno-1-1" ></ a >< span class = "c1" > # Export account information to CSV</ span >
< a id = "__codelineno-1-2" name = "__codelineno-1-2" href = "#__codelineno-1-2" ></ a > mt5cli< span class = "w" > </ span > -o< span class = "w" > </ span > account.csv< span class = "w" > </ span > account-info
< a id = "__codelineno-1-3" name = "__codelineno-1-3" href = "#__codelineno-1-3" ></ a >
< a id = "__codelineno-1-4" name = "__codelineno-1-4" href = "#__codelineno-1-4" ></ a >< span class = "c1" > # Export EURUSD M1 rates to Parquet</ span >
< a id = "__codelineno-1-5" name = "__codelineno-1-5" href = "#__codelineno-1-5" ></ a > mt5cli< span class = "w" > </ span > -o< span class = "w" > </ span > rates.parquet< span class = "w" > </ span > rates-from< span class = "w" > </ span > --symbol< span class = "w" > </ span > EURUSD< span class = "w" > </ span > --timeframe< span class = "w" > </ span > M1< span class = "w" > </ span >< span class = "se" > \</ span >
< a id = "__codelineno-1-6" name = "__codelineno-1-6" href = "#__codelineno-1-6" ></ a >< span class = "w" > </ span > --date-from< span class = "w" > </ span >< span class = "m" > 2024</ span > -01-01< span class = "w" > </ span > --count< span class = "w" > </ span >< span class = "m" > 1000</ span >
< a id = "__codelineno-1-7" name = "__codelineno-1-7" href = "#__codelineno-1-7" ></ a >
< a id = "__codelineno-1-8" name = "__codelineno-1-8" href = "#__codelineno-1-8" ></ a >< span class = "c1" > # Export ticks to JSON</ span >
< a id = "__codelineno-1-9" name = "__codelineno-1-9" href = "#__codelineno-1-9" ></ a > mt5cli< span class = "w" > </ span > -o< span class = "w" > </ span > ticks.json< span class = "w" > </ span > ticks-from< span class = "w" > </ span > --symbol< span class = "w" > </ span > EURUSD< span class = "w" > </ span >< span class = "se" > \</ span >
< a id = "__codelineno-1-10" name = "__codelineno-1-10" href = "#__codelineno-1-10" ></ a >< span class = "w" > </ span > --date-from< span class = "w" > </ span >< span class = "m" > 2024</ span > -01-01< span class = "w" > </ span > --count< span class = "w" > </ span >< span class = "m" > 500</ span >< span class = "w" > </ span > --flags< span class = "w" > </ span > ALL
< a id = "__codelineno-1-11" name = "__codelineno-1-11" href = "#__codelineno-1-11" ></ a >
< a id = "__codelineno-1-12" name = "__codelineno-1-12" href = "#__codelineno-1-12" ></ a >< span class = "c1" > # Export symbols to SQLite3 with custom table name</ span >
< a id = "__codelineno-1-13" name = "__codelineno-1-13" href = "#__codelineno-1-13" ></ a > mt5cli< span class = "w" > </ span > -o< span class = "w" > </ span > data.db< span class = "w" > </ span > --table< span class = "w" > </ span > symbols< span class = "w" > </ span > symbols< span class = "w" > </ span > --group< span class = "w" > </ span >< span class = "s2" > " *USD*" </ span >
< a id = "__codelineno-1-14" name = "__codelineno-1-14" href = "#__codelineno-1-14" ></ a >
< a id = "__codelineno-1-15" name = "__codelineno-1-15" href = "#__codelineno-1-15" ></ a >< span class = "c1" > # Export with connection credentials</ span >
< a id = "__codelineno-1-16" name = "__codelineno-1-16" href = "#__codelineno-1-16" ></ a > mt5cli< span class = "w" > </ span > --login< span class = "w" > </ span >< span class = "m" > 12345</ span >< span class = "w" > </ span > --password< span class = "w" > </ span > mypass< span class = "w" > </ span > --server< span class = "w" > </ span > MyBroker-Demo< span class = "w" > </ span >< span class = "se" > \</ span >
< a id = "__codelineno-1-17" name = "__codelineno-1-17" href = "#__codelineno-1-17" ></ a >< span class = "w" > </ span > -o< span class = "w" > </ span > positions.csv< span class = "w" > </ span > positions
</ code ></ pre ></ div >
< h2 id = "commands" > Commands< a class = "headerlink" href = "#commands" title = "Permanent link" > ¶ </ a ></ h2 >
< h3 id = "rates" > Rates< a class = "headerlink" href = "#rates" title = "Permanent link" > ¶ </ a ></ h3 >
< table >
< thead >
< tr >
< th > Command</ th >
< th > Description</ th >
</ tr >
</ thead >
< tbody >
< tr >
< td >< code > rates-from</ code ></ td >
< td > Export rates from a start date</ td >
</ tr >
< tr >
< td >< code > rates-from-pos</ code ></ td >
< td > Export rates from a start position</ td >
</ tr >
< tr >
< td >< code > rates-range</ code ></ td >
< td > Export rates for a date range</ td >
</ tr >
</ tbody >
</ table >
< h3 id = "ticks" > Ticks< a class = "headerlink" href = "#ticks" title = "Permanent link" > ¶ </ a ></ h3 >
< table >
< thead >
< tr >
< th > Command</ th >
< th > Description</ th >
</ tr >
</ thead >
< tbody >
< tr >
< td >< code > ticks-from</ code ></ td >
< td > Export ticks from a start date</ td >
</ tr >
< tr >
< td >< code > ticks-range</ code ></ td >
< td > Export ticks for a date range</ td >
</ tr >
</ tbody >
</ table >
< h3 id = "information" > Information< a class = "headerlink" href = "#information" title = "Permanent link" > ¶ </ a ></ h3 >
< table >
< thead >
< tr >
< th > Command</ th >
< th > Description</ th >
</ tr >
</ thead >
< tbody >
< tr >
< td >< code > account-info</ code ></ td >
< td > Export account information</ td >
</ tr >
< tr >
< td >< code > terminal-info</ code ></ td >
< td > Export terminal information</ td >
</ tr >
< tr >
2026-04-26 12:50:38 +00:00
< td >< code > version</ code ></ td >
< td > Export MetaTrader 5 version information</ td >
</ tr >
< tr >
< td >< code > last-error</ code ></ td >
< td > Export the last error information</ td >
</ tr >
< tr >
2026-04-22 17:11:38 +00:00
< td >< code > symbols</ code ></ td >
< td > Export symbol list</ td >
</ tr >
< tr >
< td >< code > symbol-info</ code ></ td >
< td > Export symbol details</ td >
</ tr >
2026-04-26 12:50:38 +00:00
< tr >
< td >< code > symbol-info-tick</ code ></ td >
< td > Export the last tick for a symbol</ td >
</ tr >
< tr >
< td >< code > market-book</ code ></ td >
< td > Export market depth (order book)</ td >
</ tr >
2026-04-22 17:11:38 +00:00
</ tbody >
</ table >
< h3 id = "trading" > Trading< a class = "headerlink" href = "#trading" title = "Permanent link" > ¶ </ a ></ h3 >
< table >
< thead >
< tr >
< th > Command</ th >
< th > Description</ th >
</ tr >
</ thead >
< tbody >
< tr >
< td >< code > orders</ code ></ td >
< td > Export active orders</ td >
</ tr >
< tr >
< td >< code > positions</ code ></ td >
< td > Export open positions</ td >
</ tr >
< tr >
< td >< code > history-orders</ code ></ td >
< td > Export historical orders</ td >
</ tr >
< tr >
< td >< code > history-deals</ code ></ td >
< td > Export historical deals</ td >
</ tr >
2026-04-26 12:50:38 +00:00
< tr >
< td >< code > order-check</ code ></ td >
< td > Check funds sufficiency for a trade request</ td >
</ tr >
< tr >
< td >< code > order-send</ code ></ td >
< td > Send a trade request to the trade server (< code > --yes</ code > required)</ td >
</ tr >
2026-04-22 17:11:38 +00:00
</ tbody >
</ table >
2026-04-26 12:50:38 +00:00
< p > Use < code > order-check</ code > to validate a request payload before running < code > order-send --yes</ code > .</ p >
2026-04-22 17:11:38 +00:00
< h2 id = "global-options" > Global Options< a class = "headerlink" href = "#global-options" title = "Permanent link" > ¶ </ a ></ h2 >
< table >
< thead >
< tr >
< th > Option</ th >
< th > Description</ th >
</ tr >
</ thead >
< tbody >
< tr >
< td >< code > -o, --output</ code ></ td >
< td > Output file path (required)</ td >
</ tr >
< tr >
< td >< code > -f, --format</ code ></ td >
< td > Output format (auto-detected from extension if omitted)</ td >
</ tr >
< tr >
< td >< code > --table</ code ></ td >
< td > Table name for SQLite3 output (default: "data")</ td >
</ tr >
< tr >
< td >< code > --login</ code ></ td >
< td > Trading account login</ td >
</ tr >
< tr >
< td >< code > --password</ code ></ td >
< td > Trading account password</ td >
</ tr >
< tr >
< td >< code > --server</ code ></ td >
< td > Trading server name</ td >
</ tr >
< tr >
< td >< code > --path</ code ></ td >
< td > Path to MetaTrader5 terminal EXE file</ td >
</ tr >
< tr >
< td >< code > --timeout</ code ></ td >
< td > Connection timeout in milliseconds</ td >
</ tr >
< tr >
< td >< code > --log-level</ code ></ td >
< td > Logging level (DEBUG, INFO, WARNING, ERROR)</ td >
</ tr >
</ tbody >
</ table >
< h2 id = "requirements" > Requirements< a class = "headerlink" href = "#requirements" title = "Permanent link" > ¶ </ a ></ h2 >
< ul >
< li > Python 3.11+</ li >
< li > Windows OS (MetaTrader 5 requirement)</ li >
< li > MetaTrader 5 platform</ li >
</ ul >
< h2 id = "api-reference" > API Reference< a class = "headerlink" href = "#api-reference" title = "Permanent link" > ¶ </ a ></ h2 >
< p > Browse the API documentation for detailed module information:</ p >
< ul >
< li >< a href = "api/cli/" > CLI Module</ a > - CLI application with export commands and utility functions</ li >
</ ul >
< h2 id = "development" > Development< a class = "headerlink" href = "#development" title = "Permanent link" > ¶ </ a ></ h2 >
< p > This project follows strict code quality standards:</ p >
< ul >
< li > Type hints required (strict mode)</ li >
< li > Comprehensive linting with Ruff</ li >
< li > Test coverage tracking</ li >
< li > Google-style docstrings</ li >
</ ul >
< h2 id = "license" > License< a class = "headerlink" href = "#license" title = "Permanent link" > ¶ </ a ></ h2 >
< p > MIT License - see < a href = "https://github.com/dceoy/mt5cli/blob/main/LICENSE" > LICENSE</ a > file for details.</ p >
</ article >
</ div >
< script > var target = document . getElementById ( location . hash . slice ( 1 )); target && target . name && ( target . checked = target . name . startsWith ( "__tabbed_" ))</ script >
</ div >
</ main >
< footer class = "md-footer" >
< div class = "md-footer-meta md-typeset" >
< div class = "md-footer-meta__inner md-grid" >
< div class = "md-copyright" >
Made with
< a href = "https://squidfunk.github.io/mkdocs-material/" target = "_blank" rel = "noopener" >
Material for MkDocs
</ a >
</ div >
</ div >
</ div >
</ footer >
</ div >
< div class = "md-dialog" data-md-component = "dialog" >
< div class = "md-dialog__inner md-typeset" ></ div >
</ div >
< script id = "__config" type = "application/json" >{ "annotate" : null , "base" : "." , "features" : [], "search" : "assets/javascripts/workers/search.2c215733.min.js" , "tags" : null , "translations" : { "clipboard.copied" : "Copied to clipboard" , "clipboard.copy" : "Copy to clipboard" , "search.result.more.one" : "1 more on this page" , "search.result.more.other" : "# more on this page" , "search.result.none" : "No matching documents" , "search.result.one" : "1 matching document" , "search.result.other" : "# matching documents" , "search.result.placeholder" : "Type to start searching" , "search.result.term.missing" : "Missing" , "select.version" : "Select version" }, "version" : null }</ script >
< script src = "assets/javascripts/bundle.79ae519e.min.js" ></ script >
</ body >
</ html >