Refactoring
This commit is contained in:
1 parent
79bff38001
commit
a876a15e42
5 files changed
+9
-9
No files matched your search
@@ -110,7 +110,7 @@ function newRestartSimulation () {
|
||||
try {
|
||||
if (isRunning === false) {
|
||||
thisObject.status = 'Saving'
|
||||
let result = await canvas.strategySpace.strategizerGateway.saveToStrategyzer(getSimulationParams())
|
||||
let result = await canvas.strategySpace.strategizerGateway.saveToStrategyzer(getUICurrentValues())
|
||||
if (result === false) {
|
||||
thisObject.status = 'Error'
|
||||
counterTillNextState = 500
|
||||
@@ -151,7 +151,7 @@ function newRestartSimulation () {
|
||||
|
||||
function getDefinition () {
|
||||
let definitionNode = canvas.strategySpace.workspace.getProtocolDefinitionNode()
|
||||
definitionNode.simulationParams = getSimulationParams()
|
||||
definitionNode.uiCurrentValues = getUICurrentValues()
|
||||
return JSON.stringify(definitionNode)
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ function newStrategizerGateway () {
|
||||
}
|
||||
}
|
||||
|
||||
async function saveToStrategyzer (simulationParams) {
|
||||
async function saveToStrategyzer (uiCurrentValues) {
|
||||
try {
|
||||
const accessToken = window.localStorage.getItem(LOGGED_IN_ACCESS_TOKEN_LOCAL_STORAGE_KEY)
|
||||
if (accessToken === null) {
|
||||
@@ -115,7 +115,7 @@ function newStrategizerGateway () {
|
||||
}
|
||||
|
||||
if (window.canvasApp.executingAt === 'Local') {
|
||||
tradingSystem.simulationParams = simulationParams
|
||||
tradingSystem.uiCurrentValues = uiCurrentValues
|
||||
callServer(JSON.stringify(tradingSystem), 'SaveDefinition', onSaved)
|
||||
function onSaved (err) {
|
||||
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
@@ -19,7 +19,7 @@ function newSessionFunctions () {
|
||||
|
||||
function getDefinition () {
|
||||
let definitionNode = canvas.strategySpace.workspace.getProtocolDefinitionNode()
|
||||
definitionNode.simulationParams = getSimulationParams()
|
||||
definitionNode.uiCurrentValues = getUICurrentValues()
|
||||
return JSON.stringify(definitionNode)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ function newWorkspace () {
|
||||
break
|
||||
case 'Save Trading System':
|
||||
{
|
||||
let result = await canvas.strategySpace.strategizerGateway.saveToStrategyzer(getSimulationParams())
|
||||
let result = await canvas.strategySpace.strategizerGateway.saveToStrategyzer(getUICurrentValues())
|
||||
if (result === true) {
|
||||
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE)
|
||||
} else {
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
|
||||
function getSimulationParams () {
|
||||
function getUICurrentValues () {
|
||||
let dateAtScreenCorner = new Date(window.localStorage.getItem('Date @ Screen Corner'))
|
||||
let currentTimePeriod = JSON.parse(window.localStorage.getItem('Current Time Period'))
|
||||
|
||||
@@ -7,13 +7,13 @@ function getSimulationParams () {
|
||||
let timePeriodArray = timePeriodsMasterArray[currentTimePeriod.filePeriodIndex]
|
||||
let timePeriod = timePeriodArray[currentTimePeriod.timePeriodIndex][1]
|
||||
|
||||
let simulationParams = {
|
||||
let uiCurrentValues = {
|
||||
beginDatetime: dateAtScreenCorner,
|
||||
timePeriod: timePeriod,
|
||||
timestamp: (new Date()).valueOf()
|
||||
}
|
||||
|
||||
return simulationParams
|
||||
return uiCurrentValues
|
||||
}
|
||||
|
||||
function transformThisPoint (point, container) {
|
||||
|
||||
Reference in new issue
Block a user