Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Backtesting ? #358

Closed
ghostnegotiator opened this issue Jun 30, 2016 · 13 comments
Closed

Backtesting ? #358

ghostnegotiator opened this issue Jun 30, 2016 · 13 comments

Comments

@ghostnegotiator
Copy link

ghostnegotiator commented Jun 30, 2016

Hello there,

Currently I am wondering how far the back testing has been tested & measured. As for my self I am fiddling around with it and its quite hard to believe the following values.

2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) start time:                      2016-06-01 22:49:00
2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) end time:                        2016-06-27 23:51:00
2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) timespan:                        a month days

2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) start price:                     0.0260104
2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) end price:                       0.02145845
2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) Buy and Hold profit:             -17.500500000000002%

2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) amount of trades:                823
2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) original simulated balance:      0.04000 BTC
2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) current simulated balance:       0.39447 BTC
2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) simulated profit:                0.35447 BTC (886.18082%)
2016-06-30 08:17:30 (INFO):     (PROFIT REPORT) simulated yearly profit:         4.96802 BTC (12420.04804%)

Exchange:
Poloniex

Alchorhytm: StochRSI

CandleSize: 5

Settings:

// StochRSI settings
config.StochRSI = {
  interval: 3,
  thresholds: {
    low: 28,
    high: 59,
    // How many candle intervals should a trend persist
    // before we consider it real?
    persistence: 3
  }
};
@askmike
Copy link
Owner

askmike commented Jun 30, 2016

Hey, thanks for reporting backtesting results! I did some testing under different variables and I did not find any extraordinary results.

Those profits look (maybe too) great!, could you please post the configuration of the profitSimulator? I am pretty sure 823 trades in a month would drain any account via fees.

@ghostnegotiator
Copy link
Author

ghostnegotiator commented Jun 30, 2016

Heya! Your most welcome!

Here are the Profit Simulator settings:

  // do you want Gekko to calculate the profit of its own advice?
 config.profitSimulator = {
   enabled: true,
   // report the profit in the currency or the asset?
   reportInCurrency: true,
   // start balance, on what the current balance is compared with
   simulationBalance: {
     // these are in the unit types configured in the watcher.
     asset: 0,
     currency: 0.04,
   },
   // only want report after a sell? set to `false`.
   verbose: false,
   // how much fee in % does each trade cost?
   fee: 0.25,
   // how much slippage/spread should Gekko assume per trade?
   slippage: 0.05
 }

Apparently it buys high and sells low...

2016-06-30 10:40:11       Sell  0.01876000     2.01008485   0.03770919
2016-06-30 10:05:09       Buy   0.01908130     1.85512265   0.03539815

@ghostnegotiator
Copy link
Author

Regarding the profit simulator settings, I am actually making loss on it which is a few BTC Each trade.

Started on the Exchange with 0.04 and currently at 0.036 so there is some thing that indicates some thing wrong. As far from what I have checked/seen so far is that its actually a -17% Loss over a month which is indicated on the top at the 'Buy and Hold' profit.

@askmike
Copy link
Owner

askmike commented Jun 30, 2016

So I want to run the same test as you so I can figure this out, could you:

  • let me know what market you were backtesting on?
  • send me the full logs (all 2016-06-30 10:40:11 Sell 0.01876000 2.01008485 0.03770919 messages).
  • tell me how you obtained the market data (assuming through Gekko's importer?)

Thanks!

@ghostnegotiator
Copy link
Author

Sure thing,

Unfortunately I got tackled by my 10 months old niece, will supply them shortly. The market I am using is BTC/ETH.

Making a fresh import and giving the fresh backtest in ~10 Minutes.

@ghostnegotiator
Copy link
Author

Here we go:
Configuration is exactly the same as submitted earlyer and I have used the internal importer tool.

Settings (from config.js)

// Monitor the live market
config.watch = {
  exchange: 'poloniex', // see gekko/docs/supported_exchanges.md
  currency: 'BTC',
  asset: 'ETH'
}

Trading ADvisor

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//                       CONFIGURING TRADING ADVICE
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

config.tradingAdvisor = {
  enabled: true,
  method: 'StochRSI',
  candleSize: 6,
  historySize: 25,
  adapter: 'sqlite',
  talib: {
    enabled: true,
    version: '1.0.2'
  }
}

StochRSI Settings

// StochRSI settings
config.StochRSI = {
  interval: 3,
  thresholds: {
    low: 28,
    high: 59,
    // How many candle intervals should a trend persist
    // before we consider it real?
    persistence: 3
  }
};

The output can be found:
https://gist.github.com/RDash21/790e67abc7c000af8bd21ef514e870de

@askmike
Copy link
Owner

askmike commented Jun 30, 2016

Oh damn, that is a big output (I always run a full backtest, say more than 2 hours, with debug turned off), but that will definitely help me figure this out. Going to look at it!

@ghostnegotiator
Copy link
Author

Debug is turned off and this backtest is based of a Month ¯_(ツ)_/¯

@ghostnegotiator
Copy link
Author

ghostnegotiator commented Jun 30, 2016

Giving a good pull and be updating it, will verify it in a bit.

@ghostnegotiator
Copy link
Author

Update:
Apparently it gives still the same out put regardless of debug on/off.

Question:
Is this a bug I have hit or is this information valid?

-Dash

@ghostnegotiator
Copy link
Author

Update:
Put the candle size from 6 to 80 which made allot more sense:

Output:

2016-06-30 15:01:19 (INFO):     Profit simulator got advice to short    @ 2016-06-28 23:22:00, selling 3.05656084 ETH

2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) start time:                      2016-06-01 22:49:00
2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) end time:                        2016-06-29 00:01:00
2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) timespan:                        a month days

2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) start price:                     0.0260104
2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) end price:                       0.01879273
2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) Buy and Hold profit:             -27.749170000000007%

2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) amount of trades:                49
2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) original simulated balance:      0.04000 BTC
2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) current simulated balance:       0.05689 BTC
2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) simulated profit:                0.01689 BTC (42.22540%)
2016-06-30 15:01:19 (INFO):     (PROFIT REPORT) simulated yearly profit:         0.22791 BTC (569.76972%)

@askmike
Copy link
Owner

askmike commented Jun 30, 2016

Hey @RDash21,

I finally had some time to look at all the moving pieces:

Apparently it gives still the same out put regardless of debug on/off.

This was a bug in the trading method and is fixed now. I overall refactored and fixed some bugs in the stochRSI code.

its quite hard to believe the following values.

I fixed a major bug in the backtesting code (I need more unit tests!), running a very similar backtest (using a candleSize of 6, from 2016-06-01 22:49:00 to 2016-06-25 23:51:00) now yields:

2016-06-30 22:12:05 (INFO): (PROFIT REPORT) amount of trades:    390
2016-06-30 22:12:05 (INFO): (PROFIT REPORT) original simulated balance:  100.02601 BTC
2016-06-30 22:12:05 (INFO): (PROFIT REPORT) current simulated balance:   24.78887 BTC
2016-06-30 22:12:05 (INFO): (PROFIT REPORT) simulated profit:    -75.23714 BTC (-75.21758%)
2016-06-30 22:12:05 (INFO): (PROFIT REPORT) simulated yearly profit:   -1142.14953 BTC (-1141.85253%)

Could you please update gekko, test again and let me know the results?

@askmike askmike closed this as completed Jun 30, 2016
@ghostnegotiator
Copy link
Author

2016-07-01 03:54:22 (INFO):     (PROFIT REPORT) amount of trades:                897                                             
2016-07-01 03:54:22 (INFO):     (PROFIT REPORT) original simulated balance:      0.04000 BTC                                     
2016-07-01 03:54:22 (INFO):     (PROFIT REPORT) current simulated balance:       0.00887 BTC                                     
2016-07-01 03:54:22 (INFO):     (PROFIT REPORT) simulated profit:                -0.03113 BTC (-77.82191%)                       
2016-07-01 03:54:22 (INFO):     (PROFIT REPORT) simulated yearly profit:         -0.42080 BTC (-1052.00992%)

Good morning,

Yes! It is fixed now! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants