Add data export tools for OHLC and tick data
**New Tools:** - export_ohlc: Export OHLC bar data from MT5 history to CSV/JSON - export_ticks: Export tick data from MT5 tick database to CSV/JSON - list_available_data: List available OHLC and tick data in MT5 **Implementation:** - definitions/data.rs: Tool schemas for data export - handlers/data.rs: Handlers that scan MT5 directories: - history/*.hst files (OHLC) - Tester/cache/* (cached data) - Bases/* (tick data) - Provides guidance on how to export since MT5 uses proprietary binary formats - Includes MQL5 script template for programmatic export **Note:** MT5 uses proprietary .hst and .ticks binary formats. Direct export requires MQL5 script using CopyRates()/CopyTicks().
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
use serde_json::{json, Value};
|
||||
|
||||
pub fn tool_export_ohlc() -> Value {
|
||||
json!({
|
||||
"name": "export_ohlc",
|
||||
"description": "Export OHLC bar data from MetaTrader history to CSV/JSON",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"required": ["symbol", "timeframe"],
|
||||
"properties": {
|
||||
"symbol": { "type": "string", "description": "Trading symbol (e.g., XAUUSDc, EURUSD)" },
|
||||
"timeframe": { "type": "string", "enum": ["M1", "M5", "M15", "M30", "H1", "H4", "D1", "W1", "MN1"], "description": "Bar timeframe" },
|
||||
"from_date": { "type": "string", "description": "Start date YYYY.MM.DD (default: earliest available)" },
|
||||
"to_date": { "type": "string", "description": "End date YYYY.MM.DD (default: latest available)" },
|
||||
"format": { "type": "string", "enum": ["csv", "json"], "default": "csv", "description": "Output format" },
|
||||
"output_path": { "type": "string", "description": "Output file path (default: auto-generated in /tmp)" },
|
||||
"max_bars": { "type": "integer", "description": "Maximum bars to export (default: 100000)" }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn tool_export_ticks() -> Value {
|
||||
json!({
|
||||
"name": "export_ticks",
|
||||
"description": "Export tick data from MetaTrader tick database to CSV/JSON",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"required": ["symbol"],
|
||||
"properties": {
|
||||
"symbol": { "type": "string", "description": "Trading symbol (e.g., XAUUSDc, EURUSD)" },
|
||||
"from_date": { "type": "string", "description": "Start date YYYY.MM.DD (default: today)" },
|
||||
"to_date": { "type": "string", "description": "End date YYYY.MM.DD (default: today)" },
|
||||
"format": { "type": "string", "enum": ["csv", "json"], "default": "csv", "description": "Output format" },
|
||||
"output_path": { "type": "string", "description": "Output file path (default: auto-generated in /tmp)" },
|
||||
"max_ticks": { "type": "integer", "description": "Maximum ticks to export (default: 1000000)" },
|
||||
"include_volume": { "type": "boolean", "default": true, "description": "Include tick volume" }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn tool_list_available_data() -> Value {
|
||||
json!({
|
||||
"name": "list_available_data",
|
||||
"description": "List available OHLC and tick data in MetaTrader history/cache",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"symbol": { "type": "string", "description": "Filter by symbol (optional)" },
|
||||
"data_type": { "type": "string", "enum": ["ohlc", "ticks", "both"], "default": "both", "description": "Type of data to list" }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -3,6 +3,7 @@ use serde_json::Value;
|
||||
pub mod analytics;
|
||||
pub mod backtest;
|
||||
pub mod baseline;
|
||||
pub mod data;
|
||||
pub mod experts;
|
||||
pub mod optimization;
|
||||
pub mod reports;
|
||||
@@ -51,6 +52,10 @@ pub fn get_tools_list() -> Value {
|
||||
setfiles::tool_describe_sweep(),
|
||||
setfiles::tool_list_set_files(),
|
||||
setfiles::tool_set_from_optimization(),
|
||||
// Data Export (3 tools)
|
||||
data::tool_export_ohlc(),
|
||||
data::tool_export_ticks(),
|
||||
data::tool_list_available_data(),
|
||||
// Reports (11 tools)
|
||||
reports::tool_list_reports(),
|
||||
reports::tool_search_reports(),
|
||||
|
||||
Reference in New Issue
Block a user