DeviaVir / zenbot

Zenbot is a command-line cryptocurrency trading bot using Node.js and MongoDB.
MIT License
8.22k stars 2.04k forks source link

Fixing simulations for Kraken exchange #2629

Closed LuisAlejandro closed 3 years ago

LuisAlejandro commented 3 years ago

This pull request accomplishes the following:

There is still a bug with the simulation, as its not lowwing correctly the numbers of wins. I'll be doing a separate PR for that.

LuisAlejandro commented 3 years ago

Well, apparently the simulation is completely fine, i forgot to adjust the --currency_capital accordingly with the pair I was using.

Here's one use case: bash zenbot.sh sim kraken.DOT-XETH --period_length=15m --period=15m --min_periods=52 --order_type=taker --trend_ema=36 --strategy=trend_ema --buy_pct=99 --sell_pct=99 --neutral_rate=auto --max_buy_loss_pct=0.1 --max_sell_loss_pct=0.1 --sell_stop_pct=1 --buy_stop_pct=1 --verbose --enable_stats --currency_capital=0.1

Results

{
  "asset_capital": 0,
  "avg_slippage_pct": 0.045,
  "buy_pct": 99,
  "buy_stop_pct": 1,
  "currency_capital": 0.1,
  "days": 14,
  "enable_stats": true,
  "markdown_buy_pct": 0,
  "markup_sell_pct": 0,
  "max_buy_loss_pct": "0.1",
  "max_sell_loss_pct": "0.1",
  "max_slippage_pct": 5,
  "min_periods": 52,
  "mode": "sim",
  "neutral_rate": "auto",
  "order_adjust_time": 5000,
  "order_poll_time": 5000,
  "order_type": "taker",
  "oversold_rsi": 10,
  "oversold_rsi_periods": 14,
  "period": "15m",
  "period_length": "15m",
  "profit_stop_enable_pct": 0,
  "profit_stop_pct": 1,
  "quarentine_time": 0,
  "rsi_periods": 14,
  "selector": {
    "exchange_id": "kraken",
    "product_id": "DOT-XETH",
    "asset": "DOT",
    "currency": "XETH",
    "normalized": "kraken.DOT-XETH"
  },
  "sell_pct": 99,
  "sell_stop_pct": 1,
  "show_options": true,
  "start": 1611100800000,
  "stats": true,
  "strategy": "trend_ema",
  "symmetrical": false,
  "trend_ema": 36,
  "verbose": true,
  "simresults": {
    "start_capital": 0.1,
    "last_buy_price": "0.0142920000",
    "last_assest_value": 0.011129,
    "asset_capital": 0.0012724658780800002,
    "currency": 0.11058516,
    "profit": 0.10585160000000005,
    "buy_hold": 0.09504654539243318,
    "buy_hold_profit": -0.04953454607566821,
    "total_trades": 12,
    "length_days": 16,
    "total_sells": 6,
    "total_losses": 4,
    "vs_buy_hold": 16.34842649294635
  },
  "net_currency": 0.1093098334784
}
zaventh commented 3 years ago

This appears to have broken kraken.XXBT-ZUSD. Cannot run e.g. backfill, balance, trade, etc. Reverting this commit resolves the issue.