From 648885d3b0bf201700d71223669e470113fb12ca Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 4 Jun 2019 16:00:17 +0200 Subject: [PATCH] Reading Protocol v.0.1 --- Commons.js | 95 ++++++------------------------------------------------ 1 file changed, 9 insertions(+), 86 deletions(-) diff --git a/Commons.js b/Commons.js index 3b4ac69a5..124256778 100644 --- a/Commons.js +++ b/Commons.js @@ -256,7 +256,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { } - simulationLogic.strategies = await getStrategy(); + simulationLogic.strategies = await getStrategies(); /* Main Simulation Loop: We go thourgh all the candles at this time period. */ @@ -1331,7 +1331,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { } } - async function getStrategy() { + async function getStrategies() { try { @@ -1347,90 +1347,13 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { method: 'post', data: { query: ` - query($fbSlug: String!){ - - strategizer_StrategyByFb(fbSlug: $fbSlug){ - subStrategies(activeOnly: true){ - name - entryPoint{ - situations{ - name - conditions{ - name - code - } - } - } - exitPoint{ - situations{ - name - conditions{ - name - code - } - } - } - sellPoint{ - situations{ - name - conditions{ - name - code - } - } - } - buyPoint{ - situations{ - name - conditions{ - name - code - } - } - } - stopLoss{ - phases{ - name - code - situations{ - name - conditions{ - name - code - } - } - } - } - buyOrder{ - phases{ - name - code - situations{ - name - conditions{ - name - code - } - } - } - } - sellOrder{ - phases{ - name - code - situations{ - name - conditions{ - name - code - } - } - } - } + query($fbSlug: String!){ + strategizer_TradingSystemByFb(fbSlug: $fbSlug){ + id + fbSlug + data + } } - } - } - `, variables: { fbSlug: fbSlug @@ -1444,7 +1367,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { if (strategizerResponse.data.errors) throw new Error(strategizerResponse.data.errors[0].message) - return strategizerResponse.data.data.strategizer_StrategyByFb.subStrategies; + return strategizerResponse.data.data.strategizer_TradingSystemByFb.data.strategies; } catch (error) { throw new Error('There has been an error getting the strategy to run on the simulator. Error: ' + error)