Browse Source

Merge pull request #2 from ignatisD/PR-fix-paperTrader

Updated PaperTrader updatePosition method
develop
Mark Sch 1 year ago
committed by GitHub
parent
commit
bd3c070a98
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      plugins/paperTrader/paperTrader.js

+ 3
- 3
plugins/paperTrader/paperTrader.js View File

@ -90,12 +90,12 @@ PaperTrader.prototype.updatePosition = function(what) {
this.trades++;
}
// virtually trade all {currency} to {asset}
// virtually trade all {asset} to {currency}
// at the current price (minus fees)
else if(what === 'short') {
cost = (1 - this.fee) * (this.portfolio.asset * this.price);
amount = this.portfolio.asset;
this.portfolio.currency += this.extractFee(this.portfolio.asset * this.price);
amount = this.portfolio.currency / this.price;
this.portfolio.asset = 0;
this.exposed = false;
@ -186,7 +186,7 @@ PaperTrader.prototype.processAdvice = function(advice) {
origin: advice.origin,
infomsg: advice.infomsg,
setTakerLimit: advice.setTakerLimit,
portfolio: this.portfolio,
portfolio: _.clone(this.portfolio),
balance: this.getBalance(),
date: advice.date,
effectivePrice,

Loading…
Cancel
Save