diff --git a/.vs/AACloud/v15/.suo b/.vs/AACloud/v15/.suo index 674c7d248..b25f21ba4 100644 Binary files a/.vs/AACloud/v15/.suo and b/.vs/AACloud/v15/.suo differ diff --git a/Assistant.js b/Assistant.js index 141e5a458..2e8626eb4 100644 --- a/Assistant.js +++ b/Assistant.js @@ -110,6 +110,7 @@ marketRate = candle.close; marketRate = Number(marketRate.toFixed(8)); + context.newHistoryRecord.marketRate = marketRate; /* Now we verify that this candle is not too old. Lets say no more than 10 minutes old. This could happen if the datasets for @@ -153,6 +154,7 @@ marketRate = (candle.open + candle.close) / 2; marketRate = Number(marketRate.toFixed(8)); + context.newHistoryRecord.marketRate = marketRate; /* The Backtest Mode simulates that every trade posted is executed. In order to do this, we will take all open orders from the context and create a trades array similar to the one returned by the Exchange. */ @@ -185,6 +187,7 @@ marketRate = candle.close; marketRate = Number(marketRate.toFixed(8)); + context.newHistoryRecord.marketRate = marketRate; /* Now we verify that this candle is not too old. Lets say no more than 10 minutes old. This could happen if the datasets for @@ -694,6 +697,12 @@ position.status = "executed"; + if (position.type === "sell") { + context.newHistoryRecord.sellExecRate = position.rate; + } else { + context.newHistoryRecord.buyExecRate = position.rate; + } + applyTradesToContext(pTrades); let newTransaction = { @@ -1001,11 +1010,13 @@ if (position.type === 'buy') { context.executionContext.availableBalance.assetA = context.executionContext.availableBalance.assetA - pAmountA; - } + context.newHistoryRecord.lastBuyRate = pRate; + } if (position.type === 'sell') { context.executionContext.availableBalance.assetB = context.executionContext.availableBalance.assetB - pAmountB; + context.newHistoryRecord.lastSellRate = pRate; } callBackFunction(global.DEFAULT_OK_RESPONSE); diff --git a/Context.js b/Context.js index d62e3513e..31bad9185 100644 --- a/Context.js +++ b/Context.js @@ -39,7 +39,11 @@ newHistoryRecord : { date: undefined, buyAvgRate: 0, - sellAvgRate: 0, + sellAvgRate: 0, + lastSellRate: 0, + sellExecRate: 0, + lastBuyRate: 0, + buyExecRate: 0, marketRate: 0, newPositions: 0, newTrades: 0, @@ -607,6 +611,12 @@ thisObject.newHistoryRecord.date.valueOf(), thisObject.newHistoryRecord.buyAvgRate, thisObject.newHistoryRecord.sellAvgRate, + + thisObject.newHistoryRecord.lastSellRate, + thisObject.newHistoryRecord.sellExecRate, + thisObject.newHistoryRecord.lastBuyRate, + thisObject.newHistoryRecord.buyExecRate, + thisObject.newHistoryRecord.marketRate, thisObject.newHistoryRecord.newPositions, thisObject.newHistoryRecord.newTrades,