Container support
Changes required to accepts parameters and run the bots on the virtual machine.
This commit is contained in:
1 parent
f58a9f76a5
commit
6135d516db
16 files changed
+637
-182
No files matched your search
@@ -0,0 +1,59 @@
|
||||
const axios = require('axios')
|
||||
const appRoot = require('app-root-path')
|
||||
const { logger } = require(`${appRoot}/utils/logger`)
|
||||
const auth = require(`${appRoot}/utils/auth`)
|
||||
|
||||
exports.updateExecutionResults = async function (summaryDate, buyAverage, sellAverage,
|
||||
marketRate, combinedProfitsA, combinedProfitsB) {
|
||||
|
||||
logger.debug('updateExecutionResults -> Entering Function.')
|
||||
|
||||
try {
|
||||
|
||||
const authResponse = await auth.authenticate()
|
||||
|
||||
const operationsResponse = await axios({
|
||||
url: process.env.GATEWAY_ENDPOINT,
|
||||
method: 'post',
|
||||
data: {
|
||||
query: `
|
||||
mutation($id: ID!, $summaryDate: Int!, $buyAverage: Float!, $sellAverage: Float!,
|
||||
$marketRate: Float!, $combinedProfitsA: Float!, $combinedProfitsB: Float!,
|
||||
$assetA: String!, $assetB: String!){
|
||||
operations_UpdateExecutionSummary(
|
||||
id: $id,
|
||||
summaryDate: $summaryDate,
|
||||
buyAverage: $buyAverage,
|
||||
sellAverage: $sellAverage,
|
||||
marketRate: $marketRate,
|
||||
combinedProfitsA: $combinedProfitsA,
|
||||
combinedProfitsB: $combinedProfitsB,
|
||||
assetA: $assetA,
|
||||
assetB: $assetB
|
||||
)
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
id: process.env.CLONE_ID,
|
||||
summaryDate: summaryDate,
|
||||
buyAverage: buyAverage,
|
||||
sellAverage: sellAverage,
|
||||
marketRate: marketRate,
|
||||
combinedProfitsA: combinedProfitsA,
|
||||
combinedProfitsB: combinedProfitsB,
|
||||
assetA: global.MARKET.assetA,
|
||||
assetB: global.MARKET.assetB
|
||||
},
|
||||
},
|
||||
headers: {
|
||||
authorization: 'Bearer ' + authResponse.data.access_token
|
||||
}
|
||||
})
|
||||
|
||||
logger.debug('updateExecutionResults -> Operations Module Response: %s', operationsResponse.data.data.operations_UpdateExecutionSummary)
|
||||
|
||||
} catch (error) {
|
||||
logger.error('updateExecutionResults -> Error: ' + error.stack)
|
||||
throw new Error('There has been an error updating the execution report: ' + error)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user