Train and Backtest Strategy Code
train_strategyTrain and backtest strategy code on QuantifyMe's prices; returns a job_id at once.
The code is a QuantifyMe strategy file (feature_engineering and strategy_config), from generate_strategy (model "rule-based" gives fixed rules with no ML) or your own. Stop loss and take profit each go with their unit: risk_unit "pips", "usd" (USD a trade) or "pct" (percent of the entry price); a stop_loss or take_profit without risk_unit is refused. Position size is lot_size lots (1 lot = 100,000 units forex, 1 oz gold or silver, 1 bitcoin), so a pip is worth about USD 10 a lot on EURUSD. Each cost left out (commission, swap_long, swap_short, spread_pips) is the market's own (commission USD 6.00 a lot a round trip on forex). The backtest window defaults to the last 40 days (1min at most 30 days, 5min 90). The free plan keeps 2 saved models: delete_model frees a slot.
Billed from the account's credits after the run (about 8.4 credits a second of compute); refused before it starts when the balance is under the estimate. Then call get_training_result(job_id).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "train_strategy"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The strategy file: Python with feature_engineering and strategy_config, at most 64,000 characters (generate_strategy's `code`). | |
| symbol | No | Market. Default EURUSD. | |
| capital | No | Starting balance in USD, above 0. Default 10,000. | |
| end_date | No | YYYY-MM-DD (UTC). | |
| lot_size | No | Lots a trade, above 0, at most 100. Default 1.0 (100,000 units forex, 1 oz gold or silver, 1 bitcoin). | |
| direction | No | The trades the run may take: long_only, short_only or both. Default the strategy's own. | |
| risk_unit | No | The unit of stop_loss and take_profit: pips, usd (USD a trade) or pct (percent of the entry price). Required with either. | |
| stop_loss | No | Stop loss distance in risk_unit, above 0 (pips at most 10,000; usd at most 1,000,000; pct at most 10). | |
| swap_long | No | USD a lot a night held long, -1,000 to 1,000. Default the market's own. | |
| timeframe | No | Bar size. Default 15min. | |
| commission | No | USD a lot a round trip, 0 to 1,000. Default the market's own. | |
| model_name | No | Optional name: a letter, then letters, digits, _ or -, at most 40. Default the next Model_N. | |
| start_date | No | YYYY-MM-DD (UTC). | |
| swap_short | No | USD a lot a night held short, -1,000 to 1,000. Default the market's own. | |
| spread_pips | No | The spread a trade pays, in pips, 0 to 1,000. Default the market's own. | |
| take_profit | No | Take profit distance in risk_unit, above 0 (same limits as stop_loss). | |
| train_split | No | Share of the window used to train, 0.5 to 0.95; the rest is the out-of-sample test. Default 0.7. | |
| validation_date | No | YYYY-MM-DD (UTC). | |
| confidence_threshold | No | Classification models only: the score (0 to 100) a signal needs. Default the code's own. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||