diff --git a/Dashboard.js b/Dashboard.js index 94896fc5c..4e69b50cb 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -1,8 +1,16 @@ -  let canvas let markets let ecosystem = newEcosystem() -let viewPort = newViewPort() + +let viewPort +try { + viewPort = newViewPort() +} catch (e) { + setTimeout(() => { + console.log("Loading deferred.") + viewPort = newViewPort() + }, 1000); +} function newDashboard () { const MODULE_NAME = 'Dashboard' diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 01cf93ce4..958183d4c 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -61,6 +61,9 @@ function newProductsPanel () { /* First thing is to build the thisObject.productCards array */ let ecosystem = JSON.parse(window.localStorage.getItem('ecosystem')) + if (ecosystem === null || ecosystem === undefined) { + ecosystem = getUserEcosystem() + } for (let i = 0; i < ecosystem.devTeams.length; i++) { let devTeam = ecosystem.devTeams[i] diff --git a/README.md b/README.md index ec0209a30..5acae3fca 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ The Canvas App provides a visual environment for the _Charting System_ and the _ # Trading System Automation Demo -Use the latest Chrome version to [access the Demo](https://demo.superalgos.org), sign up, log in and click on the CHARTS link in the Menu. +Use the latest Chrome version to access the Demo (to become available soon), sign up, log in and click on the CHARTS link in the Menu. ![Access-Demo](https://user-images.githubusercontent.com/13994516/58415158-dbe50f00-807d-11e9-812c-3b4de503bc34.gif)

@@ -198,7 +198,10 @@ In the example above, conditions A and B are mathematical comparison statements **candle.close:** The latest price of the current candle. -**candle.direction:** Down: candle.close > candle.open | Up: candle.close < candle.open | Side: candle.close = candle.open +**candle.direction:** +* Down: candle.close > candle.open +* Up: candle.close < candle.open +* Side: candle.close = candle.open **candle.previous:** Refers to the previous candle. You may use _candle.previous_ to fetch any of the variables of the previous candle (i.e.: _candle.previous.close_). You may also use as many _.previous_ as required to fetch values of more than one period behind the current one (i.e.: _candle.previous.previous.max_ returns the maximum value of two candles before the current one). @@ -234,81 +237,51 @@ In the example above, conditions A and B are mathematical comparison statements ### Bollinger Channels -**bollingerChannel.begin:** - -**bollingerChannel.end:** - **bollingerChannel.direction (Down | Up | Side):** -**bollingerChannel.period:** - -**bollingerChannel.firstMovingAverage:** - -**bollingerChannel.lastMovingAverage:** - -**bollingerChannel.firstDeviation:** - -**bollingerChannel.lastDeviation:** - -**bollingerChannel.previous:** +**bollingerChannel.period:** The number of periods the channel spans at the moment the variable is being read. For instance, if a channel spans 10 candles and the variable is checked on the fourth candle, then _bollingerChannel.period_ = 4. Put in other words, it is the current span of the channel. ### Bollinger SubChannels -**bollingerSubChannel.begin:** - -**bollingerSubChannel.end:** - **bollingerSubChannel.direction (Down | Up | Side):** -**bollingerSubChannel.slope (Steep | Medium | Gentle | Side):** - -**bollingerSubChannel.period:** - -**bollingerSubChannel.firstMovingAverage:** - -**bollingerSubChannel.lastMovingAverage:** - -**bollingerSubChannel.firstDeviation:** - -**bollingerSubChannel.lastDeviation:** - -**bollingerSubChannel.previous:** +**bollingerSubChannel.period:** The number of periods the subchannel spans at the moment the variable is being read. For instance, if a subchannel spans 10 candles and the variable is checked on the fourth candle, then _bollingerChannel.period_ = 4. Put in other words, it is the current span of the subchannel. ### Internal **strategyStage (No Stage | Trigger Stage | Open Stage | Manage Stage | Close Stage):** -**stopLoss:** +**stopLoss:** The value of your Stop in the active phase. -**stopLossPhase (0 | 1 | ...):** +**stopLossPhase (0 | 1 | ...):** The number of the active Stop phase. -**takeProfit:** +**takeProfit:** The value of the Take Profit in the active phase. -**takeProfitPhase:** +**takeProfitPhase:** The number of the active Stop phase. -**positionRate:** +**positionRate:** The price at which the position was taken. -**positionSize:** +**positionSize:** The size of the position. -**positionInstant:** +**positionInstant:** The datetime in which the position was taken. -**balanceAssetA:** +**balanceAssetA:** The balance of your _base asset_. -**balanceAssetB:** +**balanceAssetB:** The balance of the second asset. -**lastTradeProfitLoss:** +**lastTradeProfitLoss:** The P&L value for the latest completed trade (roundtrip). -**lastTradeROI:** +**lastTradeROI:** The ROI of your latest trade. -**profit:** +**profit:** The total P&L during the current execution period. -**roundtrips:** +**roundtrips:** The total number of trades in the current execution. -**fails:** +**fails:** The number of trades resulting in losses in the current execution. -**hits:** +**hits:** The number of trades resulting in profits in the current execution. -**periods:** +**periods:** The number of candles evaluated in the current execution. ## Maintainer diff --git a/Spaces/TopSpace.js b/Spaces/TopSpace.js index 9bb7e57b8..c67effb91 100644 --- a/Spaces/TopSpace.js +++ b/Spaces/TopSpace.js @@ -41,7 +41,9 @@ function newTopSpace () { thisObject.container.frame.height = TOP_SPACE_HEIGHT container.frame.position.x = 0 - container.frame.position.y = viewPort.visibleArea.bottomLeft.y + try { + container.frame.position.y = viewPort.visibleArea.bottomLeft.y + } catch(e) { } } function getContainer (point) { diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 96c28b5b0..589ff517e 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -46,7 +46,7 @@ function newStrategizerGateway () { } user = JSON.parse(user) - let fbSlug = 'simulator' + '-' + user.alias.replace('.', '') + let fbSlug = 'simulator-bot-' + user.alias.replace('.', '') graphQLServer = await axios({ url: window.canvasApp.graphQL.masterAppApiUrl, @@ -101,7 +101,6 @@ function newStrategizerGateway () { } user = JSON.parse(user) - let fbSlug = 'simulator' + '-' + user.alias.replace('.', '') /* See if we need to update or create a new record at the strategizer */ diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index 0c1e74d87..143dac4a9 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -59,8 +59,8 @@ function newWorkspace () { } user = JSON.parse(user) - let idAtStrategizer = window.localStorage.getItem(CANVAS_APP_NAME + '.' + 'Strategizer Gateway' + '.' + user.alias) - let savedWorkspace = window.localStorage.getItem(CANVAS_APP_NAME + '.' + 'Workspace' + '.' + user.alias) + let idAtStrategizer = null + let savedWorkspace = null if (savedWorkspace === null || idAtStrategizer === null) { workspaceNode.type = 'Workspace' diff --git a/index.js b/index.js deleted file mode 100644 index 55351f6b8..000000000 --- a/index.js +++ /dev/null @@ -1,107 +0,0 @@ -import React, { Component } from 'react' - -import { withStyles } from '@material-ui/core/styles' -import { connect } from 'react-redux' -// import { BannerTopBar } from '../common' -import { loadAdvancedAlgosPlatform } from './Scripts/AppPreLoader' - -const styles = theme => ({ - '@global': { - body: { - backgroundColor: theme.palette.common.white - } - }, - layout: { - width: '100%', - height: '100%' - }, - heroContent: { - textColor: theme.palette.common.white, - maxWidth: 600, - height: 800, - margin: '0 auto', - padding: `${theme.spacing.unit * 8}px 0 ${theme.spacing.unit * 6}px` - } -}) - -class Charts extends Component { - componentDidMount () { - console.log("componentDidMount") - // if (window.canvasApp.visible === undefined) { - loadCanvas() // This happens only once. - // } - - // window.canvasApp.visible = true - let body = document.getElementById('body') - body.style = 'margin: 0px; padding: 0px; border: 0px; overflow:hidden;' - this.props.hideFooter() - } - - componentWillUnmount () { - // window.canvasApp.visible = false - let body = document.getElementById('body') - body.style = '' - this.props.showFooter() - } - - render () { - return ( -
TESTING CANVAS APP
- // - ) - } -} - -function loadCanvas(){ - console.log("loadCanvas") - // if (window.canvasApp.visible === undefined) { - window.canvasApp = { - version: '1.0.0', // This is used to avoid catching problems at the browser level. - sessionToken: '', - executingAt: 'Master App', - visible: false, - topMargin: 130, - urlPrefix:'http://localhost:3100/', - // urlPrefix: '<%= process.env.CANVAS_URL %>', - graphQL: { - masterAppApiUrl: '<%= process.env.PLATFORM_API_URL %>', - }, - context: {} - }; - - try { - loadAdvancedAlgosPlatform(); - } - catch (err) { - console.log("[ERROR] MasterApp -> Index -> CanvasApp can not be started. Please check that AAWeb is running."); - console.log("[ERROR] MasterApp -> Index -> err = " + err.stack); - } - // } -} - -const mapStateToProps = state => { - return { - context: state.context - } -} - -const mapDispatchToProps = dispatch => { - return { - hideFooter: () => { - dispatch({ type: 'HIDE_FOOTER' }) - }, - showFooter: () => { - dispatch({ type: 'SHOW_FOOTER' }) - } - } -} - -export default connect( - mapStateToProps, - mapDispatchToProps -)(withStyles(styles)(Charts))