diff --git a/ChartsSpace/PlottersManager.js b/ChartsSpace/PlottersManager.js index 2fcd09013..47e5c71f7 100644 --- a/ChartsSpace/PlottersManager.js +++ b/ChartsSpace/PlottersManager.js @@ -11,10 +11,11 @@ function newPlottersManager () { let datetime = NEW_SESSION_INITIAL_DATE let thisObject = { + fitFunction: undefined, + container: undefined, setDatetime: setDatetime, setTimePeriod: setTimePeriod, positionAtDatetime: positionAtDatetime, - container: undefined, draw: draw, getContainer: getContainer, initialize: initialize, @@ -180,6 +181,7 @@ function newPlottersManager () { let bot = ecosystem.getBot(devTeam, participant.bot) participant.profilePicture = bot.profilePicture } + plotter.fitFunction = thisObject.fitFunction plotter.initialize(competition, storage, datetime, timePeriod, onPlotterInizialized) function onPlotterInizialized (err) { @@ -350,6 +352,7 @@ function newPlottersManager () { plotter.container.connectToParent(thisObject.container, true, true, false, true, true, true) plotter.container.frame.position.x = thisObject.container.frame.width / 2 - plotter.container.frame.width / 2 plotter.container.frame.position.y = thisObject.container.frame.height / 2 - plotter.container.frame.height / 2 + plotter.fitFunction = thisObject.fitFunction plotter.initialize(storage, exchange, market, datetime, timePeriod, onPlotterInizialized) function onPlotterInizialized () { diff --git a/ChartsSpace/TimelineChart.js b/ChartsSpace/TimelineChart.js index bce46cf18..82a09b62c 100644 --- a/ChartsSpace/TimelineChart.js +++ b/ChartsSpace/TimelineChart.js @@ -132,6 +132,7 @@ function newTimelineChart () { plotterManager.container.frame.position.x = 0 plotterManager.container.frame.position.y = 0 + plotterManager.fitFunction = thisObject.fitFunction plotterManager.initialize(productsPanel, pExchange, pMarket, onPlotterManagerReady) function onPlotterManagerReady (err) { diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 36ff2214e..26db512ec 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -274,19 +274,27 @@ function newStrategizerGateway () { /* Getting the FB that own the Strategies */ - let tradingSystemSimulationClone = '' - let clones = window.localStorage.getItem('userClones') - if (clones === null || clones === '') { - if (ERROR_LOG === true) { logger.write('[ERROR] loadFromStrategyzer -> no user clones found at local storage. Can not get Strategies without them. ') } + let teamtradingSystemSimulationFB = '' + let teams = window.localStorage.getItem('userTeams') + if (teams === null || teams === '' || teams === []) { + if (ERROR_LOG === true) { logger.write('[ERROR] loadFromStrategyzer -> no user teams found at local storage. Can not get Strategies without them. ') } return } - clones = JSON.parse(clones) - for (let i = 0; i < clones.length; i++) { - let clone = clones[i] - if (clone.botType === 'Indicator') { - tradingSystemSimulationClone = clone.botSlug + teams = JSON.parse(teams) + for (let i = 0; i < teams.length; i++) { + let team = teams[i] + for (let j = 0; j < team.fb.length; j++) { + let fb = team.fb[j] + if (fb.slug.indexOf('simulator') >= 0) { + teamtradingSystemSimulationFB = fb.slug + } } } + + if (teamtradingSystemSimulationFB === '') { + if (ERROR_LOG === true) { logger.write('[ERROR] loadFromStrategyzer -> no simulation FB found at user teams. ') } + return + } /* Getting all Strategies */ const networkInterface = Apollo.lib.createNetworkInterface({ @@ -306,7 +314,7 @@ function newStrategizerGateway () { return new Promise((resolve, reject) => { apolloClient.query({ query: GRAPHQL_QUERY_GET_STRATEGIES, - variables: { fbSlug: tradingSystemSimulationClone} + variables: { fbSlug: teamtradingSystemSimulationFB} }) .then(response => { window.localStorage.setItem('userStrategies', JSON.stringify(response.data.strategizer_StrategyByFb))