For flexible, fast, low cost queries
Data done for you
This is a method whereby you provide the api with any price data you wish for rapid turnaround and much lower credits used.
This endpoint is designed to provide you with key backtest metrics.
Hint: If you call the endpoint a ‘with_history’ marked as true, then you will receive spread statistics in addition to cointegration calculations and historical returns too.
This is a very useful endpoint, if you are planning on getting as much information for a pair as possible in one shot.
Gotcha: Different exchanges determine different annual trading days in sharpe calculation. If you know the exchange your data comes from and it matches the exchange list, it is best practice to provide it.
curl -X GET "https://api.cryptowizards.net/v1beta/backtest\
?symbol_1=BTCUSDT\
&symbol_2=ETHUSDT\
&exchange=BinanceUs\
&interval=Daily\
&period=365\
&strategy=ZScoreRoll\
&spread_type=Static\
&roll_w=42\
&with_history=false\
&entry_level=1.5\
&exit_level=0.0\
&x_weighting=0.5\
&slippage_rate=0.0005\
&commission_rate=0.0005\
&stop_loss_rate=0.10"\
-H "Content-Type: application/json" \
-H "X-api-key: REPLACE_WITH_YOUR_API_KEY"
{
"data": {
"strat_returns": {
"annual_return": 0.38046404302965087,
"mean_period_return": 0.0009031393647029252,
"total_return": 0.045156968235146255
},
"max_drawdown": -0.020151803905214108,
"sharpe_ratio": 3.3335841328367573,
"sortino_ratio": 7.180593408757123,
"cvar": -0.010565051725682562,
"var": -0.010565051725682562,
"win_rate": 1.0
},
"history": null
}
{
"data": {
"strat_returns": {
"annual_return": 0.3816672731266737,
"mean_period_return": 0.0009056342406730877,
"total_return": 0.04528171203365439
},
"max_drawdown": -0.02003485497825187,
"sharpe_ratio": 3.346531891840665,
"sortino_ratio": 7.2383483785931775,
"cvar": -0.010565051725682562,
"var": -0.010565051725682562,
"win_rate": 1.0
},
"history": {
"coint_eg": {
"p_value": 0.29710578989962677,
"t_stat": -2.56322368880048,
"cv": -3.5022753919999996,
"is_coint": false,
"inc_trend": true
},
"spread_stats": {
"spread": [
-0.1996769652098902,
-0.1905905187801219,
...
],
"zscore": [
0.7823911425969057,
-1.913415314926282,
...
],
"zscore_roll": [
0.0,
...,
-0.8353926481570673
],
"hedge_ratio": 0.6296069572572536,
"half_life": 6.17975243617321,
"hurst": 0.7726252452662,
"sigma0crossings": 7,
"sigma2crossings": 2,
"log_used": false,
"last_zscore": {
"zscore": -1.0062431839275412,
"zscore_roll": -0.8353926481570673
}
},
"bt_returns": [
1.0537806068438267,
1.0452817120336544,
...
]
}
}