Bug Fixed with Initial Balance
This commit is contained in:
1 parent
0617c83207
commit
92883afa17
3 files changed
+16
-15
No files matched your search
+2
-2
@@ -306,8 +306,8 @@
|
||||
|
||||
if (bot.VALUES_TO_USE.initialBalanceA === undefined || bot.VALUES_TO_USE.initialBalanceB === undefined) { throw new Error("Global Variables INITIAL_BALANCE_A and INITIAL_BALANCE_B cannot be undefined.") }
|
||||
|
||||
const INITIAL_BALANCE_A = Number(bot.VALUES_TO_USE.initialBalanceA);
|
||||
const INITIAL_BALANCE_B = Number(bot.VALUES_TO_USE.initialBalanceB);
|
||||
const INITIAL_BALANCE_A = Number(bot.VALUES_TO_USE.initialBalanceB); // NOTE THAT THIS IS INVERTED BECAUSE OF POLONIEX THAT IS THE ONLY EXCHANGE SUPPORTED RIGHT NOW
|
||||
const INITIAL_BALANCE_B = Number(bot.VALUES_TO_USE.initialBalanceA);
|
||||
|
||||
|
||||
thisObject.executionContext = {
|
||||
|
||||
+11
-11
@@ -102,12 +102,12 @@
|
||||
/* Set all default values */
|
||||
bot.VALUES_TO_USE = {
|
||||
baseAsset: "BTC",
|
||||
initialBalanceA: 0,
|
||||
initialBalanceB: 0.001,
|
||||
minimumBalanceA: 0,
|
||||
minimumBalanceB: 0.0005,
|
||||
maximumBalanceA: 0,
|
||||
maximumBalanceB: 0.002,
|
||||
initialBalanceA: 0.001,
|
||||
initialBalanceB: 0,
|
||||
minimumBalanceA: 0.0005,
|
||||
minimumBalanceB: 0,
|
||||
maximumBalanceA: 0.002,
|
||||
maximumBalanceB: 0,
|
||||
timePeriod: bot.DEFINITION.uiCurrentValues.timePeriod,
|
||||
slippage: {
|
||||
positionRate: 0,
|
||||
@@ -157,10 +157,10 @@
|
||||
bot.VALUES_TO_USE.baseAsset = code.name;
|
||||
}
|
||||
|
||||
if (baseAsset === 'BTC') { // NOTE: POLONIEX, the only exchange working so far, has Asset A and B inverted. We need to fix this.
|
||||
if (baseAsset === 'BTC') {
|
||||
if (code.initialBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.initialBalanceB = code.initialBalance;
|
||||
bot.VALUES_TO_USE.initialBalanceA = 0
|
||||
bot.VALUES_TO_USE.initialBalanceA = code.initialBalance;
|
||||
bot.VALUES_TO_USE.initialBalanceB = 0
|
||||
}
|
||||
if (code.minimumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.minimumBalanceA = code.minimumBalance;
|
||||
@@ -172,8 +172,8 @@
|
||||
}
|
||||
} else {
|
||||
if (code.initialBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.initialBalanceA = code.initialBalance;
|
||||
bot.VALUES_TO_USE.initialBalanceB = 0
|
||||
bot.VALUES_TO_USE.initialBalanceB = code.initialBalance;
|
||||
bot.VALUES_TO_USE.initialBalanceA = 0
|
||||
}
|
||||
if (code.minimumBalance !== undefined) {
|
||||
bot.VALUES_TO_USE.minimumBalanceB = code.minimumBalance;
|
||||
|
||||
@@ -62,16 +62,17 @@ of this Task and know exactly what to run within this server instance.
|
||||
global.TASK_NODE = process.argv[2]
|
||||
|
||||
if (global.TASK_NODE !== undefined) {
|
||||
console.log('[INFO] Task Server -> server -> global.TASK_NODE = ' + global.TASK_NODE)
|
||||
|
||||
try {
|
||||
global.TASK_NODE = JSON.parse(global.TASK_NODE)
|
||||
console.log('[INFO] Task Server -> server -> global.TASK_NODE = ' + JSON.stringify(global.TASK_NODE))
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Task Server -> server -> global.TASK_NODE -> ' + err.stack)
|
||||
}
|
||||
|
||||
}
|
||||
else { // I use this section to debug in standalone mode.
|
||||
let argument = '{"type":"Task","name":"Runs Backtests, Fordwardtests & Live Trades ","bot":{"type":"Trading Engine","processes":[{"type":"Process","subType":"Trading Engine Process","name":"Multi Period","code":{"team":"AAMasters","bot":"AAJason","process":"Multi-Period","repo":"AAJason-Trading-Engine-Bot"},"session":{"type":"Backtesting Session","name":"New Backtesting Session","parameters":{"type":"Parameters","name":"Parameters","baseAsset":{"type":"Base Asset","name":"Base Asset","code":"{ \n\"name\": \"BTC\",\n\"initialBalance\": 0.001,\n\"minimumBalance\": 0.0001,\n\"maximumBalance\": 1\n}"},"timeRange":{"type":"Time Range","name":"Time Range","code":"{\n\"initialDatetime\": \"2019-09-15T00:00:00.000Z\",\n\"finalDatetime\": \"2019-09-30T00:00:00.000Z\"\n}"},"timePeriod":{"type":"Time Period","name":"Time Period","code":"01-hs"},"slippage":{"type":"Slippage","name":"Slippage","code":"{\n\"positionRate\": 0.1,\n\"stopLoss\": 0.1,\n\"takeProfit\": 0.1\n}"},"feeStructure":{"type":"Fee Structure","name":"Fee Structure","code":"{\n\"maker\": 0.15,\n\"taker\": 0.25\n}"}},"id":"1381b048-7795-4e60-84a4-cf02e7385ba1"},"id":"072065fc-a57c-439c-94cf-f3f9c901ed37"}]},"id":"cddc97dd-ca2d-4b14-95ce-f15b6149996f"}'
|
||||
let argument = ' {"type":"Task","name":"Runs Backtests, Fordwardtests & Live Trades ","bot":{"type":"Trading Engine","processes":[{"type":"Process","subType":"Trading Engine Process","name":"Multi Period","code":{"team":"AAMasters","bot":"AAJason","process":"Multi-Period","repo":"AAJason-Trading-Engine-Bot"},"session":{"type":"Backtesting Session","name":"1 Hour","id":"1381b048-7795-4e60-84a4-cf02e7385ba1"},"id":"072065fc-a57c-439c-94cf-f3f9c901ed37"}]},"id":"cddc97dd-ca2d-4b14-95ce-f15b6149996f"}'
|
||||
/* charly argument = '{"type":"Task","name":"Brings Trades Records from the Exchange","bot":{"type":"Sensor","name":"Charly","processes":[{"type":"Process","name":"Live Trades","code":{"team":"AAMasters","bot":"AACharly","process":"Live-Trades"},"id":"5846ebc7-1979-4a80-9cc7-94bb4b8659dc"},{"type":"Process","name":"Hole Fixing","code":{"team":"AAMasters","bot":"AACharly","process":"Hole-Fixing"},"id":"31fc4f05-75d4-419a-9fb0-73e25e856f15"}]},"id":"5bfef4dc-54c1-44db-ace6-1ab27a86746e"}'
|
||||
// olivia argument = '{"type":"Task","name":"Generates 1 min to 24 hs Candles & Volumes","bot":{"type":"Indicator","name":"Olivia","processes":[{"type":"Process","name":"Daily","code":{"team":"AAMasters","bot":"AAOlivia","process":"Multi-Period-Daily"},"id":"68cc8e1b-e94a-477e-82d0-15ecc9f1b9e2"},{"type":"Process","name":"Market","code":{"team":"AAMasters","bot":"AAOlivia","process":"Multi-Period-Market"},"id":"e1ac5e3d-d491-4e90-baf4-d4e5b71a8b1a"}]},"id":"efe36e05-75ea-41b5-8d92-c6b27635c834"}'
|
||||
// bruce argument = ' {"type":"Task","name":"Converts Trades into 1 min Candles & Volumes","bot":{"type":"Indicator","name":"Bruce","processes":[{"type":"Process","name":"New Process","code":{"team":"AAMasters","bot":"AABruce","process":"Single-Period-Daily"},"id":"e184744f-5de0-41c1-ad4c-36960f4ced90"}]},"id":"42758590-a7bd-4712-a5c9-80a3a820c5b3"}'
|
||||
|
||||
Reference in new issue
Block a user