Fixing trading bot execution

This commit is contained in:
Matias committed 2019-07-01 16:35:49 -03:00
1 parent 60f54bf994
commit ca9dbdeb75
10 files changed
+126 -83

No files matched your search

+4 -10
View File
@@ -2,20 +2,14 @@ const axios = require('axios')
exports.getStrategy = async function () {
try {
let strategyOnlyOnce = true
if (process.env.STRATEGY_ONLY_ONCE !== undefined)
strategyOnlyOnce = JSON.parse(process.env.STRATEGY_ONLY_ONCE)
if (!global.STRATEGY || !strategyOnlyOnce) {
if (!global.STRATEGY) {
let fbSlug = process.env.BOT
if (process.env.TEST_FB !== undefined) {
fbSlug = process.env.TEST_FB
}
const strategizerResponse = await axios({
url: process.env.STRATEGIZER_ENDPOINT || process.env.GATEWAY_ENDPOINT_K8S,
url: process.env.GATEWAY_ENDPOINT_K8S,
method: 'post',
data: {
query: `
@@ -30,7 +24,7 @@ exports.getStrategy = async function () {
},
},
headers: {
access_token: process.env.ACCESS_TOKEN_STRATEGY
authorization: process.env.AUTHORIZATION
}
})
@@ -42,6 +36,6 @@ exports.getStrategy = async function () {
return global.STRATEGY
} catch (error) {
throw new Error('There has been an error getting the strategy: ', error)
throw new Error('There has been an error getting the strategy: ', JSON.stringify(error))
}
}