New Information Added to newHistoryRecord

This commit is contained in:
Luis Fernando Molina committed 2018-04-29 08:05:39 +02:00
1 parent ee22166c09
commit 0d09841e3d
3 files changed
+23 -2

No files matched your search

Binary file not shown.
+12 -1
View File
@@ -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);
+11 -1
View File
@@ -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,