Integration with saweb
This commit is contained in:
1 parent
b2f3990edf
commit
a4dbcfd25c
4 files changed
+35
-129
No files matched your search
+2
-46
@@ -1,5 +1,4 @@
|
||||
const axios = require('axios')
|
||||
const auth = require('./utils/auth')
|
||||
const strategy = require('./Integrations/Strategy')
|
||||
|
||||
exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
@@ -70,7 +69,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] runSimulation -> Entering function."); }
|
||||
|
||||
let tradingSystem = await getTradingSystem();
|
||||
let tradingSystem = await strategy.getStrategy();
|
||||
|
||||
/* Initial Default Values */
|
||||
|
||||
@@ -1837,49 +1836,6 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) {
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
async function getTradingSystem() {
|
||||
|
||||
try {
|
||||
|
||||
const accessToken = await auth.authenticate()
|
||||
|
||||
let fbSlug = bot.codeName
|
||||
if (process.env.TEST_FB !== undefined) {
|
||||
fbSlug = process.env.TEST_FB
|
||||
}
|
||||
|
||||
const strategizerResponse = await axios({
|
||||
url: process.env.GATEWAY_ENDPOINT,
|
||||
method: 'post',
|
||||
data: {
|
||||
query: `
|
||||
query($fbSlug: String!){
|
||||
strategizer_TradingSystemByFb(fbSlug: $fbSlug){
|
||||
id
|
||||
fbSlug
|
||||
data
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
fbSlug: fbSlug
|
||||
},
|
||||
},
|
||||
headers: {
|
||||
authorization: 'Bearer ' + accessToken
|
||||
}
|
||||
})
|
||||
|
||||
if (strategizerResponse.data.errors)
|
||||
throw new Error(strategizerResponse.data.errors[0].message)
|
||||
|
||||
return strategizerResponse.data.data.strategizer_TradingSystemByFb.data;
|
||||
|
||||
} catch (error) {
|
||||
throw new Error('There has been an error getting the strategy to run on the simulator. Error: ' + error)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user