Trading Models API
Trading Models API
This endpoint returns the currently dominant trading models for a symbol.
A trading model combines:
- an entry logic component
- a position manager
- a regime filter
Use this endpoint when you want to rank, inspect, or integrate the strongest currently available model configurations for a symbol.
Endpoint
GET https://api.darwintiq.com/v1/models
Query Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
symbol | Yes | string | Market symbol, for example EURUSD, USDJPY, XAUUSD, SP500, or DAX. |
sort | No | string | Sort order: fitness (default), latest, or entryMove. |
limit | No | integer | Number of trading models to return. Default is 5, maximum is 50. |
entryType | No | string | Restricts results to a specific entry logic type. |
entryTypes | No | string | Compatibility alias for entryType. |
How to Use It
A typical client flow is:
- Request the endpoint with a symbol.
- Sort the results according to your use case.
- Read the top-ranked item or iterate over the returned list.
- Use the nested model blocks and performance fields in your UI, automation, or analytics pipeline.
Example Request
curl -H "Authorization: Bearer [YOUR_TOKEN]" \
"https://api.darwintiq.com/v1/models?symbol=EURUSD&sort=fitness"
Response Example
{
"status": "success",
"symbol": "EURUSD",
"trading_models": [
{
"id": "abc123",
"timeframe": "H1",
"created": "2026-02-10 09:20:00",
"tested": "2026-02-10 13:20:00",
"fitness": 74.6,
"stabilityScore": 72,
"entryMovePips": -6.4,
"entryPrice": 1.08742,
"currentPrice": 1.08678,
"entryLogic": {
"type": "pullback_continuation",
"class": "PullbackContinuation",
"description": "Trend continuation after a controlled pullback.",
"params": {}
},
"positionManager": {
"type": "absolute",
"class": "Absolute",
"description": "Fixed stop and trailing stop.",
"params": {},
"initialStopPips": 20,
"trailingStopPips": 10,
"takeProfitPips": 40
},
"regimeFilter": {
"type": "rsi_band",
"class": "RsiBand",
"description": "Mean-reversion gate using RSI threshold bands.",
"params": {}
},
"lastEntry": {
"type": "BUY",
"time": "2026-02-10 10:00:00",
"timeElapsed": "20 minutes ago"
},
"totalPips": 132,
"pipsPerTrade": 3.1,
"tradesWon": 14,
"tradesLost": 7,
"pipsWon": 196,
"pipsLost": 64,
"maxDrawdown": 12.4,
"expectedValue": 0.62,
"profitFactor": 1.74,
"sharpe": 0.38,
"sortino": 0.56,
"calmar": 1.92,
"avgDrawdown": 4.7,
"exposure": 0.41,
"returnStability": 0.78,
"testPeriod": { "from": "2026-02-10 09:20:00", "to": "2026-02-10 13:20:00" },
"analytics": {
"stability": {
"score": 72,
"returnStability": 0.78,
"walkForward": {
"enabled": true,
"sufficient_data": true,
"fold_count": 3,
"coverage": 1,
"consistency": 0.91,
"train_score": 0.74,
"test_score": 0.7,
"multiplier": 0.97,
"reason": "ok",
"folds": [
{ "index": 0, "effective_trades": 8, "score": 0.76, "profit_pips": 18.4 },
{ "index": 1, "effective_trades": 7, "score": 0.72, "profit_pips": 15.1 },
{ "index": 2, "effective_trades": 6, "score": 0.7, "profit_pips": 13.3 }
]
}
}
}
}
],
"timeSemantics": {
"version": 1,
"fieldBases": {
"trading_models[].lastEntry.time": "BROKER_NY_CLOSE",
"trading_models[].lastEntry.timeElapsed": "RELATIVE",
"trading_models[].testPeriod.from": "BROKER_NY_CLOSE",
"trading_models[].testPeriod.to": "BROKER_NY_CLOSE",
"trading_models[].created": "RELATIVE",
"trading_models[].tested": "RELATIVE"
}
}
}
Response Field Reference
| Field | Type | Description |
|---|---|---|
status | string | success when the request succeeds. |
symbol | string | Requested symbol (e.g., EURUSD). |
trading_models | array | List of trading model objects. |
trading_models[].id | string | Stable model identifier. |
trading_models[].timeframe | string | Model timeframe. |
trading_models[].created | string | Humanized relative creation time label (for example 2h ago). |
trading_models[].tested | string | Humanized relative backtest time label (for example 15m ago). |
trading_models[].fitness | number | Fitness score (higher = better). |
trading_models[].stabilityScore | number | null | Drift-based stability score (0-100). |
trading_models[].entryMovePips | number | null | Signed pip move since last entry. |
trading_models[].entryPrice | number | null | Entry price of last signal. |
trading_models[].currentPrice | number | null | Current price used for move calculation. |
trading_models[].entryLogic | object | Structured entry logic block. |
trading_models[].positionManager | object | Structured position manager block. |
trading_models[].regimeFilter | object | Structured regime filter block. Returned models use explicit filter logic rather than an always-on no-op filter. |
trading_models[].lastEntry | object | Last entry time and direction. |
trading_models[].lastEntry.time | string | Last entry timestamp in broker chart time (BROKER_NY_CLOSE). |
trading_models[].lastEntry.timeElapsed | string | Humanized relative time label (RELATIVE). |
trading_models[].totalPips | number | Total net pips in test window. |
trading_models[].pipsPerTrade | number | Average pips per trade. |
trading_models[].tradesWon | number | Number of winning trades. |
trading_models[].tradesLost | number | Number of losing trades. |
trading_models[].pipsWon | number | Total pips from wins. |
trading_models[].pipsLost | number | Total pips from losses. |
trading_models[].maxDrawdown | number | Max drawdown (pips). |
trading_models[].expectedValue | number | Expected value (pips). |
trading_models[].profitFactor | number | null | Gross wins divided by gross losses. |
trading_models[].sharpe | number | null | Return/volatility ratio (trade-return based). |
trading_models[].sortino | number | null | Return/downside-volatility ratio. |
trading_models[].calmar | number | null | Net return divided by max equity drawdown. |
trading_models[].avgDrawdown | number | Average drawdown (pips). |
trading_models[].exposure | number | Time in market ratio (0..1). |
trading_models[].returnStability | number | null | Smoothness of equity trend (R^2, 0..1). |
trading_models[].testPeriod | object | Backtest window (from/to). |
trading_models[].testPeriod.from | string | Backtest window start in broker chart time (BROKER_NY_CLOSE). |
trading_models[].testPeriod.to | string | Backtest window end in broker chart time (BROKER_NY_CLOSE). |
trading_models[].analytics | object | Personality + stability analytics. |
trading_models[].analytics.stability | object | null | Stability metrics (stdDev, drift, MI). |
trading_models[].analytics.stability.score | number | null | Stability score (0-100), derived from drift metrics. |
trading_models[].analytics.stability.stdDev | number | null | Standard deviation of trade outcomes (pips). |
trading_models[].analytics.stability.drift | object | null | Drift metrics across features. |
trading_models[].analytics.stability.drift.profit_pips | object | null | Drift on profit per trade. |
trading_models[].analytics.stability.drift.rr | object | null | Drift on reward-to-risk distribution. |
trading_models[].analytics.stability.drift.holding_time | object | null | Drift on holding time distribution. |
trading_models[].analytics.stability.drift.stop_loss_pips | object | null | Drift on stop-loss sizing. |
trading_models[].analytics.stability.drift.*.js | number | null | Jensen-Shannon divergence. |
trading_models[].analytics.stability.drift.*.wasserstein | number | null | Wasserstein distance. |
trading_models[].analytics.stability.drift.*.ks | number | null | KS statistic. |
trading_models[].analytics.stability.drift.*.psi | number | null | Population Stability Index. |
trading_models[].analytics.stability.mi | object | null | Mutual information metrics. |
trading_models[].analytics.stability.mi.winloss_profit_pips | number | null | MI between win/loss and profit distribution. |
trading_models[].analytics.stability.mi.winloss_holding_time | number | null | MI between win/loss and holding time. |
trading_models[].analytics.stability.mi.winloss_rr | number | null | MI between win/loss and reward-to-risk. |
trading_models[].analytics.stability.mi.winloss_stop_loss_pips | number | null | MI between win/loss and stop-loss sizing. |
trading_models[].analytics.stability.driftWindow | object | null | Drift window meta. |
trading_models[].analytics.stability.driftWindow.split | string | null | Split strategy (for example first_half_vs_second_half). |
trading_models[].analytics.stability.driftWindow.start | string | null | Backtest start time. |
trading_models[].analytics.stability.driftWindow.mid | string | null | Midpoint time used for split. |
trading_models[].analytics.stability.driftWindow.end | string | null | Backtest end time. |
trading_models[].analytics.stability.driftWindow.min_trades_per_half | number | null | Minimum trades per half for drift calculation. |
trading_models[].analytics.stability.driftWindow.insufficient_trades | boolean | null | True if drift could not be computed. |
trading_models[].analytics.stability.driftWindow.pre_trades | number | null | Trades in first half. |
trading_models[].analytics.stability.driftWindow.post_trades | number | null | Trades in second half. |
trading_models[].analytics.stability.walkForward | object | null | Walk-forward validation payload for out-of-sample fold consistency. |
trading_models[].analytics.stability.walkForward.fold_count | number | Number of configured folds in the current walk-forward run. |
trading_models[].analytics.stability.walkForward.coverage | number | null | Share of folds that produced usable scores (0..1). |
trading_models[].analytics.stability.walkForward.consistency | number | null | Similarity of fold scores (0..1), higher is steadier. |
trading_models[].analytics.stability.walkForward.train_score | number | null | Average score of the earlier reference folds. |
trading_models[].analytics.stability.walkForward.test_score | number | null | Score of the latest evaluated fold. |
trading_models[].analytics.stability.walkForward.multiplier | number | null | Fitness multiplier derived from walk-forward validation. |
trading_models[].analytics.stability.walkForward.reason | string | null | Status/reason such as ok or insufficient_trades. |
trading_models[].analytics.stability.walkForward.folds | array | Per-fold diagnostics. |
trading_models[].analytics.stability.walkForward.folds[].index | number | Zero-based fold index. |
trading_models[].analytics.stability.walkForward.folds[].effective_trades | number | null | Number of winning + losing trades in that fold. |
trading_models[].analytics.stability.walkForward.folds[].profit_pips | number | null | Net pips generated inside that fold. |
trading_models[].analytics.stability.walkForward.folds[].score | number | null | Fold quality score used for train/latest comparison. |
timeSemantics | object | null | Optional timestamp semantics metadata for interpreting timestamp fields. |
timeSemantics.version | number | Metadata version (currently 1). |
timeSemantics.fieldBases | object | Map of field paths to time basis identifiers. |
timeSemantics.notes | array | null | Optional human-readable notes about timestamp semantics. |
Core Ranking Fields
fitness: overall ranking score for recent performance and consistency.stabilityScore: drift-based stability estimate. Higher values indicate more stable behavior.entryMovePips: signed pip move since the last entry, measured at request time.entryPriceandcurrentPrice: raw price context used for the move calculation.- Friendly symbol aliases are normalized before the upstream request, for example
DAX -> GDAXIandSPX500 -> SP500.
Timestamp Semantics
BROKER_NY_CLOSEmeans Darwinex/MT4 chart time aligned to New York close, typicallyUTC+2in winter andUTC+3in summer.RELATIVEmeans a display label such as5 minutes ago, not an absolute timestamp.- If
timeSemanticsis present, prefer it over hard-coded assumptions in client code.
Stability Metrics
stdDev: dispersion of trade outcomes in the backtest window.- Drift metrics (
js,wasserstein,ks,psi): distribution shift between the first and second half of the test window. - Mutual information (
mi): how informative certain distributions are about win/loss outcomes. profitFactor,sharpe,sortino,calmar: risk-adjusted performance metrics.avgDrawdown,exposure,returnStability: drawdown pressure, time-in-market, and equity smoothness context.analytics.stability.walkForward: recent out-of-sample validation. Comparetrain_scorevs.test_scoreand inspectmultiplierfor fitness drag or confirmation.
Errors
| Status | Meaning |
|---|---|
400 | Invalid symbol or query parameter. |
401 | Missing or invalid bearer token. |
403 | Valid token, but no access to the requested symbol or subscription scope. |
429 | Rate limit exceeded. |
500 | Internal or upstream server error. |
Repository
Public example code is available here:
https://github.com/darwintIQ/API