mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2026-01-31 02:54:21 +01:00
(feat) remove quants lab
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,614 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"root_path = os.path.abspath(os.path.join(os.getcwd(), '../../..'))\n",
|
||||
"sys.path.append(root_path)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-05-21T23:41:37.862880Z",
|
||||
"start_time": "2024-05-21T23:41:37.861203Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from quants_lab.controllers.market_making.dman_maker_v2 import DManMakerV2Config\n",
|
||||
"from hummingbot.strategy_v2.backtesting import MarketMakingBacktesting\n",
|
||||
"import traceback\n",
|
||||
"from decimal import Decimal\n",
|
||||
"import pandas_ta as ta # noqa: F401\n",
|
||||
"import pandas as pd\n",
|
||||
"from optuna import TrialPruned\n",
|
||||
"\n",
|
||||
"backtesting_engine = MarketMakingBacktesting()\n",
|
||||
"\n",
|
||||
"async def objective(trial, start, end, backtesting_resolution):\n",
|
||||
" try:\n",
|
||||
" # Market configuration\n",
|
||||
" connector_name = \"binance_perpetual\"\n",
|
||||
" trading_pair = \"WLD-USDT\"\n",
|
||||
"\n",
|
||||
" # Account configuration\n",
|
||||
" total_amount_quote = 1000\n",
|
||||
" trade_cost = 0.0006\n",
|
||||
" buy_spreads = [Decimal(\"0.002\")]\n",
|
||||
" sell_spreads = [Decimal(\"0.002\")]\n",
|
||||
" buy_amounts_pct = [Decimal(\"1\")]\n",
|
||||
" sell_amounts_pct = [Decimal(\"1\")]\n",
|
||||
" executor_refresh_time = 60\n",
|
||||
" cooldown_time = 3600\n",
|
||||
" top_executor_refresh_time = 60\n",
|
||||
" executor_activation_bounds = [Decimal(\"0.01\")]\n",
|
||||
" dca_spreads = [Decimal(\"0.\"), Decimal(\"0.002\"), Decimal(\"0.004\"), Decimal(\"0.006\"), Decimal(\"0.008\"), Decimal(\"0.01\")]\n",
|
||||
" dca_amounts = [Decimal(\"0.1\"), Decimal(\"0.2\"), Decimal(\"0.3\"), Decimal(\"0.4\"), Decimal(\"0.5\"), Decimal(\"0.6\")]\n",
|
||||
"\n",
|
||||
" # Triple barrier configuration\n",
|
||||
" stop_loss = trial.suggest_float('stop_loss', 0.01, 0.04, step=0.01)\n",
|
||||
" take_profit = trial.suggest_float('take_profit', 0.01, 0.04, step=0.01)\n",
|
||||
" time_limit = 60 * 60 * 12 # 12 hours\n",
|
||||
" trailing_stop_activation_price_delta = Decimal(\"0.008\")\n",
|
||||
" trailing_stop_trailing_delta = Decimal(\"0.004\")\n",
|
||||
" config_dict = {\n",
|
||||
" \"connector_name\": connector_name,\n",
|
||||
" \"trading_pair\": trading_pair,\n",
|
||||
" \"total_amount_quote\": total_amount_quote,\n",
|
||||
" \"buy_spreads\": buy_spreads,\n",
|
||||
" \"sell_spreads\": sell_spreads,\n",
|
||||
" \"buy_amounts_pct\": buy_amounts_pct,\n",
|
||||
" \"sell_amounts_pct\": sell_amounts_pct,\n",
|
||||
" \"executor_refresh_time\": executor_refresh_time,\n",
|
||||
" \"cooldown_time\": cooldown_time,\n",
|
||||
" \"top_executor_refresh_time\": top_executor_refresh_time,\n",
|
||||
" \"executor_activation_bounds\": executor_activation_bounds,\n",
|
||||
" \"stop_loss\": stop_loss,\n",
|
||||
" \"take_profit\": take_profit,\n",
|
||||
" \"time_limit\": time_limit,\n",
|
||||
" \"trailing_stop\": {\n",
|
||||
" \"activation_price\": trailing_stop_activation_price_delta,\n",
|
||||
" \"trailing_delta\": trailing_stop_trailing_delta\n",
|
||||
" },\n",
|
||||
" \"dca_spreads\": dca_spreads,\n",
|
||||
" \"dca_amounts\": dca_amounts\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" config = DManMakerV2Config(**config_dict)\n",
|
||||
" start_time = pd.to_datetime(start).timestamp() * 1e3\n",
|
||||
" end_time = pd.to_datetime(end).timestamp() * 1e3\n",
|
||||
" backtesting_results = await backtesting_engine.run_backtesting(\n",
|
||||
" controller_config=config, trade_cost=trade_cost,\n",
|
||||
" start=int(start_time), end=int(end_time),\n",
|
||||
" backtesting_resolution=backtesting_resolution)\n",
|
||||
"\n",
|
||||
" strategy_analysis = backtesting_results[\"results\"]\n",
|
||||
"\n",
|
||||
" trial.set_user_attr(\"net_pnl_quote\", strategy_analysis[\"net_pnl_quote\"])\n",
|
||||
" trial.set_user_attr(\"net_pnl_pct\", strategy_analysis[\"net_pnl\"])\n",
|
||||
" trial.set_user_attr(\"max_drawdown_usd\", strategy_analysis[\"max_drawdown_usd\"])\n",
|
||||
" trial.set_user_attr(\"max_drawdown_pct\", strategy_analysis[\"max_drawdown_pct\"])\n",
|
||||
" trial.set_user_attr(\"sharpe_ratio\", strategy_analysis[\"sharpe_ratio\"])\n",
|
||||
" trial.set_user_attr(\"accuracy\", strategy_analysis[\"accuracy\"])\n",
|
||||
" trial.set_user_attr(\"total_positions\", strategy_analysis[\"total_positions\"])\n",
|
||||
" trial.set_user_attr(\"profit_factor\", strategy_analysis[\"profit_factor\"])\n",
|
||||
" trial.set_user_attr(\"win_signals\", strategy_analysis[\"win_signals\"])\n",
|
||||
" trial.set_user_attr(\"loss_signals\", strategy_analysis[\"loss_signals\"])\n",
|
||||
" trial.set_user_attr(\"close_types\", strategy_analysis[\"close_types\"])\n",
|
||||
" trial.set_user_attr(\"config\", config_dict)\n",
|
||||
" return strategy_analysis[\"net_pnl\"]\n",
|
||||
" except Exception as e:\n",
|
||||
" traceback.print_exc()\n",
|
||||
" raise TrialPruned()\n"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-05-22T00:12:09.348323Z",
|
||||
"start_time": "2024-05-22T00:12:09.343772Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[I 2024-05-21 19:14:06,636] A new study created in RDB with name: dman_maker_v2_opt\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import optuna\n",
|
||||
"\n",
|
||||
"# Now let's configure the parameters for the optimization\n",
|
||||
"study_name = \"dman_maker_v2_opt\"\n",
|
||||
"storage= \"sqlite:///../../../data/backtesting/backtesting_report.db\"\n",
|
||||
"\n",
|
||||
"study = optuna.create_study(direction=\"maximize\", study_name=study_name,\n",
|
||||
" storage=storage,\n",
|
||||
" load_if_exists=True) # If the study already exists, we load it)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-05-22T00:14:06.642119Z",
|
||||
"start_time": "2024-05-22T00:14:06.258703Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[W 2024-05-21 19:14:32,364] Trial 0 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,365] Trial 0 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"/Users/dardonacci/anaconda3/envs/dashboard/lib/python3.10/site-packages/optuna/study/_optimize.py:159: RuntimeWarning: coroutine 'objective' was never awaited\n",
|
||||
" frozen_trial = _run_trial(study, func, catch)\n",
|
||||
"RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n",
|
||||
"[W 2024-05-21 19:14:32,380] Trial 1 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,380] Trial 1 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,390] Trial 2 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,391] Trial 2 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,401] Trial 3 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,402] Trial 3 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,412] Trial 4 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,413] Trial 4 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,424] Trial 5 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,424] Trial 5 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,435] Trial 6 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,435] Trial 6 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,448] Trial 7 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,448] Trial 7 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,464] Trial 8 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,464] Trial 8 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,474] Trial 9 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,474] Trial 9 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,485] Trial 10 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,485] Trial 10 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,496] Trial 11 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,496] Trial 11 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,505] Trial 12 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,505] Trial 12 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,515] Trial 13 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,516] Trial 13 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,525] Trial 14 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,526] Trial 14 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,535] Trial 15 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,535] Trial 15 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,551] Trial 16 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,551] Trial 16 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,561] Trial 17 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,562] Trial 17 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,572] Trial 18 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,572] Trial 18 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,582] Trial 19 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,583] Trial 19 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,592] Trial 20 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,593] Trial 20 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,603] Trial 21 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,603] Trial 21 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,613] Trial 22 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,614] Trial 22 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,624] Trial 23 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,624] Trial 23 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,634] Trial 24 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,634] Trial 24 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,644] Trial 25 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,644] Trial 25 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,654] Trial 26 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,654] Trial 26 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,666] Trial 27 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,666] Trial 27 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,676] Trial 28 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,676] Trial 28 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,687] Trial 29 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,687] Trial 29 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,697] Trial 30 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,698] Trial 30 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,709] Trial 31 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,709] Trial 31 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,718] Trial 32 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,719] Trial 32 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,728] Trial 33 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,728] Trial 33 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,738] Trial 34 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,739] Trial 34 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,749] Trial 35 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,750] Trial 35 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,761] Trial 36 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,762] Trial 36 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,772] Trial 37 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,772] Trial 37 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,782] Trial 38 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,782] Trial 38 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,791] Trial 39 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,792] Trial 39 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,803] Trial 40 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,803] Trial 40 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,813] Trial 41 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,814] Trial 41 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,823] Trial 42 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,824] Trial 42 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,835] Trial 43 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,836] Trial 43 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,846] Trial 44 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,846] Trial 44 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,857] Trial 45 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,857] Trial 45 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,868] Trial 46 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,869] Trial 46 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,878] Trial 47 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,878] Trial 47 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,889] Trial 48 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,889] Trial 48 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,899] Trial 49 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,900] Trial 49 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,911] Trial 50 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,911] Trial 50 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,920] Trial 51 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,920] Trial 51 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,929] Trial 52 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,930] Trial 52 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,940] Trial 53 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,941] Trial 53 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,950] Trial 54 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,950] Trial 54 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,959] Trial 55 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,960] Trial 55 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,970] Trial 56 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,971] Trial 56 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,980] Trial 57 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,981] Trial 57 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,990] Trial 58 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:32,990] Trial 58 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:32,999] Trial 59 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,000] Trial 59 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,010] Trial 60 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,010] Trial 60 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,019] Trial 61 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,020] Trial 61 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,030] Trial 62 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,030] Trial 62 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,040] Trial 63 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,040] Trial 63 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,050] Trial 64 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,051] Trial 64 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,061] Trial 65 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,061] Trial 65 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,071] Trial 66 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,071] Trial 66 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,080] Trial 67 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,081] Trial 67 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,091] Trial 68 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,092] Trial 68 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,102] Trial 69 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,102] Trial 69 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,111] Trial 70 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,112] Trial 70 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,123] Trial 71 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,124] Trial 71 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,133] Trial 72 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,134] Trial 72 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,144] Trial 73 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,145] Trial 73 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,154] Trial 74 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,154] Trial 74 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,164] Trial 75 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,165] Trial 75 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,175] Trial 76 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,175] Trial 76 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,186] Trial 77 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,186] Trial 77 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,196] Trial 78 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,196] Trial 78 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,206] Trial 79 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,207] Trial 79 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,217] Trial 80 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,218] Trial 80 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,227] Trial 81 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,228] Trial 81 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,239] Trial 82 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,239] Trial 82 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,255] Trial 83 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,255] Trial 83 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,267] Trial 84 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,267] Trial 84 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,278] Trial 85 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,278] Trial 85 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,289] Trial 86 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,289] Trial 86 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,300] Trial 87 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,300] Trial 87 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,310] Trial 88 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,311] Trial 88 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,321] Trial 89 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,322] Trial 89 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,333] Trial 90 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,334] Trial 90 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,345] Trial 91 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,345] Trial 91 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,356] Trial 92 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,357] Trial 92 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,367] Trial 93 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,367] Trial 93 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,376] Trial 94 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,377] Trial 94 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,389] Trial 95 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,389] Trial 95 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,401] Trial 96 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,401] Trial 96 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,413] Trial 97 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,413] Trial 97 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,426] Trial 98 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,427] Trial 98 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,438] Trial 99 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,438] Trial 99 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,449] Trial 100 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,450] Trial 100 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,461] Trial 101 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,461] Trial 101 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,472] Trial 102 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,472] Trial 102 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,483] Trial 103 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,484] Trial 103 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,495] Trial 104 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,495] Trial 104 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,506] Trial 105 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,506] Trial 105 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,517] Trial 106 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,517] Trial 106 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,529] Trial 107 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,530] Trial 107 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,540] Trial 108 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,540] Trial 108 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,550] Trial 109 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,550] Trial 109 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,562] Trial 110 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,563] Trial 110 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,574] Trial 111 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,574] Trial 111 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,590] Trial 112 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,591] Trial 112 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,602] Trial 113 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,602] Trial 113 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,613] Trial 114 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,614] Trial 114 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,624] Trial 115 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,624] Trial 115 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,635] Trial 116 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,635] Trial 116 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,646] Trial 117 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,646] Trial 117 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,657] Trial 118 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,658] Trial 118 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,668] Trial 119 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,669] Trial 119 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,680] Trial 120 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,681] Trial 120 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,690] Trial 121 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,691] Trial 121 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,702] Trial 122 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,702] Trial 122 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,713] Trial 123 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,713] Trial 123 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,726] Trial 124 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,726] Trial 124 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,737] Trial 125 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,737] Trial 125 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,749] Trial 126 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,749] Trial 126 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,761] Trial 127 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,762] Trial 127 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,774] Trial 128 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,774] Trial 128 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,786] Trial 129 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,787] Trial 129 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,797] Trial 130 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,797] Trial 130 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,808] Trial 131 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,808] Trial 131 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,819] Trial 132 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,819] Trial 132 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,830] Trial 133 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,831] Trial 133 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,842] Trial 134 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,843] Trial 134 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,852] Trial 135 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,853] Trial 135 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,862] Trial 136 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,863] Trial 136 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,873] Trial 137 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,873] Trial 137 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,883] Trial 138 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,883] Trial 138 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,893] Trial 139 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,893] Trial 139 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,904] Trial 140 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,904] Trial 140 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,917] Trial 141 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,917] Trial 141 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,927] Trial 142 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,927] Trial 142 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,938] Trial 143 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,938] Trial 143 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,948] Trial 144 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,948] Trial 144 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,958] Trial 145 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,958] Trial 145 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,968] Trial 146 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,969] Trial 146 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,979] Trial 147 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,979] Trial 147 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,988] Trial 148 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,988] Trial 148 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:33,999] Trial 149 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:33,999] Trial 149 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,011] Trial 150 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,012] Trial 150 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,025] Trial 151 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,026] Trial 151 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,035] Trial 152 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,035] Trial 152 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,045] Trial 153 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,046] Trial 153 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,055] Trial 154 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,056] Trial 154 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,064] Trial 155 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,065] Trial 155 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,074] Trial 156 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,074] Trial 156 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,085] Trial 157 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,085] Trial 157 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,094] Trial 158 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,094] Trial 158 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,104] Trial 159 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,104] Trial 159 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,115] Trial 160 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,115] Trial 160 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,124] Trial 161 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,124] Trial 161 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,134] Trial 162 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,135] Trial 162 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,145] Trial 163 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,145] Trial 163 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,154] Trial 164 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,155] Trial 164 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,165] Trial 165 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,165] Trial 165 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,175] Trial 166 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,176] Trial 166 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,185] Trial 167 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,185] Trial 167 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,196] Trial 168 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,197] Trial 168 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,206] Trial 169 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,207] Trial 169 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,215] Trial 170 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,216] Trial 170 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,225] Trial 171 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,226] Trial 171 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,235] Trial 172 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,236] Trial 172 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,247] Trial 173 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,247] Trial 173 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,258] Trial 174 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,258] Trial 174 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,268] Trial 175 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,268] Trial 175 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,278] Trial 176 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,278] Trial 176 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,288] Trial 177 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,289] Trial 177 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,299] Trial 178 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,299] Trial 178 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,310] Trial 179 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,310] Trial 179 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,319] Trial 180 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,320] Trial 180 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,329] Trial 181 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,330] Trial 181 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,339] Trial 182 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,340] Trial 182 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,349] Trial 183 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,349] Trial 183 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,358] Trial 184 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,359] Trial 184 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,369] Trial 185 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,369] Trial 185 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,378] Trial 186 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,379] Trial 186 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,388] Trial 187 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,389] Trial 187 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,408] Trial 188 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,409] Trial 188 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,421] Trial 189 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,421] Trial 189 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,432] Trial 190 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,433] Trial 190 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,442] Trial 191 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,442] Trial 191 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,452] Trial 192 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,452] Trial 192 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,462] Trial 193 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,463] Trial 193 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,473] Trial 194 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,474] Trial 194 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,484] Trial 195 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,485] Trial 195 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,494] Trial 196 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,495] Trial 196 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,505] Trial 197 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,505] Trial 197 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,515] Trial 198 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,515] Trial 198 failed with value <coroutine object objective at 0x17fad5b60>.\n",
|
||||
"[W 2024-05-21 19:14:34,524] Trial 199 failed with parameters: {} because of the following error: The value <coroutine object objective at 0x17fad5b60> could not be cast to float.\n",
|
||||
"[W 2024-05-21 19:14:34,525] Trial 199 failed with value <coroutine object objective at 0x17fad5b60>.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Not let's run the optimization!\n",
|
||||
"start = \"2024-05-01\"\n",
|
||||
"end = \"2024-05-20\"\n",
|
||||
"backtesting_resolution = \"1m\"\n",
|
||||
"n_trials = 200\n",
|
||||
"study.optimize(lambda trial: objective(trial, start, end, backtesting_resolution), n_trials=n_trials)\n"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-05-22T00:14:34.527783Z",
|
||||
"start_time": "2024-05-22T00:14:32.359422Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,591 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"root_path = os.path.abspath(os.path.join(os.getcwd(), '../../..'))\n",
|
||||
"sys.path.append(root_path)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from decimal import Decimal\n",
|
||||
"\n",
|
||||
"# Market configuration\n",
|
||||
"exchange = \"binance_perpetual\"\n",
|
||||
"trading_pair = \"WLD-USDT\"\n",
|
||||
"interval = \"3m\"\n",
|
||||
"\n",
|
||||
"# Account configuration\n",
|
||||
"initial_portfolio_usd = 1000\n",
|
||||
"order_amount = Decimal(\"25\")\n",
|
||||
"n_levels = 1\n",
|
||||
"leverage = 20\n",
|
||||
"trade_cost = 0.0006\n",
|
||||
"\n",
|
||||
"# Backtest period\n",
|
||||
"start = \"2023-01-01\"\n",
|
||||
"end = \"2024-01-02\"\n",
|
||||
"\n",
|
||||
"# Triple barrier configuration\n",
|
||||
"stop_loss = Decimal(\"0.015\")\n",
|
||||
"take_profit = Decimal(\"0.03\")\n",
|
||||
"time_limit = 60 * 60 * 12 # 12 hours\n",
|
||||
"trailing_stop_activation_price_delta = Decimal(\"0.008\")\n",
|
||||
"trailing_stop_trailing_delta = Decimal(\"0.004\")"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from hummingbot.smart_components.utils.order_level_builder import OrderLevelBuilder\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.data_types import (\n",
|
||||
" TripleBarrierConf\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Building the order levels\n",
|
||||
"order_level_builder = OrderLevelBuilder(n_levels=n_levels)\n",
|
||||
"order_levels = order_level_builder.build_order_levels(\n",
|
||||
" amounts=order_amount,\n",
|
||||
" spreads=Decimal(\"0\"),\n",
|
||||
" # for directional strategies we don't need spreads since we are going to use market orders to enter\n",
|
||||
" triple_barrier_confs=TripleBarrierConf(\n",
|
||||
" stop_loss=stop_loss, take_profit=take_profit, time_limit=time_limit,\n",
|
||||
" trailing_stop_activation_price_delta=trailing_stop_activation_price_delta,\n",
|
||||
" trailing_stop_trailing_delta=trailing_stop_trailing_delta),\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's inpect the order levels\n",
|
||||
"order_levels"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"from hummingbot.data_feed.candles_feed.candles_factory import CandlesConfig\n",
|
||||
"from quants_lab.controllers.supertrend import SuperTrend, SuperTrendConfig\n",
|
||||
"\n",
|
||||
"# Controller configuration\n",
|
||||
"length = 100\n",
|
||||
"multiplier = 3.0\n",
|
||||
"percentage_threshold = 0.01\n",
|
||||
"\n",
|
||||
"# Creating the instance of the configuration and the controller\n",
|
||||
"config = SuperTrendConfig(\n",
|
||||
" exchange=exchange,\n",
|
||||
" trading_pair=trading_pair,\n",
|
||||
" order_levels=order_levels,\n",
|
||||
" candles_config=[\n",
|
||||
" CandlesConfig(connector=exchange, trading_pair=trading_pair, interval=interval, max_records=sys.maxsize),\n",
|
||||
" ],\n",
|
||||
" leverage=leverage,\n",
|
||||
" length=length,\n",
|
||||
" multiplier=multiplier,\n",
|
||||
" percentage_threshold=percentage_threshold,\n",
|
||||
")\n",
|
||||
"controller = SuperTrend(config=config)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from quants_lab.strategy.strategy_analysis import StrategyAnalysis\n",
|
||||
"\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.directional_trading.directional_trading_backtesting_engine import \\\n",
|
||||
" DirectionalTradingBacktestingEngine\n",
|
||||
"\n",
|
||||
"# Creating the backtesting engine and loading the historical data\n",
|
||||
"engine = DirectionalTradingBacktestingEngine(controller=controller)\n",
|
||||
"engine.load_controller_data(\"../../../data/candles\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's see what is inside the candles of the controller\n",
|
||||
"engine.controller.candles"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"engine.controller.candles[0].candles_df"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's understand what is inside the processed data since this is what we are going to use when generating the signal ;)\n",
|
||||
"engine.controller.get_processed_data()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's run the backtesting\n",
|
||||
"\n",
|
||||
"backtesting_results = engine.run_backtesting(initial_portfolio_usd=initial_portfolio_usd,\n",
|
||||
" trade_cost=trade_cost,\n",
|
||||
" start=start, end=end)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's see what is inside the backtesting results\n",
|
||||
"backtesting_results.keys()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# now let's analyze each of the dataframes\n",
|
||||
"\n",
|
||||
"# 1. The processed data: this is the data that we are going to use to generate the signal\n",
|
||||
"backtesting_results[\"processed_data\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 2. The executors dataframe: this is the dataframe that contains the information of the orders that were executed\n",
|
||||
"backtesting_results[\"executors_df\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 3. The results dataframe: this is the dataframe that contains the information of the pnl of the strategy\n",
|
||||
"backtesting_results[\"results\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Now let's analyze the results using the StrategyAnalysis class\n",
|
||||
"strategy_analysis = StrategyAnalysis(\n",
|
||||
" positions=backtesting_results[\"executors_df\"],\n",
|
||||
" candles_df=backtesting_results[\"processed_data\"],\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# let's visualize the PNL over time of the strategy\n",
|
||||
"strategy_analysis.pnl_over_time()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"strategy_analysis.create_base_figure(volume=False, positions=False, trade_pnl=True)\n",
|
||||
"fig = strategy_analysis.figure()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fig"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Now let's see how we can add the SuperTrend to the plot\n",
|
||||
"\n",
|
||||
"import plotly.graph_objects as go\n",
|
||||
"\n",
|
||||
"super_trend_long = strategy_analysis.candles_df[strategy_analysis.candles_df[f\"SUPERTd_{length}_{multiplier}\"] == 1]\n",
|
||||
"super_trend_short = strategy_analysis.candles_df[strategy_analysis.candles_df[f\"SUPERTd_{length}_{multiplier}\"] == -1]\n",
|
||||
"# Add the SuperTrend line\n",
|
||||
"fig.add_trace(go.Scatter(x=super_trend_long.index, y=super_trend_long[f'SUPERT_{length}_{multiplier}'],\n",
|
||||
" mode='markers',\n",
|
||||
" name='SuperTrend Long',\n",
|
||||
" line=dict(color=\"green\")),\n",
|
||||
" row=1, col=1)\n",
|
||||
"# Add the SuperTrend line\n",
|
||||
"fig.add_trace(go.Scatter(x=super_trend_short.index, y=super_trend_short[f'SUPERT_{length}_{multiplier}'],\n",
|
||||
" mode='markers',\n",
|
||||
" name='SuperTrend Short',\n",
|
||||
" line=dict(color=\"red\")),\n",
|
||||
" row=1, col=1)\n",
|
||||
"\n",
|
||||
"fig"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# To see the trades we will need to select a lower timeframe due the restrictions and speed of the plotly library\n",
|
||||
"start_time = \"2023-11-03\"\n",
|
||||
"end_time = \"2023-11-05\"\n",
|
||||
"\n",
|
||||
"processed_data_filtered = backtesting_results[\"processed_data\"][\n",
|
||||
" (backtesting_results[\"processed_data\"][\"timestamp\"] >= start_time) &\n",
|
||||
" (backtesting_results[\"processed_data\"][\"timestamp\"] <= end_time)\n",
|
||||
"]\n",
|
||||
"\n",
|
||||
"executors_filtered = backtesting_results[\"executors_df\"][\n",
|
||||
" (backtesting_results[\"executors_df\"][\"timestamp\"] >= start_time) &\n",
|
||||
" (backtesting_results[\"executors_df\"][\"timestamp\"] <= end_time)\n",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"executors_filtered"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"strategy_analysis = StrategyAnalysis(\n",
|
||||
" positions=executors_filtered,\n",
|
||||
" candles_df=processed_data_filtered,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"strategy_analysis.create_base_figure(volume=False, positions=True, trade_pnl=True)\n",
|
||||
"fig = strategy_analysis.figure()\n",
|
||||
"super_trend_long = strategy_analysis.candles_df[strategy_analysis.candles_df[f\"SUPERTd_{length}_{multiplier}\"] == 1]\n",
|
||||
"super_trend_short = strategy_analysis.candles_df[strategy_analysis.candles_df[f\"SUPERTd_{length}_{multiplier}\"] == -1]\n",
|
||||
"# Add the SuperTrend line\n",
|
||||
"fig.add_trace(go.Scatter(x=super_trend_long.index, y=super_trend_long[f'SUPERT_{length}_{multiplier}'],\n",
|
||||
" mode='markers',\n",
|
||||
" name='SuperTrend Long',\n",
|
||||
" line=dict(color=\"green\")),\n",
|
||||
" row=1, col=1)\n",
|
||||
"# Add the SuperTrend line\n",
|
||||
"fig.add_trace(go.Scatter(x=super_trend_short.index, y=super_trend_short[f'SUPERT_{length}_{multiplier}'],\n",
|
||||
" mode='markers',\n",
|
||||
" name='SuperTrend Short',\n",
|
||||
" line=dict(color=\"red\")),\n",
|
||||
" row=1, col=1)\n",
|
||||
"fig"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"### Scatter of PNL per Trade\n",
|
||||
"This bar chart illustrates the PNL for each individual trade. Positive PNLs are shown in green and negative PNLs in red, providing a clear view of profitable vs. unprofitable trades.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import plotly.express as px\n",
|
||||
"\n",
|
||||
"executors_df = backtesting_results[\"executors_df\"]\n",
|
||||
"\n",
|
||||
"fig = px.scatter(executors_df, x=\"timestamp\", y='net_pnl_quote', title='PNL per Trade',\n",
|
||||
" color='profitable', color_continuous_scale=['red', 'green'])\n",
|
||||
"fig.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"### Scatter Plot of Volume vs. PNL\n",
|
||||
"This scatter plot explores the relationship between the trade volume and the PNL for each trade. It can reveal if larger volumes are associated with higher profits or losses.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fig = px.scatter(executors_df, x='volume', y='net_pnl_quote', title='Trade Volume vs. PNL')\n",
|
||||
"fig.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"### Histogram of PNL Distribution\n",
|
||||
"The histogram displays the distribution of PNL values across all trades. It helps in understanding the frequency and range of profit and loss outcomes.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fig = px.histogram(executors_df, x='net_pnl_quote', title='PNL Distribution')\n",
|
||||
"fig.show()\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"# Conclusion\n",
|
||||
"We can see that the indicator has potential to bring good signals to trade and might be interesting to see how we can design a market maker that shifts the mid price based on this indicator.\n",
|
||||
"A lot of the short signals are wrong but if we zoom in into the loss signals we can see that the losses are not that big and the wins are bigger and if we had implemented the trailing stop feature probably a lot of them are going to be profits."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"# Next steps\n",
|
||||
"- Filter only the loss signals and understand what you can do to prevent them\n",
|
||||
"- Try different configuration values for the indicator\n",
|
||||
"- Test in multiple markets, pick mature markets like BTC-USDT or ETH-USDT and also volatile markets like DOGE-USDT or SHIB-USDT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.13"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"root_path = os.path.abspath(os.path.join(os.getcwd(), '../../..'))\n",
|
||||
"sys.path.append(root_path)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import traceback\n",
|
||||
"from decimal import Decimal\n",
|
||||
"import pandas_ta as ta # noqa: F401\n",
|
||||
"\n",
|
||||
"from hummingbot.core.data_type.common import PositionMode, TradeType, OrderType\n",
|
||||
"from hummingbot.data_feed.candles_feed.candles_factory import CandlesConfig\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.data_types import TripleBarrierConf, OrderLevel\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.directional_trading import DirectionalTradingBacktestingEngine\n",
|
||||
"from hummingbot.smart_components.utils.config_encoder_decoder import ConfigEncoderDecoder\n",
|
||||
"from optuna import TrialPruned\n",
|
||||
"from hummingbot.smart_components.utils.order_level_builder import OrderLevelBuilder\n",
|
||||
"\n",
|
||||
"from quants_lab.controllers.supertrend import SuperTrend, SuperTrendConfig\n",
|
||||
"\n",
|
||||
"# To run an optimization with optuna we need to define the objective function that will be executed for each trial\n",
|
||||
"\n",
|
||||
"def objective(trial):\n",
|
||||
" try:\n",
|
||||
" # Market configuration\n",
|
||||
" exchange = \"binance_perpetual\"\n",
|
||||
" trading_pair = \"WLD-USDT\"\n",
|
||||
" interval = \"3m\"\n",
|
||||
"\n",
|
||||
" # Account configuration\n",
|
||||
" initial_portfolio_usd = 1000\n",
|
||||
" order_amount = Decimal(\"25\")\n",
|
||||
" n_levels = 1\n",
|
||||
" leverage = 20\n",
|
||||
" trade_cost = 0.0006\n",
|
||||
"\n",
|
||||
" # Backtest period\n",
|
||||
" start = \"2023-01-01\"\n",
|
||||
" end = \"2024-01-02\"\n",
|
||||
"\n",
|
||||
" # Triple barrier configuration\n",
|
||||
" stop_loss = trial.suggest_float('stop_loss', 0.01, 0.02, step=0.01)\n",
|
||||
" take_profit = trial.suggest_float('take_profit', 0.01, 0.04, step=0.01)\n",
|
||||
" time_limit = 60 * 60 * 12 # 12 hours\n",
|
||||
" trailing_stop_activation_price_delta = Decimal(\"0.008\")\n",
|
||||
" trailing_stop_trailing_delta = Decimal(\"0.004\")\n",
|
||||
"\n",
|
||||
" length = trial.suggest_int('length', 20, 200, step=20)\n",
|
||||
" multiplier = trial.suggest_float('multiplier', 2.0, 6.0, step=1.0)\n",
|
||||
" percentage_threshold = trial.suggest_float('percentage_threshold', 0.01, 0.03, step=0.01)\n",
|
||||
"\n",
|
||||
" # Building the order levels\n",
|
||||
" order_level_builder = OrderLevelBuilder(n_levels=n_levels)\n",
|
||||
" order_levels = order_level_builder.build_order_levels(\n",
|
||||
" amounts=order_amount,\n",
|
||||
" spreads=Decimal(\"0\"),\n",
|
||||
" triple_barrier_confs=TripleBarrierConf(\n",
|
||||
" stop_loss=stop_loss, take_profit=take_profit, time_limit=time_limit,\n",
|
||||
" trailing_stop_activation_price_delta=trailing_stop_activation_price_delta,\n",
|
||||
" trailing_stop_trailing_delta=trailing_stop_trailing_delta),\n",
|
||||
" )\n",
|
||||
" config = SuperTrendConfig(\n",
|
||||
" exchange=exchange,\n",
|
||||
" trading_pair=trading_pair,\n",
|
||||
" strategy_name='supertrend',\n",
|
||||
" candles_config=[\n",
|
||||
" CandlesConfig(connector=exchange, trading_pair=trading_pair,\n",
|
||||
" interval=interval, max_records=sys.maxsize)\n",
|
||||
" ],\n",
|
||||
" order_levels=order_levels,\n",
|
||||
" leverage=leverage,\n",
|
||||
" position_mode=PositionMode.HEDGE,\n",
|
||||
" length=length,\n",
|
||||
" multiplier=multiplier,\n",
|
||||
" percentage_threshold=percentage_threshold,\n",
|
||||
"\n",
|
||||
" )\n",
|
||||
" controller = SuperTrend(config=config)\n",
|
||||
" engine = DirectionalTradingBacktestingEngine(controller=controller)\n",
|
||||
" engine.load_controller_data(\"../../../data/candles\")\n",
|
||||
" backtesting_results = engine.run_backtesting(\n",
|
||||
" initial_portfolio_usd=initial_portfolio_usd,\n",
|
||||
" trade_cost=trade_cost,\n",
|
||||
" start=start, end=end)\n",
|
||||
"\n",
|
||||
" strategy_analysis = backtesting_results[\"results\"]\n",
|
||||
" encoder_decoder = ConfigEncoderDecoder(TradeType, OrderType, PositionMode)\n",
|
||||
"\n",
|
||||
" trial.set_user_attr(\"net_pnl_quote\", strategy_analysis[\"net_pnl_quote\"])\n",
|
||||
" trial.set_user_attr(\"net_pnl_pct\", strategy_analysis[\"net_pnl\"])\n",
|
||||
" trial.set_user_attr(\"max_drawdown_usd\", strategy_analysis[\"max_drawdown_usd\"])\n",
|
||||
" trial.set_user_attr(\"max_drawdown_pct\", strategy_analysis[\"max_drawdown_pct\"])\n",
|
||||
" trial.set_user_attr(\"sharpe_ratio\", strategy_analysis[\"sharpe_ratio\"])\n",
|
||||
" trial.set_user_attr(\"accuracy\", strategy_analysis[\"accuracy\"])\n",
|
||||
" trial.set_user_attr(\"total_positions\", strategy_analysis[\"total_positions\"])\n",
|
||||
" trial.set_user_attr(\"profit_factor\", strategy_analysis[\"profit_factor\"])\n",
|
||||
" trial.set_user_attr(\"duration_in_hours\", strategy_analysis[\"duration_minutes\"] / 60)\n",
|
||||
" trial.set_user_attr(\"avg_trading_time_in_hours\", strategy_analysis[\"avg_trading_time_minutes\"] / 60)\n",
|
||||
" trial.set_user_attr(\"win_signals\", strategy_analysis[\"win_signals\"])\n",
|
||||
" trial.set_user_attr(\"loss_signals\", strategy_analysis[\"loss_signals\"])\n",
|
||||
" trial.set_user_attr(\"config\", encoder_decoder.encode(config.dict()))\n",
|
||||
" return strategy_analysis[\"net_pnl\"]\n",
|
||||
" except Exception as e:\n",
|
||||
" traceback.print_exc()\n",
|
||||
" raise TrialPruned()\n"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import optuna\n",
|
||||
"\n",
|
||||
"# Now let's configure the parameters for the optimization\n",
|
||||
"study_name = \"super_trend_optimization_1\"\n",
|
||||
"storage= \"sqlite:///../../../data/backtesting/backtesting_report.db\"\n",
|
||||
"\n",
|
||||
"study = optuna.create_study(direction=\"maximize\", study_name=study_name,\n",
|
||||
" storage=storage,\n",
|
||||
" load_if_exists=True # If the study already exists, we load it\n",
|
||||
" )"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Not let's run the optimization!\n",
|
||||
"\n",
|
||||
"n_trials = 200\n",
|
||||
"study.optimize(objective, n_trials=n_trials)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,591 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"root_path = os.path.abspath(os.path.join(os.getcwd(), '../../..'))\n",
|
||||
"sys.path.append(root_path)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from decimal import Decimal\n",
|
||||
"\n",
|
||||
"# Market configuration\n",
|
||||
"exchange = \"binance_perpetual\"\n",
|
||||
"trading_pair = \"WLD-USDT\"\n",
|
||||
"interval = \"3m\"\n",
|
||||
"\n",
|
||||
"# Account configuration\n",
|
||||
"initial_portfolio_usd = 1000\n",
|
||||
"order_amount = Decimal(\"25\")\n",
|
||||
"n_levels = 1\n",
|
||||
"leverage = 20\n",
|
||||
"trade_cost = 0.0006\n",
|
||||
"\n",
|
||||
"# Backtest period\n",
|
||||
"start = \"2023-01-01\"\n",
|
||||
"end = \"2024-01-02\"\n",
|
||||
"\n",
|
||||
"# Triple barrier configuration\n",
|
||||
"stop_loss = Decimal(\"0.015\")\n",
|
||||
"take_profit = Decimal(\"0.03\")\n",
|
||||
"time_limit = 60 * 60 * 12 # 12 hours\n",
|
||||
"trailing_stop_activation_price_delta = Decimal(\"0.008\")\n",
|
||||
"trailing_stop_trailing_delta = Decimal(\"0.004\")"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from hummingbot.smart_components.utils.order_level_builder import OrderLevelBuilder\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.data_types import (\n",
|
||||
" TripleBarrierConf\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Building the order levels\n",
|
||||
"order_level_builder = OrderLevelBuilder(n_levels=n_levels)\n",
|
||||
"order_levels = order_level_builder.build_order_levels(\n",
|
||||
" amounts=order_amount,\n",
|
||||
" spreads=Decimal(\"0\"),\n",
|
||||
" # for directional strategies we don't need spreads since we are going to use market orders to enter\n",
|
||||
" triple_barrier_confs=TripleBarrierConf(\n",
|
||||
" stop_loss=stop_loss, take_profit=take_profit, time_limit=time_limit,\n",
|
||||
" trailing_stop_activation_price_delta=trailing_stop_activation_price_delta,\n",
|
||||
" trailing_stop_trailing_delta=trailing_stop_trailing_delta),\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's inpect the order levels\n",
|
||||
"order_levels"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"from hummingbot.data_feed.candles_feed.candles_factory import CandlesConfig\n",
|
||||
"from quants_lab.controllers.supertrend import SuperTrend, SuperTrendConfig\n",
|
||||
"\n",
|
||||
"# Controller configuration\n",
|
||||
"length = 100\n",
|
||||
"multiplier = 3.0\n",
|
||||
"percentage_threshold = 0.01\n",
|
||||
"\n",
|
||||
"# Creating the instance of the configuration and the controller\n",
|
||||
"config = SuperTrendConfig(\n",
|
||||
" exchange=exchange,\n",
|
||||
" trading_pair=trading_pair,\n",
|
||||
" order_levels=order_levels,\n",
|
||||
" candles_config=[\n",
|
||||
" CandlesConfig(connector=exchange, trading_pair=trading_pair, interval=interval, max_records=sys.maxsize),\n",
|
||||
" ],\n",
|
||||
" leverage=leverage,\n",
|
||||
" length=length,\n",
|
||||
" multiplier=multiplier,\n",
|
||||
" percentage_threshold=percentage_threshold,\n",
|
||||
")\n",
|
||||
"controller = SuperTrend(config=config)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from quants_lab.strategy.strategy_analysis import StrategyAnalysis\n",
|
||||
"\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.directional_trading.directional_trading_backtesting_engine import \\\n",
|
||||
" DirectionalTradingBacktestingEngine\n",
|
||||
"\n",
|
||||
"# Creating the backtesting engine and loading the historical data\n",
|
||||
"engine = DirectionalTradingBacktestingEngine(controller=controller)\n",
|
||||
"engine.load_controller_data(\"../../../data/candles\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's see what is inside the candles of the controller\n",
|
||||
"engine.controller.candles"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"engine.controller.candles[0].candles_df"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's understand what is inside the processed data since this is what we are going to use when generating the signal ;)\n",
|
||||
"engine.controller.get_processed_data()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's run the backtesting\n",
|
||||
"\n",
|
||||
"backtesting_results = engine.run_backtesting(initial_portfolio_usd=initial_portfolio_usd,\n",
|
||||
" trade_cost=trade_cost,\n",
|
||||
" start=start, end=end)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's see what is inside the backtesting results\n",
|
||||
"backtesting_results.keys()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# now let's analyze each of the dataframes\n",
|
||||
"\n",
|
||||
"# 1. The processed data: this is the data that we are going to use to generate the signal\n",
|
||||
"backtesting_results[\"processed_data\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 2. The executors dataframe: this is the dataframe that contains the information of the orders that were executed\n",
|
||||
"backtesting_results[\"executors_df\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 3. The results dataframe: this is the dataframe that contains the information of the pnl of the strategy\n",
|
||||
"backtesting_results[\"results\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Now let's analyze the results using the StrategyAnalysis class\n",
|
||||
"strategy_analysis = StrategyAnalysis(\n",
|
||||
" positions=backtesting_results[\"executors_df\"],\n",
|
||||
" candles_df=backtesting_results[\"processed_data\"],\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# let's visualize the PNL over time of the strategy\n",
|
||||
"strategy_analysis.pnl_over_time()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"strategy_analysis.create_base_figure(volume=False, positions=False, trade_pnl=True)\n",
|
||||
"fig = strategy_analysis.figure()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fig"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Now let's see how we can add the SuperTrend to the plot\n",
|
||||
"\n",
|
||||
"import plotly.graph_objects as go\n",
|
||||
"\n",
|
||||
"super_trend_long = strategy_analysis.candles_df[strategy_analysis.candles_df[f\"SUPERTd_{length}_{multiplier}\"] == 1]\n",
|
||||
"super_trend_short = strategy_analysis.candles_df[strategy_analysis.candles_df[f\"SUPERTd_{length}_{multiplier}\"] == -1]\n",
|
||||
"# Add the SuperTrend line\n",
|
||||
"fig.add_trace(go.Scatter(x=super_trend_long.index, y=super_trend_long[f'SUPERT_{length}_{multiplier}'],\n",
|
||||
" mode='markers',\n",
|
||||
" name='SuperTrend Long',\n",
|
||||
" line=dict(color=\"green\")),\n",
|
||||
" row=1, col=1)\n",
|
||||
"# Add the SuperTrend line\n",
|
||||
"fig.add_trace(go.Scatter(x=super_trend_short.index, y=super_trend_short[f'SUPERT_{length}_{multiplier}'],\n",
|
||||
" mode='markers',\n",
|
||||
" name='SuperTrend Short',\n",
|
||||
" line=dict(color=\"red\")),\n",
|
||||
" row=1, col=1)\n",
|
||||
"\n",
|
||||
"fig"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# To see the trades we will need to select a lower timeframe due the restrictions and speed of the plotly library\n",
|
||||
"start_time = \"2023-11-03\"\n",
|
||||
"end_time = \"2023-11-05\"\n",
|
||||
"\n",
|
||||
"processed_data_filtered = backtesting_results[\"processed_data\"][\n",
|
||||
" (backtesting_results[\"processed_data\"][\"timestamp\"] >= start_time) &\n",
|
||||
" (backtesting_results[\"processed_data\"][\"timestamp\"] <= end_time)\n",
|
||||
"]\n",
|
||||
"\n",
|
||||
"executors_filtered = backtesting_results[\"executors_df\"][\n",
|
||||
" (backtesting_results[\"executors_df\"][\"timestamp\"] >= start_time) &\n",
|
||||
" (backtesting_results[\"executors_df\"][\"timestamp\"] <= end_time)\n",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"executors_filtered"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"strategy_analysis = StrategyAnalysis(\n",
|
||||
" positions=executors_filtered,\n",
|
||||
" candles_df=processed_data_filtered,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"strategy_analysis.create_base_figure(volume=False, positions=True, trade_pnl=True)\n",
|
||||
"fig = strategy_analysis.figure()\n",
|
||||
"super_trend_long = strategy_analysis.candles_df[strategy_analysis.candles_df[f\"SUPERTd_{length}_{multiplier}\"] == 1]\n",
|
||||
"super_trend_short = strategy_analysis.candles_df[strategy_analysis.candles_df[f\"SUPERTd_{length}_{multiplier}\"] == -1]\n",
|
||||
"# Add the SuperTrend line\n",
|
||||
"fig.add_trace(go.Scatter(x=super_trend_long.index, y=super_trend_long[f'SUPERT_{length}_{multiplier}'],\n",
|
||||
" mode='markers',\n",
|
||||
" name='SuperTrend Long',\n",
|
||||
" line=dict(color=\"green\")),\n",
|
||||
" row=1, col=1)\n",
|
||||
"# Add the SuperTrend line\n",
|
||||
"fig.add_trace(go.Scatter(x=super_trend_short.index, y=super_trend_short[f'SUPERT_{length}_{multiplier}'],\n",
|
||||
" mode='markers',\n",
|
||||
" name='SuperTrend Short',\n",
|
||||
" line=dict(color=\"red\")),\n",
|
||||
" row=1, col=1)\n",
|
||||
"fig"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"### Scatter of PNL per Trade\n",
|
||||
"This bar chart illustrates the PNL for each individual trade. Positive PNLs are shown in green and negative PNLs in red, providing a clear view of profitable vs. unprofitable trades.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import plotly.express as px\n",
|
||||
"\n",
|
||||
"executors_df = backtesting_results[\"executors_df\"]\n",
|
||||
"\n",
|
||||
"fig = px.scatter(executors_df, x=\"timestamp\", y='net_pnl_quote', title='PNL per Trade',\n",
|
||||
" color='profitable', color_continuous_scale=['red', 'green'])\n",
|
||||
"fig.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"### Scatter Plot of Volume vs. PNL\n",
|
||||
"This scatter plot explores the relationship between the trade volume and the PNL for each trade. It can reveal if larger volumes are associated with higher profits or losses.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fig = px.scatter(executors_df, x='volume', y='net_pnl_quote', title='Trade Volume vs. PNL')\n",
|
||||
"fig.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"### Histogram of PNL Distribution\n",
|
||||
"The histogram displays the distribution of PNL values across all trades. It helps in understanding the frequency and range of profit and loss outcomes.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fig = px.histogram(executors_df, x='net_pnl_quote', title='PNL Distribution')\n",
|
||||
"fig.show()\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"# Conclusion\n",
|
||||
"We can see that the indicator has potential to bring good signals to trade and might be interesting to see how we can design a market maker that shifts the mid price based on this indicator.\n",
|
||||
"A lot of the short signals are wrong but if we zoom in into the loss signals we can see that the losses are not that big and the wins are bigger and if we had implemented the trailing stop feature probably a lot of them are going to be profits."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"# Next steps\n",
|
||||
"- Filter only the loss signals and understand what you can do to prevent them\n",
|
||||
"- Try different configuration values for the indicator\n",
|
||||
"- Test in multiple markets, pick mature markets like BTC-USDT or ETH-USDT and also volatile markets like DOGE-USDT or SHIB-USDT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.13"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"root_path = os.path.abspath(os.path.join(os.getcwd(), '../../..'))\n",
|
||||
"sys.path.append(root_path)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import traceback\n",
|
||||
"from decimal import Decimal\n",
|
||||
"import pandas_ta as ta # noqa: F401\n",
|
||||
"\n",
|
||||
"from hummingbot.core.data_type.common import PositionMode, TradeType, OrderType\n",
|
||||
"from hummingbot.data_feed.candles_feed.candles_factory import CandlesConfig\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.data_types import TripleBarrierConf, OrderLevel\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.directional_trading import DirectionalTradingBacktestingEngine\n",
|
||||
"from hummingbot.smart_components.utils.config_encoder_decoder import ConfigEncoderDecoder\n",
|
||||
"from optuna import TrialPruned\n",
|
||||
"from hummingbot.smart_components.utils.order_level_builder import OrderLevelBuilder\n",
|
||||
"\n",
|
||||
"from quants_lab.controllers.supertrend import SuperTrend, SuperTrendConfig\n",
|
||||
"\n",
|
||||
"# To run an optimization with optuna we need to define the objective function that will be executed for each trial\n",
|
||||
"\n",
|
||||
"def objective(trial):\n",
|
||||
" try:\n",
|
||||
" # Market configuration\n",
|
||||
" exchange = \"binance_perpetual\"\n",
|
||||
" trading_pair = \"WLD-USDT\"\n",
|
||||
" interval = \"3m\"\n",
|
||||
"\n",
|
||||
" # Account configuration\n",
|
||||
" initial_portfolio_usd = 1000\n",
|
||||
" order_amount = Decimal(\"25\")\n",
|
||||
" n_levels = 1\n",
|
||||
" leverage = 20\n",
|
||||
" trade_cost = 0.0006\n",
|
||||
"\n",
|
||||
" # Backtest period\n",
|
||||
" start = \"2023-01-01\"\n",
|
||||
" end = \"2024-01-02\"\n",
|
||||
"\n",
|
||||
" # Triple barrier configuration\n",
|
||||
" stop_loss = trial.suggest_float('stop_loss', 0.01, 0.02, step=0.01)\n",
|
||||
" take_profit = trial.suggest_float('take_profit', 0.01, 0.04, step=0.01)\n",
|
||||
" time_limit = 60 * 60 * 12 # 12 hours\n",
|
||||
" trailing_stop_activation_price_delta = Decimal(\"0.008\")\n",
|
||||
" trailing_stop_trailing_delta = Decimal(\"0.004\")\n",
|
||||
"\n",
|
||||
" length = trial.suggest_int('length', 20, 200, step=20)\n",
|
||||
" multiplier = trial.suggest_float('multiplier', 2.0, 6.0, step=1.0)\n",
|
||||
" percentage_threshold = trial.suggest_float('percentage_threshold', 0.01, 0.03, step=0.01)\n",
|
||||
"\n",
|
||||
" # Building the order levels\n",
|
||||
" order_level_builder = OrderLevelBuilder(n_levels=n_levels)\n",
|
||||
" order_levels = order_level_builder.build_order_levels(\n",
|
||||
" amounts=order_amount,\n",
|
||||
" spreads=Decimal(\"0\"),\n",
|
||||
" triple_barrier_confs=TripleBarrierConf(\n",
|
||||
" stop_loss=stop_loss, take_profit=take_profit, time_limit=time_limit,\n",
|
||||
" trailing_stop_activation_price_delta=trailing_stop_activation_price_delta,\n",
|
||||
" trailing_stop_trailing_delta=trailing_stop_trailing_delta),\n",
|
||||
" )\n",
|
||||
" config = SuperTrendConfig(\n",
|
||||
" exchange=exchange,\n",
|
||||
" trading_pair=trading_pair,\n",
|
||||
" strategy_name='supertrend',\n",
|
||||
" candles_config=[\n",
|
||||
" CandlesConfig(connector=exchange, trading_pair=trading_pair,\n",
|
||||
" interval=interval, max_records=sys.maxsize)\n",
|
||||
" ],\n",
|
||||
" order_levels=order_levels,\n",
|
||||
" leverage=leverage,\n",
|
||||
" position_mode=PositionMode.HEDGE,\n",
|
||||
" length=length,\n",
|
||||
" multiplier=multiplier,\n",
|
||||
" percentage_threshold=percentage_threshold,\n",
|
||||
"\n",
|
||||
" )\n",
|
||||
" controller = SuperTrend(config=config)\n",
|
||||
" engine = DirectionalTradingBacktestingEngine(controller=controller)\n",
|
||||
" engine.load_controller_data(\"../../../data/candles\")\n",
|
||||
" backtesting_results = engine.run_backtesting(\n",
|
||||
" initial_portfolio_usd=initial_portfolio_usd,\n",
|
||||
" trade_cost=trade_cost,\n",
|
||||
" start=start, end=end)\n",
|
||||
"\n",
|
||||
" strategy_analysis = backtesting_results[\"results\"]\n",
|
||||
" encoder_decoder = ConfigEncoderDecoder(TradeType, OrderType, PositionMode)\n",
|
||||
"\n",
|
||||
" trial.set_user_attr(\"net_pnl_quote\", strategy_analysis[\"net_pnl_quote\"])\n",
|
||||
" trial.set_user_attr(\"net_pnl_pct\", strategy_analysis[\"net_pnl\"])\n",
|
||||
" trial.set_user_attr(\"max_drawdown_usd\", strategy_analysis[\"max_drawdown_usd\"])\n",
|
||||
" trial.set_user_attr(\"max_drawdown_pct\", strategy_analysis[\"max_drawdown_pct\"])\n",
|
||||
" trial.set_user_attr(\"sharpe_ratio\", strategy_analysis[\"sharpe_ratio\"])\n",
|
||||
" trial.set_user_attr(\"accuracy\", strategy_analysis[\"accuracy\"])\n",
|
||||
" trial.set_user_attr(\"total_positions\", strategy_analysis[\"total_positions\"])\n",
|
||||
" trial.set_user_attr(\"profit_factor\", strategy_analysis[\"profit_factor\"])\n",
|
||||
" trial.set_user_attr(\"duration_in_hours\", strategy_analysis[\"duration_minutes\"] / 60)\n",
|
||||
" trial.set_user_attr(\"avg_trading_time_in_hours\", strategy_analysis[\"avg_trading_time_minutes\"] / 60)\n",
|
||||
" trial.set_user_attr(\"win_signals\", strategy_analysis[\"win_signals\"])\n",
|
||||
" trial.set_user_attr(\"loss_signals\", strategy_analysis[\"loss_signals\"])\n",
|
||||
" trial.set_user_attr(\"config\", encoder_decoder.encode(config.dict()))\n",
|
||||
" return strategy_analysis[\"net_pnl\"]\n",
|
||||
" except Exception as e:\n",
|
||||
" traceback.print_exc()\n",
|
||||
" raise TrialPruned()\n"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import optuna\n",
|
||||
"\n",
|
||||
"# Now let's configure the parameters for the optimization\n",
|
||||
"study_name = \"super_trend_optimization_1\"\n",
|
||||
"storage= \"sqlite:///../../../data/backtesting/backtesting_report.db\"\n",
|
||||
"\n",
|
||||
"study = optuna.create_study(direction=\"maximize\", study_name=study_name,\n",
|
||||
" storage=storage,\n",
|
||||
" load_if_exists=True # If the study already exists, we load it\n",
|
||||
" )"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Not let's run the optimization!\n",
|
||||
"\n",
|
||||
"n_trials = 200\n",
|
||||
"study.optimize(objective, n_trials=n_trials)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,241 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"root_path = os.path.abspath(os.path.join(os.getcwd(), '../../..'))\n",
|
||||
"sys.path.append(root_path)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import traceback\n",
|
||||
"from decimal import Decimal\n",
|
||||
"import pandas_ta as ta # noqa: F401\n",
|
||||
"\n",
|
||||
"from hummingbot.core.data_type.common import PositionMode, TradeType, OrderType\n",
|
||||
"from hummingbot.data_feed.candles_feed.candles_factory import CandlesConfig\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.data_types import TripleBarrierConf, OrderLevel\n",
|
||||
"from hummingbot.smart_components.strategy_frameworks.directional_trading import DirectionalTradingBacktestingEngine\n",
|
||||
"from hummingbot.smart_components.utils.config_encoder_decoder import ConfigEncoderDecoder\n",
|
||||
"from optuna import TrialPruned\n",
|
||||
"from hummingbot.smart_components.utils.order_level_builder import OrderLevelBuilder\n",
|
||||
"\n",
|
||||
"from quants_lab.controllers.supertrend_multitimeframe import SuperTrendMT, SuperTrendMTConfig\n",
|
||||
"\n",
|
||||
"# To run an optimization with optuna we need to define the objective function that will be executed for each trial\n",
|
||||
"\n",
|
||||
"def objective(trial):\n",
|
||||
" try:\n",
|
||||
" # Market configuration\n",
|
||||
" exchange = \"binance_perpetual\"\n",
|
||||
" trading_pair = \"WLD-USDT\"\n",
|
||||
" intervals = [\"3m\", \"1h\"]\n",
|
||||
"\n",
|
||||
" # Account configuration\n",
|
||||
" initial_portfolio_usd = 1000\n",
|
||||
" order_amount = Decimal(\"25\")\n",
|
||||
" n_levels = 1\n",
|
||||
" leverage = 20\n",
|
||||
" trade_cost = 0.0006\n",
|
||||
"\n",
|
||||
" # Backtest period\n",
|
||||
" start = \"2023-01-01\"\n",
|
||||
" end = \"2024-01-02\"\n",
|
||||
"\n",
|
||||
" # Triple barrier configuration\n",
|
||||
" stop_loss = trial.suggest_float('stop_loss', 0.01, 0.02, step=0.01)\n",
|
||||
" take_profit = trial.suggest_float('take_profit', 0.01, 0.04, step=0.01)\n",
|
||||
" time_limit = 60 * 60 * 12 # 12 hours\n",
|
||||
" trailing_stop_activation_price_delta = Decimal(\"0.008\")\n",
|
||||
" trailing_stop_trailing_delta = Decimal(\"0.004\")\n",
|
||||
"\n",
|
||||
" length = trial.suggest_int('length', 20, 200, step=20)\n",
|
||||
" multiplier = trial.suggest_float('multiplier', 2.0, 6.0, step=1.0)\n",
|
||||
" percentage_threshold = trial.suggest_float('percentage_threshold', 0.01, 0.03, step=0.01)\n",
|
||||
"\n",
|
||||
" # Building the order levels\n",
|
||||
" order_level_builder = OrderLevelBuilder(n_levels=n_levels)\n",
|
||||
" order_levels = order_level_builder.build_order_levels(\n",
|
||||
" amounts=order_amount,\n",
|
||||
" spreads=Decimal(\"0\"),\n",
|
||||
" triple_barrier_confs=TripleBarrierConf(\n",
|
||||
" stop_loss=stop_loss, take_profit=take_profit, time_limit=time_limit,\n",
|
||||
" trailing_stop_activation_price_delta=trailing_stop_activation_price_delta,\n",
|
||||
" trailing_stop_trailing_delta=trailing_stop_trailing_delta),\n",
|
||||
" )\n",
|
||||
" config = SuperTrendMTConfig(\n",
|
||||
" exchange=exchange,\n",
|
||||
" trading_pair=trading_pair,\n",
|
||||
" strategy_name='supertrend_multitimeframe',\n",
|
||||
" candles_config=[\n",
|
||||
" CandlesConfig(connector=exchange, trading_pair=trading_pair,\n",
|
||||
" interval=intervals[0], max_records=sys.maxsize),\n",
|
||||
" CandlesConfig(connector=exchange, trading_pair=trading_pair,\n",
|
||||
" interval=intervals[1], max_records=sys.maxsize),\n",
|
||||
" ],\n",
|
||||
" order_levels=order_levels,\n",
|
||||
" leverage=leverage,\n",
|
||||
" position_mode=PositionMode.HEDGE,\n",
|
||||
" length=length,\n",
|
||||
" multiplier=multiplier,\n",
|
||||
" percentage_threshold=percentage_threshold,\n",
|
||||
"\n",
|
||||
" )\n",
|
||||
" controller = SuperTrendMT(config=config)\n",
|
||||
" engine = DirectionalTradingBacktestingEngine(controller=controller)\n",
|
||||
" engine.load_controller_data(\"../../../data/candles\")\n",
|
||||
" backtesting_results = engine.run_backtesting(\n",
|
||||
" initial_portfolio_usd=initial_portfolio_usd,\n",
|
||||
" trade_cost=trade_cost,\n",
|
||||
" start=start, end=end)\n",
|
||||
"\n",
|
||||
" strategy_analysis = backtesting_results[\"results\"]\n",
|
||||
" encoder_decoder = ConfigEncoderDecoder(TradeType, OrderType, PositionMode)\n",
|
||||
"\n",
|
||||
" trial.set_user_attr(\"net_pnl_quote\", strategy_analysis[\"net_pnl_quote\"])\n",
|
||||
" trial.set_user_attr(\"net_pnl_pct\", strategy_analysis[\"net_pnl\"])\n",
|
||||
" trial.set_user_attr(\"max_drawdown_usd\", strategy_analysis[\"max_drawdown_usd\"])\n",
|
||||
" trial.set_user_attr(\"max_drawdown_pct\", strategy_analysis[\"max_drawdown_pct\"])\n",
|
||||
" trial.set_user_attr(\"sharpe_ratio\", strategy_analysis[\"sharpe_ratio\"])\n",
|
||||
" trial.set_user_attr(\"accuracy\", strategy_analysis[\"accuracy\"])\n",
|
||||
" trial.set_user_attr(\"total_positions\", strategy_analysis[\"total_positions\"])\n",
|
||||
" trial.set_user_attr(\"profit_factor\", strategy_analysis[\"profit_factor\"])\n",
|
||||
" trial.set_user_attr(\"duration_in_hours\", strategy_analysis[\"duration_minutes\"] / 60)\n",
|
||||
" trial.set_user_attr(\"avg_trading_time_in_hours\", strategy_analysis[\"avg_trading_time_minutes\"] / 60)\n",
|
||||
" trial.set_user_attr(\"win_signals\", strategy_analysis[\"win_signals\"])\n",
|
||||
" trial.set_user_attr(\"loss_signals\", strategy_analysis[\"loss_signals\"])\n",
|
||||
" trial.set_user_attr(\"config\", encoder_decoder.encode(config.dict()))\n",
|
||||
" return strategy_analysis[\"net_pnl\"]\n",
|
||||
" except Exception as e:\n",
|
||||
" traceback.print_exc()\n",
|
||||
" raise TrialPruned()\n"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-12-12T01:02:29.309413Z",
|
||||
"start_time": "2023-12-12T01:02:29.300687Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[I 2023-12-11 22:02:37,318] A new study created in RDB with name: super_trend_optimization_mt\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import optuna\n",
|
||||
"\n",
|
||||
"# Now let's configure the parameters for the optimization\n",
|
||||
"study_name = \"super_trend_optimization_mt\"\n",
|
||||
"storage= \"sqlite:///../../../data/backtesting/backtesting_report.db\"\n",
|
||||
"\n",
|
||||
"study = optuna.create_study(direction=\"maximize\", study_name=study_name,\n",
|
||||
" storage=storage,\n",
|
||||
" load_if_exists=True # If the study already exists, we load it\n",
|
||||
" )"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-12-12T01:02:37.322291Z",
|
||||
"start_time": "2023-12-12T01:02:37.245002Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[I 2023-12-11 22:03:00,563] Trial 0 finished with value: -0.35098199626293336 and parameters: {'stop_loss': 0.02, 'take_profit': 0.02, 'length': 40, 'multiplier': 6.0, 'percentage_threshold': 0.03}. Best is trial 0 with value: -0.35098199626293336.\n",
|
||||
"[I 2023-12-11 22:03:17,061] Trial 1 finished with value: 0.12488305093272298 and parameters: {'stop_loss': 0.02, 'take_profit': 0.03, 'length': 140, 'multiplier': 3.0, 'percentage_threshold': 0.01}. Best is trial 1 with value: 0.12488305093272298.\n",
|
||||
"[I 2023-12-11 22:03:33,423] Trial 2 finished with value: -0.4536291130718499 and parameters: {'stop_loss': 0.01, 'take_profit': 0.02, 'length': 120, 'multiplier': 5.0, 'percentage_threshold': 0.02}. Best is trial 1 with value: 0.12488305093272298.\n",
|
||||
"[I 2023-12-11 22:03:49,953] Trial 3 finished with value: -0.05073410868582624 and parameters: {'stop_loss': 0.01, 'take_profit': 0.03, 'length': 100, 'multiplier': 4.0, 'percentage_threshold': 0.01}. Best is trial 1 with value: 0.12488305093272298.\n",
|
||||
"[I 2023-12-11 22:04:07,164] Trial 4 finished with value: 0.1619153622180836 and parameters: {'stop_loss': 0.02, 'take_profit': 0.03, 'length': 200, 'multiplier': 6.0, 'percentage_threshold': 0.01}. Best is trial 4 with value: 0.1619153622180836.\n",
|
||||
"[I 2023-12-11 22:04:24,073] Trial 5 finished with value: -0.18547605063707406 and parameters: {'stop_loss': 0.02, 'take_profit': 0.01, 'length': 40, 'multiplier': 3.0, 'percentage_threshold': 0.02}. Best is trial 4 with value: 0.1619153622180836.\n",
|
||||
"[I 2023-12-11 22:04:41,109] Trial 6 finished with value: -0.3164755434895661 and parameters: {'stop_loss': 0.02, 'take_profit': 0.01, 'length': 180, 'multiplier': 6.0, 'percentage_threshold': 0.01}. Best is trial 4 with value: 0.1619153622180836.\n",
|
||||
"[I 2023-12-11 22:04:57,609] Trial 7 finished with value: -0.1038527397065552 and parameters: {'stop_loss': 0.01, 'take_profit': 0.02, 'length': 140, 'multiplier': 4.0, 'percentage_threshold': 0.03}. Best is trial 4 with value: 0.1619153622180836.\n",
|
||||
"[I 2023-12-11 22:05:15,271] Trial 8 finished with value: 0.7404879450347805 and parameters: {'stop_loss': 0.01, 'take_profit': 0.01, 'length': 40, 'multiplier': 2.0, 'percentage_threshold': 0.01}. Best is trial 8 with value: 0.7404879450347805.\n",
|
||||
"[I 2023-12-11 22:05:33,215] Trial 9 finished with value: -0.960719787819319 and parameters: {'stop_loss': 0.01, 'take_profit': 0.01, 'length': 60, 'multiplier': 6.0, 'percentage_threshold': 0.01}. Best is trial 8 with value: 0.7404879450347805.\n",
|
||||
"[I 2023-12-11 22:05:50,582] Trial 10 finished with value: 1.1998584529952074 and parameters: {'stop_loss': 0.01, 'take_profit': 0.04, 'length': 80, 'multiplier': 2.0, 'percentage_threshold': 0.02}. Best is trial 10 with value: 1.1998584529952074.\n",
|
||||
"[I 2023-12-11 22:06:07,814] Trial 11 finished with value: 1.1998584529952074 and parameters: {'stop_loss': 0.01, 'take_profit': 0.04, 'length': 80, 'multiplier': 2.0, 'percentage_threshold': 0.02}. Best is trial 10 with value: 1.1998584529952074.\n",
|
||||
"[I 2023-12-11 22:06:24,455] Trial 12 finished with value: 1.1998584529952074 and parameters: {'stop_loss': 0.01, 'take_profit': 0.04, 'length': 80, 'multiplier': 2.0, 'percentage_threshold': 0.02}. Best is trial 10 with value: 1.1998584529952074.\n",
|
||||
"[I 2023-12-11 22:06:41,101] Trial 13 finished with value: 1.1998584529952074 and parameters: {'stop_loss': 0.01, 'take_profit': 0.04, 'length': 80, 'multiplier': 2.0, 'percentage_threshold': 0.02}. Best is trial 10 with value: 1.1998584529952074.\n",
|
||||
"[I 2023-12-11 22:06:57,606] Trial 14 finished with value: 0.02047001353630673 and parameters: {'stop_loss': 0.01, 'take_profit': 0.04, 'length': 20, 'multiplier': 3.0, 'percentage_threshold': 0.03}. Best is trial 10 with value: 1.1998584529952074.\n",
|
||||
"[I 2023-12-11 22:07:14,208] Trial 15 finished with value: 0.9931433766610962 and parameters: {'stop_loss': 0.01, 'take_profit': 0.04, 'length': 100, 'multiplier': 2.0, 'percentage_threshold': 0.02}. Best is trial 10 with value: 1.1998584529952074.\n",
|
||||
"[I 2023-12-11 22:07:30,823] Trial 16 finished with value: 0.37864993105614836 and parameters: {'stop_loss': 0.01, 'take_profit': 0.03, 'length': 80, 'multiplier': 3.0, 'percentage_threshold': 0.02}. Best is trial 10 with value: 1.1998584529952074.\n",
|
||||
"[I 2023-12-11 22:07:47,525] Trial 17 finished with value: 1.089455391608849 and parameters: {'stop_loss': 0.01, 'take_profit': 0.04, 'length': 140, 'multiplier': 2.0, 'percentage_threshold': 0.03}. Best is trial 10 with value: 1.1998584529952074.\n",
|
||||
"[I 2023-12-11 22:08:04,394] Trial 18 finished with value: -0.2011129787326267 and parameters: {'stop_loss': 0.01, 'take_profit': 0.04, 'length': 60, 'multiplier': 5.0, 'percentage_threshold': 0.02}. Best is trial 10 with value: 1.1998584529952074.\n",
|
||||
"[I 2023-12-11 22:08:20,927] Trial 19 finished with value: 0.19209940796981184 and parameters: {'stop_loss': 0.01, 'take_profit': 0.03, 'length': 120, 'multiplier': 3.0, 'percentage_threshold': 0.02}. Best is trial 10 with value: 1.1998584529952074.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Not let's run the optimization!\n",
|
||||
"\n",
|
||||
"n_trials = 20\n",
|
||||
"study.optimize(objective, n_trials=n_trials)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-12-12T01:08:20.930649Z",
|
||||
"start_time": "2023-12-12T01:02:43.228031Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def triple_barrier_method(df, tp=1.0, sl=1.0, tl=5, std_span: Optional[int] = 100, trade_cost=0.0006, max_executors: int = 1):
|
||||
df.index = pd.to_datetime(df.timestamp, unit="s")
|
||||
if std_span:
|
||||
df["target"] = df["close"].rolling(std_span).std() / df["close"]
|
||||
else:
|
||||
df["target"] = 1 / 100
|
||||
df["tl"] = df.index + pd.Timedelta(seconds=tl)
|
||||
df.dropna(subset="target", inplace=True)
|
||||
|
||||
df = apply_tp_sl_on_tl(df, tp=tp, sl=sl)
|
||||
|
||||
df = get_bins(df, trade_cost)
|
||||
|
||||
df['tp'] = df['close'] * (1 + df['target'] * tp * df["side"])
|
||||
df['sl'] = df['close'] * (1 - df['target'] * sl * df["side"])
|
||||
|
||||
df = add_active_signals(df, max_executors)
|
||||
return df
|
||||
|
||||
|
||||
def add_active_signals(df, max_executors):
|
||||
close_times = [pd.Timestamp.min] * max_executors
|
||||
df["active_signal"] = 0
|
||||
for index, row in df[(df["side"] != 0)].iterrows():
|
||||
for close_time in close_times:
|
||||
if row["timestamp"] > close_time:
|
||||
df.loc[df.index == index, "active_signal"] = 1
|
||||
close_times.remove(close_time)
|
||||
close_times.append(row["close_time"])
|
||||
break
|
||||
return df
|
||||
|
||||
|
||||
def get_bins(df, trade_cost):
|
||||
# 1) prices aligned with events
|
||||
px = df.index.union(df['tl'].values).drop_duplicates()
|
||||
px = df.close.reindex(px, method='ffill')
|
||||
|
||||
# 2) create out object
|
||||
df['ret'] = (px.loc[df['close_time'].values].values / px.loc[df.index] - 1) * df['side']
|
||||
df['real_class'] = np.sign(df['ret'] - trade_cost)
|
||||
return df
|
||||
|
||||
|
||||
def apply_tp_sl_on_tl(df: pd.DataFrame, tp: float, sl: float):
|
||||
events = df[df["side"] != 0].copy()
|
||||
if tp > 0:
|
||||
take_profit = tp * events['target']
|
||||
else:
|
||||
take_profit = pd.Series(index=df.index) # NaNs
|
||||
if sl > 0:
|
||||
stop_loss = - sl * events['target']
|
||||
else:
|
||||
stop_loss = pd.Series(index=df.index) # NaNs
|
||||
|
||||
for loc, tl in events['tl'].fillna(df.index[-1]).items():
|
||||
df0 = df.close[loc:tl] # path prices
|
||||
df0 = (df0 / df.close[loc] - 1) * events.at[loc, 'side'] # path returns
|
||||
df.loc[loc, 'stop_loss_time'] = df0[df0 < stop_loss[loc]].index.min() # earliest stop loss.
|
||||
df.loc[loc, 'take_profit_time'] = df0[df0 > take_profit[loc]].index.min() # earliest profit taking.
|
||||
df["close_time"] = df[["tl", "take_profit_time", "stop_loss_time"]].dropna(how='all').min(axis=1)
|
||||
df['close_type'] = df[['take_profit_time', 'stop_loss_time', 'tl']].dropna(how='all').idxmin(axis=1)
|
||||
df['close_type'].replace({'take_profit_time': 'tp', 'stop_loss_time': 'sl'}, inplace=True)
|
||||
return df
|
||||
Reference in New Issue
Block a user