095% partial trading implementation on backtesting side effects
#1
Hi everybody,
on papertrade and livetrade Gekko always buys asset using only the 95% of your total balance.
The reason why this is necessary it's clear --> https://github.com/askmike/gekko/issues/2434

The inconsistency I tried to solve regards the backtesting function, beacuse it assumes you always trade the 100% of your balance. So the backtesting "brain" works differently from the papertrade and live trade "brain". The side effect is in the image attached: in this particular case there is an overestimation of the results by the backtesting function. I didn't considered fees for the sake of simplicity. 
Now we got a slight overestimation of the total profit, but we got just 3 roundtrips... what would happen if we would have thousands of them?? 


.jpg   Image.jpg (Size: 78.84 KB / Downloads: 5)

So i modified the plugins\paperTrade.js file and I put a 0.95 factor at line 83 and 84, in order to make the backtesting "brain" working as the livetrade/papertrade one.
 
My question is: do you think am I messing up/forgetting something else?


Code:
cost = (1 - this.fee) * this.portfolio.currency * 0.95;
   this.portfolio.asset += this.extractFee(this.portfolio.currency/ this.price) * 0.95;
   amount = this.portfolio.asset;
   this.portfolio.currency = 0;

Hope this is gonna be helpful also for other people that are not aware of this 0.95 stuff.
Thanks!
  Reply


Messages In This Thread
095% partial trading implementation on backtesting side effects - by Piff_Sara - 02-10-2019, 12:05 PM

Forum Jump:


Users browsing this thread: