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

+71
View File
@@ -0,0 +1,71 @@
const axios = require('axios')
exports.getEcosystem = async function () {
try {
if (!global.ECOSYSTEM) {
const ecosystemResponse = await axios({
url: process.env.GATEWAY_ENDPOINT_K8S,
method: 'post',
data: {
query: `
query {
web_GetEcosystem {
id
devTeams {
codeName
displayName
host {
url
storage
container
accessKey
}
bots {
codeName
displayName
type
profilePicture
repo
configFile
products{
codeName
displayName
description
dataSets{
codeName
type
validPeriods
filePath
fileName
dataRange{
filePath
fileName
}
}
exchangeList{
name
}
}
}
}
}
}
`
},
headers: {
authorization: process.env.AUTHORIZATION
}
})
//TODO Competition hosts not retrieved currently
if (ecosystemResponse.data.errors)
throw new Error(ecosystemResponse.data.errors[0].message)
global.ECOSYSTEM = ecosystemResponse.data.data.web_GetEcosystem;
}
return global.ECOSYSTEM
} catch (error) {
throw new Error('There has been an error getting the Ecosystem: ', error)
}
}