protocol as name

This commit is contained in:
Luis Fernando Molina committed 2019-05-12 14:44:18 +02:00
1 parent dcec3b93e0
commit ac83fa5f5a
2 files changed
+12 -9

No files matched your search

+7 -4
View File
@@ -3,7 +3,7 @@ function newTradingSystem () {
const MODULE_NAME = 'Trading System'
let thisObject = {
tradingSystem: undefined,
protocolData: undefined,
container: undefined,
getContainer: getContainer,
initialize: initialize,
@@ -26,10 +26,13 @@ function newTradingSystem () {
function finalize () {
destroyStrategyParts()
thisObject.protocolData = undefined
thisObject.container.finalize()
thisObject.container = undefined
}
function initialize (strategies) {
thisObject.tradingSystem = {
thisObject.protocolData = {
strategies: strategies
}
generateStrategyParts()
@@ -80,7 +83,7 @@ function newTradingSystem () {
function generateStrategyParts () {
let lastPhase
let tradingSystem = thisObject.tradingSystem
let tradingSystem = thisObject.protocolData
createPart('Trading System', '', tradingSystem, undefined, undefined)
@@ -171,7 +174,7 @@ function newTradingSystem () {
}
function destroyStrategyParts () {
let strategy = thisObject.tradingSystem
let strategy = thisObject.protocolData
destroyPart(strategy)
destroyPart(strategy.entryPoint)
+5 -5
View File
@@ -63,7 +63,7 @@ function newWorkspace () {
/* Getting the FB that own the Strategies */
let strategySimulationClone = ''
let tradingSystemSimulationClone = ''
let clones = window.localStorage.getItem('userClones')
if (clones === null || clones === '') {
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> no user clones found at local storage. Can not get Strategies without them. ') }
@@ -73,7 +73,7 @@ function newWorkspace () {
for (let i = 0; i < clones.length; i++) {
let clone = clones[i]
if (clone.botType === 'Indicator') {
strategySimulationClone = clone.botSlug
tradingSystemSimulationClone = clone.botSlug
}
}
@@ -96,7 +96,7 @@ function newWorkspace () {
return new Promise((resolve, reject) => {
apolloClient.query({
query: GRAPHQL_QUERY_GET_STRATEGIES,
variables: { fbSlug: strategySimulationClone}
variables: { fbSlug: tradingSystemSimulationClone}
})
.then(response => {
window.localStorage.setItem('userStrategies', JSON.stringify(response.data.strategizer_StrategyByFb.subStrategies))
@@ -128,8 +128,8 @@ function newWorkspace () {
}
function deploydTradingSystem () {
thisObject.strategy = newTradingSystem()
thisObject.strategy.initialize(thisObject.strategies)
thisObject.tradingSystem = newTradingSystem()
thisObject.tradingSystem.initialize(thisObject.strategies)
thisObject.isDeployed = true
}