Backtests Tested and Running with events

This commit is contained in:
Luis Fernando Molina committed 2019-09-12 10:08:23 +02:00
1 parent 028ac61f0d
commit c14b03a25b
3 files changed
+4 -57

No files matched your search

-39
View File
@@ -1,39 +0,0 @@
async function graphQlRestartSimulation (simulationParams) {
try {
const accessToken = window.localStorage.getItem(LOGGED_IN_ACCESS_TOKEN_LOCAL_STORAGE_KEY)
if (accessToken === null) {
throw new Error('Can not restart the simulation because the user is not logged in. ')
}
const graphQLServer = await axios({
url: window.canvasApp.graphQL.masterAppApiUrl,
method: 'post',
data: {
query: `
mutation operations_RunSimulation(
$simulation: operations_SimulationInput)
{
operations_RunSimulation(simulation: $simulation)
}
`,
variables: {
simulation: simulationParams
}
},
headers: {
authorization: 'Bearer ' + accessToken
}
})
if (graphQLServer.data.errors) {
console.log(graphQLServer.data.errors)
throw new Error(graphQLServer.data.errors[0].message)
}
} catch (err) {
console.log(err.stack)
throw new Error('There has been an error restarting the simulation. Error: ' + err.stack)
}
}
@@ -22,6 +22,7 @@ function newTaskFunctions () {
let event = {
taskId: node.id,
taskName: node.name,
definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true)) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager.
}
systemEventHandler.raiseEvent('Task Manager', 'Run Task', event)
@@ -29,7 +30,8 @@ function newTaskFunctions () {
function stopTask (node, functionLibraryProtocolNode) {
let event = {
taskId: node.id
taskId: node.id,
taskName: node.name
}
systemEventHandler.raiseEvent('Task Manager', 'Stop Task', event)
+1 -17
View File
@@ -7,25 +7,9 @@ function getSimulationParams () {
let timePeriodArray = timePeriodsMasterArray[currentTimePeriod.filePeriodIndex]
let timePeriod = timePeriodArray[currentTimePeriod.timePeriodIndex][1]
let timePeriodDailyArray = []
let timePeriodMarketArray = []
switch (currentTimePeriod.filePeriodIndex) {
case 0: {
timePeriodMarketArray.push(timePeriod)
break
}
case 1: {
timePeriodDailyArray.push(timePeriod)
break
}
}
let simulationParams = {
beginDatetime: dateAtScreenCorner.valueOf(),
resumeExecution: false,
timePeriodDailyArray: timePeriodDailyArray,
timePeriodMarketArray: timePeriodMarketArray,
timePeriod: timePeriod,
timestamp: (new Date()).valueOf()
}