Upgrade to Pro — share decks privately, control downloads, hide ads and more …

BitMech 探索的 トレーディングシステム fin-py study #1

BitMech 探索的 トレーディングシステム fin-py study #1

Kazuyuki Mori

October 25, 2017
Tweet

More Decks by Kazuyuki Mori

Other Decks in Programming

Transcript

  1. ベイズ最適化 "MACD":{ "candleSize":(1,60), # tick per minute "historySize":(1,60), "short": (0.1,30),

    # short EMA "longWeight": (1.,5.), # long EMA(short*longWeight) "signal": (1,18), # shortEMA - longEMA diff "thresholds.down": (-5.,0.), # trend thresholds "thresholds.up": (0.,5.), # trend thresholds "thresholds.persistence": (0,100), # trend duration(count up by tick) thresholds }
  2. ベイズ最適化 bo = BayesianOptimization(gekko_search, settings[Strategy]) bo.maximize(init_points=100, n_iter=500) max_val = bo.res['max']['max_val']

    max_params = bo.res['max']['max_params'] ※gekko_searchは、BTC_USDTの365日の履歴から、ランダムに開始日付を決 め、そこから21日間を使用してBacktestを行う。それを100回繰り返し、利回りの平均 を戻り値とする ※評価フェーズでは訓練に使用した365日以外の直近21日をテストデータとする
  3. ベイズ最適化 "MACD": { "candleSize": 50.37603262287613, "historySize": 49.11385249240558, "short": 11.190538130227413, "long":

    31.9361776661688, "signal": 8.345598472515947, "thresholds": { "down": -2.647355926611602, "up": 4.830104575041095, "persistence": 25 } },
  4. "report": { "currency": "USDT", "asset": "BTC", "startTime": "2017-06-17 07:35:00", "endTime":

    "2017-09-15 07:35:00", "timespan": "3 months", "market": 27.596381454724337, "balance": 3131.48495283, "profit": 576.0583990200003, "relativeProfit": 22.54255353812181, "yearlyProfit": "2336.23684047", "relativeYearlyProfit": "91.42257824", "startPrice": 2455.42655381, "endPrice": 3133.03543194, "trades": 11, "startBalance": 2555.42655381, "sharpe": 3.4588682678334988, "alpha": 548.4620175652759 }
  5. // MACD Settings // 1st Evaluate: // count: 20.000 //

    mean: 1.956 // std: 8.047 // min: -11.649 // 25%: -3.180 // 50%: 0.989 // 75%: 4.577 // max: 19.710 // 2nd Evaluate: // count: 20.000 // mean: -1.209 // std: 7.454 // min: -13.935 // 25%: -6.069 // 50%: -1.290 // 75%: 4.532 // max: 15.764 // 3rd Evaluate nearest date: 2017-08-04 01:17:00 to 2017-08-07 01:17:00 // Evaluted Score: 15.179254 // Realtime Score: 19.415671644
  6. Layer (type) Output Shape Param # ============================================================= dense_1 (Dense) (None,

    4, 4320, 16) 128 activation_1 (Activation) (None, 4, 4320, 16) 0 dense_2 (Dense) (None, 4, 4320, 16) 272 activation_2 (Activation) (None, 4, 4320, 16) 0 dense_3 (Dense) (None, 4, 4320, 16) 272 activation_3 (Activation) (None, 4, 4320, 16) 0 flatten_1 (Flatten) (None, 276480) 0 dense_4 (Dense) (None, 3) 829443 activation_4 (Activation) (None, 3) 0 ============================================================= Total params: 830,115 Trainable params: 830,115 Non-trainable params: 0
  7. 強化学習 memory = SequentialMemory(limit=100000, window_length=WINDOW_LENGTH) policy = BoltzmannQPolicy() dqn =

    DQNAgent(model=model, nb_actions=nb_actions, memory=memory, nb_steps_warmup=10, target_model_update=1e-2, policy=policy) dqn.compile(Adam(lr=1e-3), metrics=['mae'])
  8. { "startTime": "2017-09-16 21:20:00", "endTime": "2017-10-16 21:10:00", "timespan": "30 days

    +00:10:00", "market": 57.54195628060023, "profit": 211503.88575317, "relative_profit": 52.47206769719335, "relativeYearlyProfit": 667.1723099962994, "trades": 7, "alpha": -5.069888583406879, "vol": 14.58040336060525, "beta": 8.57450862367706, "hpm(0.0)_1": 10.57393540908159, "lpm(0.0)_1": 0.20543805133434886, "VaR(0.05)": 0.741872972377621, "CVaR(0.05)": Infinity, "Drawdown(5)": 0.741872972377621, "Max Drawdown": 0.9931148851914983, "Treynor Ratio": 1.2092024461391673, "Sharpe Ratio": 0.7111131664714991, "Information Ratio": 6.059422344061186, "Excess VaR": 13.975865395072118, "Conditional Sharpe Ratio": 0.0, "Omega Ratio": 50.46931050430054, "Sortino Ratio": 29.168212961815183, "Kappa 3 Ratio": 23.461701486849886, "Gain Loss Ratio": 51.470189385084225, "Upside Potential Ratio": 29.746660498584962, "Calmar Ratio": 10.440198769342185, "Sterling Ratio": 15.433829081932238, "Burke Ratio": 13.578582235419699, }
  9. トレード情報: currency, asset, startTime, endTime, timespan, market, balance, profit, relativeProfit,

    startPrice, endPrice, trades, startBalance, alpha リスク指標: volatility, beta, hpm(0.0)_1, lpm(0.0)_1, VaR(0.05), CVaR(0.05), Drawdown(5), Max Drawdown リスク調整済み指標: Treynor Ratio, Sharpe Ratio, Information Ratio VaR調整済み指標: Excess VaR, Conditional Sharpe Ratio 下方部分積率リスク調整済み指標: Omega Ratio, Sortino Ratio, Kappa 3 Ratio, Gain Loss Ratio, Upside Potential Ratio ドローダウンリスク調整済み指標: Calmar Ratio, Sterling Ratio, Burke Ratio