From 98abe8ce18522bef7f28793f979cd7944fb0982d Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Fri, 24 May 2019 14:11:44 +0200 Subject: [PATCH 01/29] Update README.md --- README.md | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7fa3a65e8..a99dd63b3 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,42 @@ # Welcome to the Canvas App -The Canvas App is the built-in charting system of Superalgos. It is the software capable of running the Plotters that represent datasets graphically. +The Canvas App provides a visual environment for the _Charting System_ and the _Strategy Designer_. -![image](https://user-images.githubusercontent.com/9479367/56820881-520f0f80-684d-11e9-9f47-4b3ca38370e9.png) +## For Developers: Installation -## Installation +To install the Canvas App, you need to install AAWeb, following [this guide](https://github.com/Superalgos/AAWeb/blob/develop/README.md). -To install the Canvas App, you need to install AAWeb, following this guide: +## For All Users: Demo -https://github.com/Superalgos/AAWeb/blob/develop/README.md +Use the latest Chrome version to [access the Demo](https://demo.superalgos.org). -## Usage +## Overview -The first time you access the Canvas App, you will see the following screen with no chart displayed, since the app expects you to select one of the available layers at the Layers Panel on the left: +The first time you access the _Charts_, you will see the following screen, split in half. The top half features the space used by the _Charting System_ and the bottom half features the _Strategy Designer_. -![image](https://user-images.githubusercontent.com/9479367/56821029-a3b79a00-684d-11e9-8226-2471e32b70e7.png) +Use the control in the center of the turquoise bar to pull the bar up and down in order to make more room to either application. + +![image](https://user-images.githubusercontent.com/13994516/58324648-be1e6c80-7e27-11e9-906f-0f3d96c3aa7b.png) + +Pulling the bar to the very top of the screen causes the _Charting System_ to stop consuming resources in your local machine, and gives you an ample view of the _Strategy Designer_. + +The Strategy Designer allows you to manage your _Trading System_. The structure represented by the various icons nested in a hierarchy of elements is the representation of the logic behind your _Strategies_. + +![image](https://user-images.githubusercontent.com/13994516/58325421-f32bbe80-7e29-11e9-9478-9e6e4a02ae47.png) + +Pulling the bar to the very bottom of the screen causes the _Strategy Designer_ to stop consuming resources from your local machine, and offers a full-screen view of the _Charting System_. + +The _Charting System_ plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. + +![image](https://user-images.githubusercontent.com/13994516/58325972-c37db600-7e2b-11e9-9aa2-9f6faaf8dd94.png) + +The _Strategy Engine_ backtests and forward tests the instructions defined on its _protocol_ file input. In coordination with the _Strategy Executor_, the engine can also live trade. + +The _Strategy Executor_ interprets the execution instructions embedded at a _protocol_ file. The instructions determine the type of order to use, and what to do in every possible situation that could emerge during the placement and management of exchange orders. + +The _protocol_ refers to the _Superalgos Protocol_. In conceptual terms, it is a file with a specific format capable of holding all the information concerning your _Trading System_. The _protocol_ allows us to standardize the way in which we describe strategies, so that the tools we develop to create or modify, visualize, backtest and deploy _Strategies_ can handle all _Strategies_ in a standardized fashion. It also allows _Strategies_ and even parts of _Strategies_ to be portable, along with many other features that will become possible in the future. + +In its current early version, the _protocol_ is simply the description of a JSON object which defines the desired automation. ### Layers Panel From 3203398b575527792dec27708da30b04cb53bd74 Mon Sep 17 00:00:00 2001 From: Matias Date: Fri, 24 May 2019 20:28:36 -0300 Subject: [PATCH 02/29] Removing sessionToken --- Dashboard.js | 3 --- StrategySpace/StrategizerGateway.js | 2 -- TopSpace/CurrentEvent.js | 12 ++++++------ TopSpace/Login.js | 12 +++--------- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Dashboard.js b/Dashboard.js index 663c7cfa6..773606797 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -120,7 +120,6 @@ function newDashboard () { isTrader avatarHandle avatarChangeDate - sessionToken role { id } @@ -136,8 +135,6 @@ function newDashboard () { } }) .then(response => { - sessionToken = response.data.users_UserByAuthId.sessionToken; - window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId)); resolve({ user: response.data.users_UserByAuthId }) }) diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 26db512ec..60d4cff73 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -262,8 +262,6 @@ function newStrategizerGateway () { const authId = user.authId - let sessionToken - const apolloClient = new Apollo.lib.ApolloClient({ networkInterface: Apollo.lib.createNetworkInterface({ uri: window.canvasApp.graphQL.masterAppApiUrl, diff --git a/TopSpace/CurrentEvent.js b/TopSpace/CurrentEvent.js index b2831e277..29b9b1ab7 100644 --- a/TopSpace/CurrentEvent.js +++ b/TopSpace/CurrentEvent.js @@ -86,9 +86,9 @@ function newCurrentEvent () { return thisObject function initialize (pSharedStatus) { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } @@ -126,9 +126,9 @@ function newCurrentEvent () { } function onClick () { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } @@ -169,9 +169,9 @@ function newCurrentEvent () { } function draw () { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } diff --git a/TopSpace/Login.js b/TopSpace/Login.js index 61aa996c1..c5a8a58af 100644 --- a/TopSpace/Login.js +++ b/TopSpace/Login.js @@ -44,7 +44,6 @@ function newLogin () { // if there is no user that means that we are logged off, which means it is time to clean the local storage of things from the last log in. window.localStorage.removeItem('loggedInUser') - window.localStorage.removeItem('sessionToken') return } @@ -52,8 +51,6 @@ function newLogin () { const authId = user.authId - let sessionToken - const apolloClient = new Apollo.lib.ApolloClient({ networkInterface: Apollo.lib.createNetworkInterface({ uri: window.canvasApp.graphQL.masterAppApiUrl, @@ -79,7 +76,6 @@ function newLogin () { isTrader avatarHandle avatarChangeDate - sessionToken role { id } @@ -95,8 +91,6 @@ function newLogin () { } }) .then(response => { - sessionToken = response.data.users_UserByAuthId.sessionToken - window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId)) resolve({ user: response.data.users_UserByAuthId}) }) @@ -342,9 +336,10 @@ function newLogin () { thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick) async function authenticateUser () { - if (sessionToken === undefined) { sessionToken = '' } + // TODO USER_PROFILE should be retrieved from saweb-api ecosystem + return - let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' + sessionToken + let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' return new Promise( function (resolve, reject) { @@ -359,7 +354,6 @@ function newLogin () { } window.USER_PROFILE = responseFromServer.userProfile - window.localStorage.setItem('sessionToken', sessionToken) currentLabel = 'Logged In' resolve() From 7c01cd19a38f8d2b53fade39d56e0db9bb611993 Mon Sep 17 00:00:00 2001 From: Matias Date: Fri, 24 May 2019 20:28:36 -0300 Subject: [PATCH 03/29] Removing sessionToken --- Dashboard.js | 3 --- StrategySpace/StrategizerGateway.js | 2 -- TopSpace/CurrentEvent.js | 12 ++++++------ TopSpace/Login.js | 12 +++--------- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Dashboard.js b/Dashboard.js index 663c7cfa6..773606797 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -120,7 +120,6 @@ function newDashboard () { isTrader avatarHandle avatarChangeDate - sessionToken role { id } @@ -136,8 +135,6 @@ function newDashboard () { } }) .then(response => { - sessionToken = response.data.users_UserByAuthId.sessionToken; - window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId)); resolve({ user: response.data.users_UserByAuthId }) }) diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 783eada72..1e06d799b 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -264,8 +264,6 @@ function newStrategizerGateway () { const authId = user.authId - let sessionToken - const apolloClient = new Apollo.lib.ApolloClient({ networkInterface: Apollo.lib.createNetworkInterface({ uri: window.canvasApp.graphQL.masterAppApiUrl, diff --git a/TopSpace/CurrentEvent.js b/TopSpace/CurrentEvent.js index b2831e277..29b9b1ab7 100644 --- a/TopSpace/CurrentEvent.js +++ b/TopSpace/CurrentEvent.js @@ -86,9 +86,9 @@ function newCurrentEvent () { return thisObject function initialize (pSharedStatus) { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } @@ -126,9 +126,9 @@ function newCurrentEvent () { } function onClick () { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } @@ -169,9 +169,9 @@ function newCurrentEvent () { } function draw () { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } diff --git a/TopSpace/Login.js b/TopSpace/Login.js index 61aa996c1..c5a8a58af 100644 --- a/TopSpace/Login.js +++ b/TopSpace/Login.js @@ -44,7 +44,6 @@ function newLogin () { // if there is no user that means that we are logged off, which means it is time to clean the local storage of things from the last log in. window.localStorage.removeItem('loggedInUser') - window.localStorage.removeItem('sessionToken') return } @@ -52,8 +51,6 @@ function newLogin () { const authId = user.authId - let sessionToken - const apolloClient = new Apollo.lib.ApolloClient({ networkInterface: Apollo.lib.createNetworkInterface({ uri: window.canvasApp.graphQL.masterAppApiUrl, @@ -79,7 +76,6 @@ function newLogin () { isTrader avatarHandle avatarChangeDate - sessionToken role { id } @@ -95,8 +91,6 @@ function newLogin () { } }) .then(response => { - sessionToken = response.data.users_UserByAuthId.sessionToken - window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId)) resolve({ user: response.data.users_UserByAuthId}) }) @@ -342,9 +336,10 @@ function newLogin () { thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick) async function authenticateUser () { - if (sessionToken === undefined) { sessionToken = '' } + // TODO USER_PROFILE should be retrieved from saweb-api ecosystem + return - let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' + sessionToken + let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' return new Promise( function (resolve, reject) { @@ -359,7 +354,6 @@ function newLogin () { } window.USER_PROFILE = responseFromServer.userProfile - window.localStorage.setItem('sessionToken', sessionToken) currentLabel = 'Logged In' resolve() From 58585b59827967d82d714f22a5b05b0ab1e5818c Mon Sep 17 00:00:00 2001 From: Matias Date: Sat, 25 May 2019 11:46:27 -0300 Subject: [PATCH 04/29] Removing sessionToken --- StrategySpace/StrategizerGateway.js | 2 -- TopSpace/CurrentEvent.js | 12 ++++++------ TopSpace/Login.js | 12 +++--------- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 26db512ec..60d4cff73 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -262,8 +262,6 @@ function newStrategizerGateway () { const authId = user.authId - let sessionToken - const apolloClient = new Apollo.lib.ApolloClient({ networkInterface: Apollo.lib.createNetworkInterface({ uri: window.canvasApp.graphQL.masterAppApiUrl, diff --git a/TopSpace/CurrentEvent.js b/TopSpace/CurrentEvent.js index b2831e277..29b9b1ab7 100644 --- a/TopSpace/CurrentEvent.js +++ b/TopSpace/CurrentEvent.js @@ -86,9 +86,9 @@ function newCurrentEvent () { return thisObject function initialize (pSharedStatus) { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } @@ -126,9 +126,9 @@ function newCurrentEvent () { } function onClick () { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } @@ -169,9 +169,9 @@ function newCurrentEvent () { } function draw () { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } diff --git a/TopSpace/Login.js b/TopSpace/Login.js index 61aa996c1..c5a8a58af 100644 --- a/TopSpace/Login.js +++ b/TopSpace/Login.js @@ -44,7 +44,6 @@ function newLogin () { // if there is no user that means that we are logged off, which means it is time to clean the local storage of things from the last log in. window.localStorage.removeItem('loggedInUser') - window.localStorage.removeItem('sessionToken') return } @@ -52,8 +51,6 @@ function newLogin () { const authId = user.authId - let sessionToken - const apolloClient = new Apollo.lib.ApolloClient({ networkInterface: Apollo.lib.createNetworkInterface({ uri: window.canvasApp.graphQL.masterAppApiUrl, @@ -79,7 +76,6 @@ function newLogin () { isTrader avatarHandle avatarChangeDate - sessionToken role { id } @@ -95,8 +91,6 @@ function newLogin () { } }) .then(response => { - sessionToken = response.data.users_UserByAuthId.sessionToken - window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId)) resolve({ user: response.data.users_UserByAuthId}) }) @@ -342,9 +336,10 @@ function newLogin () { thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick) async function authenticateUser () { - if (sessionToken === undefined) { sessionToken = '' } + // TODO USER_PROFILE should be retrieved from saweb-api ecosystem + return - let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' + sessionToken + let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' return new Promise( function (resolve, reject) { @@ -359,7 +354,6 @@ function newLogin () { } window.USER_PROFILE = responseFromServer.userProfile - window.localStorage.setItem('sessionToken', sessionToken) currentLabel = 'Logged In' resolve() From 6022ceaf21b04ba84d3f1f913f4133cf2cd4619d Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 12:50:43 +0200 Subject: [PATCH 05/29] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a99dd63b3..14d6046ed 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,15 @@ To install the Canvas App, you need to install AAWeb, following [this guide](htt Use the latest Chrome version to [access the Demo](https://demo.superalgos.org). +![Access-Demo](https://user-images.githubusercontent.com/13994516/58415158-dbe50f00-807d-11e9-812c-3b4de503bc34.gif) + ## Overview The first time you access the _Charts_, you will see the following screen, split in half. The top half features the space used by the _Charting System_ and the bottom half features the _Strategy Designer_. Use the control in the center of the turquoise bar to pull the bar up and down in order to make more room to either application. -![image](https://user-images.githubusercontent.com/13994516/58324648-be1e6c80-7e27-11e9-906f-0f3d96c3aa7b.png) +![Drag-Panels](https://user-images.githubusercontent.com/13994516/58413461-1ac49600-8079-11e9-9dd8-96f416e75b33.gif) Pulling the bar to the very top of the screen causes the _Charting System_ to stop consuming resources in your local machine, and gives you an ample view of the _Strategy Designer_. @@ -24,12 +26,14 @@ The Strategy Designer allows you to manage your _Trading System_. The structure ![image](https://user-images.githubusercontent.com/13994516/58325421-f32bbe80-7e29-11e9-9478-9e6e4a02ae47.png) + Pulling the bar to the very bottom of the screen causes the _Strategy Designer_ to stop consuming resources from your local machine, and offers a full-screen view of the _Charting System_. The _Charting System_ plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. ![image](https://user-images.githubusercontent.com/13994516/58325972-c37db600-7e2b-11e9-9aa2-9f6faaf8dd94.png) + The _Strategy Engine_ backtests and forward tests the instructions defined on its _protocol_ file input. In coordination with the _Strategy Executor_, the engine can also live trade. The _Strategy Executor_ interprets the execution instructions embedded at a _protocol_ file. The instructions determine the type of order to use, and what to do in every possible situation that could emerge during the placement and management of exchange orders. From 74d2c85d7e160bcbde312c18dfdbfe50a3f5f711 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 13:02:11 +0200 Subject: [PATCH 06/29] Update README.md --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 14d6046ed..5dad794e4 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ To install the Canvas App, you need to install AAWeb, following [this guide](htt Use the latest Chrome version to [access the Demo](https://demo.superalgos.org). ![Access-Demo](https://user-images.githubusercontent.com/13994516/58415158-dbe50f00-807d-11e9-812c-3b4de503bc34.gif) +

## Overview @@ -19,26 +20,27 @@ The first time you access the _Charts_, you will see the following screen, split Use the control in the center of the turquoise bar to pull the bar up and down in order to make more room to either application. ![Drag-Panels](https://user-images.githubusercontent.com/13994516/58413461-1ac49600-8079-11e9-9dd8-96f416e75b33.gif) +

Pulling the bar to the very top of the screen causes the _Charting System_ to stop consuming resources in your local machine, and gives you an ample view of the _Strategy Designer_. -The Strategy Designer allows you to manage your _Trading System_. The structure represented by the various icons nested in a hierarchy of elements is the representation of the logic behind your _Strategies_. +The **_Strategy Designer_** allows you to manage your _Trading System_. The structure represented by the various icons nested in a hierarchy of elements is the representation of the logic behind your _Strategies_. ![image](https://user-images.githubusercontent.com/13994516/58325421-f32bbe80-7e29-11e9-9478-9e6e4a02ae47.png) - +

Pulling the bar to the very bottom of the screen causes the _Strategy Designer_ to stop consuming resources from your local machine, and offers a full-screen view of the _Charting System_. -The _Charting System_ plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. +The **_Charting System_** plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. ![image](https://user-images.githubusercontent.com/13994516/58325972-c37db600-7e2b-11e9-9aa2-9f6faaf8dd94.png) +

+The **_Strategy Engine_** backtests and forward tests the instructions defined on its _protocol_ file input. In coordination with the _Strategy Executor_, the engine can also live trade. -The _Strategy Engine_ backtests and forward tests the instructions defined on its _protocol_ file input. In coordination with the _Strategy Executor_, the engine can also live trade. +The **_Strategy Executor_** interprets the execution instructions embedded at a _protocol_ file. The instructions determine the type of order to use, and what to do in every possible situation that could emerge during the placement and management of exchange orders. -The _Strategy Executor_ interprets the execution instructions embedded at a _protocol_ file. The instructions determine the type of order to use, and what to do in every possible situation that could emerge during the placement and management of exchange orders. - -The _protocol_ refers to the _Superalgos Protocol_. In conceptual terms, it is a file with a specific format capable of holding all the information concerning your _Trading System_. The _protocol_ allows us to standardize the way in which we describe strategies, so that the tools we develop to create or modify, visualize, backtest and deploy _Strategies_ can handle all _Strategies_ in a standardized fashion. It also allows _Strategies_ and even parts of _Strategies_ to be portable, along with many other features that will become possible in the future. +The _protocol_ refers to the **_Superalgos Protocol_**. In conceptual terms, it is a file with a specific format capable of holding all the information concerning your _Trading System_. The _protocol_ allows us to standardize the way in which we describe strategies, so that the tools we develop to create or modify, visualize, backtest and deploy _Strategies_ can handle all _Strategies_ in a standardized fashion. It also allows _Strategies_ and even parts of _Strategies_ to be portable, along with many other features that will become possible in the future. In its current early version, the _protocol_ is simply the description of a JSON object which defines the desired automation. From ca60077153b708e9bb4c5621ccc1c63580d5780e Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 13:12:55 +0200 Subject: [PATCH 07/29] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5dad794e4..e335cd658 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ To install the Canvas App, you need to install AAWeb, following [this guide](htt ## For All Users: Demo -Use the latest Chrome version to [access the Demo](https://demo.superalgos.org). +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. ![Access-Demo](https://user-images.githubusercontent.com/13994516/58415158-dbe50f00-807d-11e9-812c-3b4de503bc34.gif)

@@ -24,14 +24,14 @@ Use the control in the center of the turquoise bar to pull the bar up and down i Pulling the bar to the very top of the screen causes the _Charting System_ to stop consuming resources in your local machine, and gives you an ample view of the _Strategy Designer_. -The **_Strategy Designer_** allows you to manage your _Trading System_. The structure represented by the various icons nested in a hierarchy of elements is the representation of the logic behind your _Strategies_. +> The **_Strategy Designer_** allows you to manage your _Trading System_. The structure represented by the various icons nested in a hierarchy of elements is the representation of the logic behind your _Strategies_. ![image](https://user-images.githubusercontent.com/13994516/58325421-f32bbe80-7e29-11e9-9478-9e6e4a02ae47.png)

Pulling the bar to the very bottom of the screen causes the _Strategy Designer_ to stop consuming resources from your local machine, and offers a full-screen view of the _Charting System_. -The **_Charting System_** plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. +> The **_Charting System_** plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. ![image](https://user-images.githubusercontent.com/13994516/58325972-c37db600-7e2b-11e9-9aa2-9f6faaf8dd94.png)

From 349f0185bfd2f1ece4c1cfeb60ee2b78d60c3874 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 13:25:28 +0200 Subject: [PATCH 08/29] Update README.md --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e335cd658..c4cdd016d 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ The Canvas App provides a visual environment for the _Charting System_ and the _Strategy Designer_. -## For Developers: Installation +# For Developers: Installation To install the Canvas App, you need to install AAWeb, following [this guide](https://github.com/Superalgos/AAWeb/blob/develop/README.md). -## For All Users: Demo +# For End Users: 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. @@ -24,25 +24,27 @@ Use the control in the center of the turquoise bar to pull the bar up and down i Pulling the bar to the very top of the screen causes the _Charting System_ to stop consuming resources in your local machine, and gives you an ample view of the _Strategy Designer_. -> The **_Strategy Designer_** allows you to manage your _Trading System_. The structure represented by the various icons nested in a hierarchy of elements is the representation of the logic behind your _Strategies_. +The **_Strategy Designer_** allows you to manage your _Trading System_. The structure represented by the various icons nested in a hierarchy of elements is the representation of the logic behind your _Strategies_. ![image](https://user-images.githubusercontent.com/13994516/58325421-f32bbe80-7e29-11e9-9478-9e6e4a02ae47.png)

Pulling the bar to the very bottom of the screen causes the _Strategy Designer_ to stop consuming resources from your local machine, and offers a full-screen view of the _Charting System_. -> The **_Charting System_** plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. +The **_Charting System_** plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. ![image](https://user-images.githubusercontent.com/13994516/58325972-c37db600-7e2b-11e9-9aa2-9f6faaf8dd94.png)

-The **_Strategy Engine_** backtests and forward tests the instructions defined on its _protocol_ file input. In coordination with the _Strategy Executor_, the engine can also live trade. +The **_Superalgos Protocol_** (also refered to as the _protocol_) determines the structure in which all the information regarding a trading system is stored and - at the same time - provides a clear guidance on how traders using the various tools developed and distributed by the Superalgos Project shall create and automate their strategies. -The **_Strategy Executor_** interprets the execution instructions embedded at a _protocol_ file. The instructions determine the type of order to use, and what to do in every possible situation that could emerge during the placement and management of exchange orders. +> You don't really _need_ to know this, but for the sake of context... + +> The **_Strategy Engine_** backtests and forward tests the instructions defined on its _protocol_ file input. In coordination with the _Strategy Executor_, the engine can also live trade. + +>The **_Strategy Executor_** interprets the execution instructions embedded at a _protocol_ file. The instructions determine the type of order to use, and what to do in every possible situation that could emerge during the placement and management of exchange orders. -The _protocol_ refers to the **_Superalgos Protocol_**. In conceptual terms, it is a file with a specific format capable of holding all the information concerning your _Trading System_. The _protocol_ allows us to standardize the way in which we describe strategies, so that the tools we develop to create or modify, visualize, backtest and deploy _Strategies_ can handle all _Strategies_ in a standardized fashion. It also allows _Strategies_ and even parts of _Strategies_ to be portable, along with many other features that will become possible in the future. -In its current early version, the _protocol_ is simply the description of a JSON object which defines the desired automation. ### Layers Panel From 697451906e0a41b0d8b4aada478a477be5fd6344 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 13:26:50 +0200 Subject: [PATCH 09/29] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c4cdd016d..55f2ceb72 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ The **_Charting System_** plots indicators data along with the actions taken by The **_Superalgos Protocol_** (also refered to as the _protocol_) determines the structure in which all the information regarding a trading system is stored and - at the same time - provides a clear guidance on how traders using the various tools developed and distributed by the Superalgos Project shall create and automate their strategies. > You don't really _need_ to know this, but for the sake of context... - +> > The **_Strategy Engine_** backtests and forward tests the instructions defined on its _protocol_ file input. In coordination with the _Strategy Executor_, the engine can also live trade. - +> >The **_Strategy Executor_** interprets the execution instructions embedded at a _protocol_ file. The instructions determine the type of order to use, and what to do in every possible situation that could emerge during the placement and management of exchange orders. From 6637757acf9dc9b092ce47d20fd86efbff6ed0a6 Mon Sep 17 00:00:00 2001 From: Matias Date: Mon, 27 May 2019 13:51:28 -0300 Subject: [PATCH 10/29] Update pre-master app --- Panels/ProductsPanel.js | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 8c0cb96f3..8ba4c18da 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -58,33 +58,20 @@ function newProductsPanel () { panelTabButton.fitFunction = thisObject.fitFunction panelTabButton.initialize() - /* Get the current teams of the logged in user. */ - - let storedTeams = window.localStorage.getItem('userTeams') - let userTeams - if (storedTeams !== null && storedTeams !== undefined && storedTeams !== '') { - userTeams = JSON.parse(storedTeams) - } - /* First thing is to build the thisObject.productCards array */ - let devTeams = ecosystem.getTeams() + let ecosystem = JSON.parse(window.localStorage.getItem('ecosystem')) - for (let i = 0; i < devTeams.length; i++) { - let devTeam = devTeams[i] + for (let i = 0; i < ecosystem.devTeams.length; i++) { + let devTeam = ecosystem.devTeams[i] for (let j = 0; j < devTeam.bots.length; j++) { let bot = devTeam.bots[j] - let userTeam = isUserTeam(devTeam.codeName, userTeams) if (bot.type !== 'Indicator' && bot.cloneId === undefined) { continue } if (bot.products !== undefined) { for (let k = 0; k < bot.products.length; k++) { let product = bot.products[k] - - if (window.localStorage.getItem('Show AAMaster Layers') === null) { - if (product.shareWith !== 'Public' && !userTeam) { continue } - } /* Now we create Product objects */ let productCard = newProductCard() @@ -253,17 +240,4 @@ function newProductsPanel () { panelTabButton.draw() } - - function isUserTeam (team, userTeams) { - if (userTeams === undefined) { - return false - } - - for (let index = 0; index < userTeams.length; index++) { - if (team === userTeams[index].slug) { - return true - } - } - return false - } } From 6b6985c871ff096849990e77e3a2203319c1beb7 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 20:30:40 +0200 Subject: [PATCH 11/29] Update README.md --- README.md | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 55f2ceb72..1151327f0 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ The **_Superalgos Protocol_** (also refered to as the _protocol_) determines the > >The **_Strategy Executor_** interprets the execution instructions embedded at a _protocol_ file. The instructions determine the type of order to use, and what to do in every possible situation that could emerge during the placement and management of exchange orders. - +## Charts Interface ### Layers Panel @@ -55,16 +55,13 @@ The layer title bar can have 3 possible background colors: 2. **Green**: layer is on. 3. **Yellow**: layer is loading. If it stays yellow, it means it can't load fully. -Click on the "Candles" layer and wait a few seconds date is loaded and candles are plotted. You should see something like this: - -![image](https://user-images.githubusercontent.com/9479367/56821266-1fb1e200-684e-11e9-9492-8bcbc3ed84d8.png) - -As you may see, the candles belong to the BTC/USDT market @ Poloniex. Even though the app supports other markets and exchanges, it is better for us to have only this one active, while the codebase matures. - -Notice the following 3 elements relative to the position of the mouse pointer: +![Layers](https://user-images.githubusercontent.com/13994516/58434206-c04c2980-80ba-11e9-964b-8223ad99eb0b.gif) +

### Main Elements +Notice the following 3 elements relative to the position of the mouse pointer: + 1. Above, the current datetime. This is the date and time at the mouse pointer position. 2. To the right, the current rate. This is the rate (in this case USDT per BTC) at the mouse pointer position. 3. Below, the current time period (or candle size if you wish). This is the currently displayed time period—not only for candles, but for any other object plotted across available layers. @@ -73,27 +70,23 @@ Notice the following 3 elements relative to the position of the mouse pointer: There are many things you can do with your mouse wheel. +1. Scroll over the Layers Panel to access layers that may be out of reach downwards. 1. Scroll on top of or next to the datetime to produce a horizontal scaling. 1. Scroll on top of or next to the displayed rate to produce a vertical scaling. 1. Scroll on top of or next to the time period to change the time period to available values. 1. Scroll elsewhere over the chart to zoom in and out. The App will not only zoom in and out of the chart, but also automatically adjust the time period to the most convenient one (for the current zoom level). -1. Scroll over the Layers Panel to access layers that may be out of reach downwards. -After zooming in the main elements stay at the top, left and bottom of the viewport as you can see in the next screenshot: +![Mouse-Wheel](https://user-images.githubusercontent.com/13994516/58434568-a01d6a00-80bc-11e9-9a58-3edd4852f07c.gif) +

-![image](https://user-images.githubusercontent.com/9479367/56822037-30635780-6850-11e9-8d1c-1c58959f46e9.png) +### Minimizing & Moving Floating Panels -### Moving Panels +To minimize a panel, click on the small triangle on the right of their title bar. This will automatically position the panel at the bottom of the screen. Clicking again restores the panel to its previous position. -Drag and drop right-clicking on the title bar. +You may also drag and drop the panels by right-clicking on the title bar. -### Minimizing Panels - -Click on the small triangle on the right of their title bar. This will automatically position the panel at the bottom of the screen. Clicking again restores the panel to its previous position. - -In the following image, the Layers Panel was dragged to the left and the Current Candle Panel was minimized: - -![image](https://user-images.githubusercontent.com/9479367/56822276-db741100-6850-11e9-9e23-d3fabb82754c.png) +![Panels](https://user-images.githubusercontent.com/13994516/58434864-1bcbe680-80be-11e9-8262-ccca1685f68b.gif) +

### Layers From ba9dbe98e7cc587d89265ab56b0c62c118d0e998 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 20:38:19 +0200 Subject: [PATCH 12/29] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1151327f0..e7f328352 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The **_Charting System_** plots indicators data along with the actions taken by ![image](https://user-images.githubusercontent.com/13994516/58325972-c37db600-7e2b-11e9-9aa2-9f6faaf8dd94.png)

-The **_Superalgos Protocol_** (also refered to as the _protocol_) determines the structure in which all the information regarding a trading system is stored and - at the same time - provides a clear guidance on how traders using the various tools developed and distributed by the Superalgos Project shall create and automate their strategies. +The **_Superalgos Protocol_** (also refered to as the _protocol_) determines the structure in which all the information regarding a trading system is stored and—at the same time—provides a clear guidance on how traders using the various tools developed and distributed by the Superalgos Project shall create and automate their strategies. > You don't really _need_ to know this, but for the sake of context... > @@ -60,7 +60,7 @@ The layer title bar can have 3 possible background colors: ### Main Elements -Notice the following 3 elements relative to the position of the mouse pointer: +Notice the following three elements relative to the position of the mouse pointer: 1. Above, the current datetime. This is the date and time at the mouse pointer position. 2. To the right, the current rate. This is the rate (in this case USDT per BTC) at the mouse pointer position. @@ -90,7 +90,7 @@ You may also drag and drop the panels by right-clicking on the title bar. ### Layers -Superalgos is an open system, meaning anyone can build layers for this charting app. So far—with our current limited manpower—we have created 8 public layers (available without logging in) and 2 private layers (available to logged-in users): +Superalgos is an open system, meaning anyone can build layers for the _Charting System_. So far—with our current limited manpower—we have created 8 public layers (available without logging in) and 2 private layers (available to logged-in users): #### Public Layers From 6b77586ba7f4fe42b43366467a02e9639d798530 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 20:39:45 +0200 Subject: [PATCH 13/29] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e7f328352..79d428da9 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ The Canvas App provides a visual environment for the _Charting System_ and the _Strategy Designer_. -# For Developers: Installation +**Installation (For Developers):** To install the Canvas App, you need to install AAWeb, following [this guide](https://github.com/Superalgos/AAWeb/blob/develop/README.md). -# For End Users: Trading System Automation Demo +# 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. From f74fd5ab37b318986ad3887e6723c63ec09ae084 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 20:40:21 +0200 Subject: [PATCH 14/29] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 79d428da9..9b303d0fd 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,7 @@ The Canvas App provides a visual environment for the _Charting System_ and the _Strategy Designer_. -**Installation (For Developers):** - -To install the Canvas App, you need to install AAWeb, following [this guide](https://github.com/Superalgos/AAWeb/blob/develop/README.md). +**Installation (for developers):** To install the Canvas App, you need to install AAWeb, following [this guide](https://github.com/Superalgos/AAWeb/blob/develop/README.md). # Trading System Automation Demo From ec51cbc733f4a0d7d1c59f402d3e55f17378a30b Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Mon, 27 May 2019 21:07:33 +0200 Subject: [PATCH 15/29] Update README.md --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9b303d0fd..1a8a90dba 100644 --- a/README.md +++ b/README.md @@ -94,27 +94,35 @@ Superalgos is an open system, meaning anyone can build layers for the _Charting 1. **Candles**: Typical candlesticks. -![image](https://user-images.githubusercontent.com/9479367/56822785-6acdf400-6852-11e9-98d9-0bd19ca98d61.png) +![Candles](https://user-images.githubusercontent.com/13994516/58435905-1a50ed00-80c3-11e9-860a-bb4afc8e0f42.gif) +

2. **Volumes**: I innovated a bit placing the buy volume at the bottom (in green), and the sell volume at the top (in red). -![image](https://user-images.githubusercontent.com/9479367/56822811-8638ff00-6852-11e9-9f25-6b97720a9d1b.png) +![Volumes](https://user-images.githubusercontent.com/13994516/58435907-1ae98380-80c3-11e9-90e5-de9052b166c4.gif) +

3. **Candle Stairs Patterns**: This is an unusual pattern proving any dataset may be plotted on the charts (and by extension, that anything can be added to the system). A Stair Pattern is defined as a set of candles going in the same direction, either up or down. You can think of these patterns as "Candle Channels", as they represent channels with an up or down direction based on underlying candles direction. -![image](https://user-images.githubusercontent.com/9479367/56822884-b6809d80-6852-11e9-999a-bccddfb68229.png) +![Candle-Stairs](https://user-images.githubusercontent.com/13994516/58435906-1ae98380-80c3-11e9-893e-1f8cd1b5c925.gif) +

4. **Volume Stairs Patterns**: A similar concept, this time with volumes. Whenever a sequence of volume bars is found where each one is bigger than the previous one, they are bundled together in a "Stair". The same applies when they are going down (the next is smaller than the previous one). For a trading bot, this serves to identify if sell or buy volumes are raising or declining, if any. -![image](https://user-images.githubusercontent.com/9479367/56822975-f34c9480-6852-11e9-9175-19d397b89441.png) +![Volume-Stairs](https://user-images.githubusercontent.com/13994516/58435908-1ae98380-80c3-11e9-8c0d-87a105b4e021.gif) +

5. **Bollinger Bands**: This is the traditional (Bollinger Bands indicator)[https://en.wikipedia.org/wiki/Bollinger_Bands]. Bollinger Bands have a moving average, in our case calculated with the last 20 periods (the line in the middle of the bands). We are plotting the moving average with one color when it is going up, and with a different color when it's going down. The upper band is at 2 Standard Deviations from the center, pretty much like the lower band, also at 2 Standard Deviations. These are the most widely used Bollinger Bands settings. -![image](https://user-images.githubusercontent.com/9479367/56833341-82b37100-686e-11e9-8b17-55b3bf7a8fdb.png) +![Bollinger-Bands](https://user-images.githubusercontent.com/13994516/58435901-1a50ed00-80c3-11e9-853a-68d39ba7958b.gif) +

6. **Percentage Bandwidth or %B**: This is a well-known indicator that derives from the Bollinger Bands. In a nutshell it tells you how close the price is either to the upper band or the lower band at any point in time. When the price is in the middle of the bands (it is calculated with the close value of each candle), then %B is in the middle of its chart, at value 50. When the price touches the upper band, then %B is at 100, and finally when the price is at the lower band, then %B is at 0. The chart contains lines at %B value 30 and 70 since those are the most common values for traders to forecast when a reversal may happen. In our chart, %B is the one represented at #1. I've found useful to add a moving average in order to smooth volatility a bit, and to be able to ask—at any time—if it is going up or down. The moving average calculated with the last 5 %B values is plotted as line #2. Finally I also added a property called Bandwidth, which represents the separation of the upper band from the lower band. It is a measure of the volatility and is plotted at #3. +![Bollinger-Bands-Percentage-Bandwidth](https://user-images.githubusercontent.com/13994516/58435903-1a50ed00-80c3-11e9-90d5-e0d5293c76ad.gif) + ![image](https://user-images.githubusercontent.com/9479367/56834223-1c7c1d80-6871-11e9-9687-ae5dc12d0336.png) +

7. **Bollinger Channels**: This is a non-standard indicator derived from the Bollinger Bands. These types of channels are calculated using the Bollinger Bands moving average. Essentially an upward channel begins when the moving average turns from going down to going up, and the channel finishes when it turns from going up to down. A downward channel starts when the Bollinger Band moving average turns from going up to down, and it finishes when it starts going up again. Upward channels are plotted in green, while downward channels in red. Additional information can be found at the indicator's panel, like the number of periods contained at the channel. From fd29644db0e9aad3b637cede3293bdf5ba809686 Mon Sep 17 00:00:00 2001 From: Matias Date: Fri, 24 May 2019 20:28:36 -0300 Subject: [PATCH 16/29] Removing sessionToken --- Dashboard.js | 3 --- StrategySpace/StrategizerGateway.js | 2 -- TopSpace/CurrentEvent.js | 12 ++++++------ TopSpace/Login.js | 12 +++--------- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Dashboard.js b/Dashboard.js index 663c7cfa6..773606797 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -120,7 +120,6 @@ function newDashboard () { isTrader avatarHandle avatarChangeDate - sessionToken role { id } @@ -136,8 +135,6 @@ function newDashboard () { } }) .then(response => { - sessionToken = response.data.users_UserByAuthId.sessionToken; - window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId)); resolve({ user: response.data.users_UserByAuthId }) }) diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 783eada72..1e06d799b 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -264,8 +264,6 @@ function newStrategizerGateway () { const authId = user.authId - let sessionToken - const apolloClient = new Apollo.lib.ApolloClient({ networkInterface: Apollo.lib.createNetworkInterface({ uri: window.canvasApp.graphQL.masterAppApiUrl, diff --git a/TopSpace/CurrentEvent.js b/TopSpace/CurrentEvent.js index b2831e277..29b9b1ab7 100644 --- a/TopSpace/CurrentEvent.js +++ b/TopSpace/CurrentEvent.js @@ -86,9 +86,9 @@ function newCurrentEvent () { return thisObject function initialize (pSharedStatus) { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } @@ -126,9 +126,9 @@ function newCurrentEvent () { } function onClick () { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } @@ -169,9 +169,9 @@ function newCurrentEvent () { } function draw () { - let sessionToken = window.localStorage.getItem('sessionToken') + let accessToken = window.localStorage.getItem('access_token') - if (sessionToken === null || sessionToken === '') { + if (accessToken === null || accessToken === '') { /* not logged in */ return } diff --git a/TopSpace/Login.js b/TopSpace/Login.js index 61aa996c1..c5a8a58af 100644 --- a/TopSpace/Login.js +++ b/TopSpace/Login.js @@ -44,7 +44,6 @@ function newLogin () { // if there is no user that means that we are logged off, which means it is time to clean the local storage of things from the last log in. window.localStorage.removeItem('loggedInUser') - window.localStorage.removeItem('sessionToken') return } @@ -52,8 +51,6 @@ function newLogin () { const authId = user.authId - let sessionToken - const apolloClient = new Apollo.lib.ApolloClient({ networkInterface: Apollo.lib.createNetworkInterface({ uri: window.canvasApp.graphQL.masterAppApiUrl, @@ -79,7 +76,6 @@ function newLogin () { isTrader avatarHandle avatarChangeDate - sessionToken role { id } @@ -95,8 +91,6 @@ function newLogin () { } }) .then(response => { - sessionToken = response.data.users_UserByAuthId.sessionToken - window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId)) resolve({ user: response.data.users_UserByAuthId}) }) @@ -342,9 +336,10 @@ function newLogin () { thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick) async function authenticateUser () { - if (sessionToken === undefined) { sessionToken = '' } + // TODO USER_PROFILE should be retrieved from saweb-api ecosystem + return - let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' + sessionToken + let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' return new Promise( function (resolve, reject) { @@ -359,7 +354,6 @@ function newLogin () { } window.USER_PROFILE = responseFromServer.userProfile - window.localStorage.setItem('sessionToken', sessionToken) currentLabel = 'Logged In' resolve() From b33465e293200bdec14d53a9375a7e26e541c6ef Mon Sep 17 00:00:00 2001 From: Matias Date: Fri, 24 May 2019 20:28:36 -0300 Subject: [PATCH 17/29] Removing sessionToken --- ChartsSpace/PlottersManager.js | 4 ++-- TopSpace/CurrentEvent.js | 2 +- WebDebugLog.js | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ChartsSpace/PlottersManager.js b/ChartsSpace/PlottersManager.js index 47e5c71f7..16ffb3acf 100644 --- a/ChartsSpace/PlottersManager.js +++ b/ChartsSpace/PlottersManager.js @@ -144,7 +144,7 @@ function newPlottersManager () { try { /* At this current version of the platform, we will support only one competition with only one plotter. */ - const COMPETITION_HOST = 'AAArena' + const COMPETITION_HOST = 'AAMasters' const COMPETITION = 'Weekend-Deathmatch' let objName = COMPETITION_HOST + '-' + COMPETITION @@ -170,7 +170,7 @@ function newPlottersManager () { } } /* Now we have all the initial data loaded and ready to be delivered to the new instance of the plotter. */ - let plotter = getNewPlotter(competition.plotter.host, competition.plotter.codeName, competition.plotter.moduleName) + let plotter = getNewPlotter(competition.plotter.devTeam, competition.plotter.codeName, competition.plotter.moduleName) 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 diff --git a/TopSpace/CurrentEvent.js b/TopSpace/CurrentEvent.js index 29b9b1ab7..3b66174c8 100644 --- a/TopSpace/CurrentEvent.js +++ b/TopSpace/CurrentEvent.js @@ -8,7 +8,7 @@ function newCurrentEvent () { function buildEcosystemEventsHack (reload) { let hackedEcosystem = [{ - 'codeName': 'AAArena', + 'codeName': 'AAMasters', 'displayName': 'AA Arena', 'competitions': [{ 'codeName': 'Weekend-Deathmatch', diff --git a/WebDebugLog.js b/WebDebugLog.js index b6aa23539..3888b3b82 100644 --- a/WebDebugLog.js +++ b/WebDebugLog.js @@ -1,5 +1,4 @@ -  -function newWebDebugLog () { + function newWebDebugLog () { let thisObject = { write: write, fileName: 'undefined' From 1b23ab5b959f7ba1261e8a9460061cd264fa74a6 Mon Sep 17 00:00:00 2001 From: Matias Date: Mon, 27 May 2019 13:51:28 -0300 Subject: [PATCH 18/29] Update pre-master app --- Panels/ProductsPanel.js | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 8c0cb96f3..8ba4c18da 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -58,33 +58,20 @@ function newProductsPanel () { panelTabButton.fitFunction = thisObject.fitFunction panelTabButton.initialize() - /* Get the current teams of the logged in user. */ - - let storedTeams = window.localStorage.getItem('userTeams') - let userTeams - if (storedTeams !== null && storedTeams !== undefined && storedTeams !== '') { - userTeams = JSON.parse(storedTeams) - } - /* First thing is to build the thisObject.productCards array */ - let devTeams = ecosystem.getTeams() + let ecosystem = JSON.parse(window.localStorage.getItem('ecosystem')) - for (let i = 0; i < devTeams.length; i++) { - let devTeam = devTeams[i] + for (let i = 0; i < ecosystem.devTeams.length; i++) { + let devTeam = ecosystem.devTeams[i] for (let j = 0; j < devTeam.bots.length; j++) { let bot = devTeam.bots[j] - let userTeam = isUserTeam(devTeam.codeName, userTeams) if (bot.type !== 'Indicator' && bot.cloneId === undefined) { continue } if (bot.products !== undefined) { for (let k = 0; k < bot.products.length; k++) { let product = bot.products[k] - - if (window.localStorage.getItem('Show AAMaster Layers') === null) { - if (product.shareWith !== 'Public' && !userTeam) { continue } - } /* Now we create Product objects */ let productCard = newProductCard() @@ -253,17 +240,4 @@ function newProductsPanel () { panelTabButton.draw() } - - function isUserTeam (team, userTeams) { - if (userTeams === undefined) { - return false - } - - for (let index = 0; index < userTeams.length; index++) { - if (team === userTeams[index].slug) { - return true - } - } - return false - } } From ad3529af7e3b72081b9fc2980edbf9a418e6a7df Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Tue, 28 May 2019 19:01:18 +0200 Subject: [PATCH 19/29] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1a8a90dba..8b333c950 100644 --- a/README.md +++ b/README.md @@ -112,17 +112,20 @@ Superalgos is an open system, meaning anyone can build layers for the _Charting ![Volume-Stairs](https://user-images.githubusercontent.com/13994516/58435908-1ae98380-80c3-11e9-8c0d-87a105b4e021.gif)

-5. **Bollinger Bands**: This is the traditional (Bollinger Bands indicator)[https://en.wikipedia.org/wiki/Bollinger_Bands]. Bollinger Bands have a moving average, in our case calculated with the last 20 periods (the line in the middle of the bands). We are plotting the moving average with one color when it is going up, and with a different color when it's going down. The upper band is at 2 Standard Deviations from the center, pretty much like the lower band, also at 2 Standard Deviations. These are the most widely used Bollinger Bands settings. +5. **Bollinger Bands**: This is the traditional [Bollinger Bands indicator](https://en.wikipedia.org/wiki/Bollinger_Bands). Bollinger Bands have a moving average, in our case calculated with the last 20 periods (the line in the middle of the bands). We are plotting the moving average with one color when it is going up, and with a different color when it's going down. The upper band is at 2 Standard Deviations from the center, pretty much like the lower band, also at 2 Standard Deviations. These are the most widely used Bollinger Bands settings. ![Bollinger-Bands](https://user-images.githubusercontent.com/13994516/58435901-1a50ed00-80c3-11e9-853a-68d39ba7958b.gif)

-6. **Percentage Bandwidth or %B**: This is a well-known indicator that derives from the Bollinger Bands. In a nutshell it tells you how close the price is either to the upper band or the lower band at any point in time. When the price is in the middle of the bands (it is calculated with the close value of each candle), then %B is in the middle of its chart, at value 50. When the price touches the upper band, then %B is at 100, and finally when the price is at the lower band, then %B is at 0. The chart contains lines at %B value 30 and 70 since those are the most common values for traders to forecast when a reversal may happen. In our chart, %B is the one represented at #1. I've found useful to add a moving average in order to smooth volatility a bit, and to be able to ask—at any time—if it is going up or down. The moving average calculated with the last 5 %B values is plotted as line #2. Finally I also added a property called Bandwidth, which represents the separation of the upper band from the lower band. It is a measure of the volatility and is plotted at #3. +6. **Percentage Bandwidth or %B**: This is a well-known indicator that derives from the Bollinger Bands. In a nutshell it tells you how close the price is either to the upper band or the lower band at any point in time. When the price is in the middle of the bands (it is calculated with the close value of each candle), then %B is in the middle of its chart, at value 50. When the price touches the upper band, then %B is at 100, and finally when the price is at the lower band, then %B is at 0. ![Bollinger-Bands-Percentage-Bandwidth](https://user-images.githubusercontent.com/13994516/58435903-1a50ed00-80c3-11e9-90d5-e0d5293c76ad.gif) +

+ +The chart features lines at %B value 30 and 70 since those are the most common values for traders to forecast when a reversal may happen. In our chart, %B is the one represented at #1. I've found useful to add a moving average in order to smooth volatility a bit, and to be able to ask—at any time—if it is going up or down. The moving average calculated with the last 5 %B values is plotted as line #2. Finally I also added a property called Bandwidth, which represents the separation of the upper band from the lower band. It is a measure of the volatility and is plotted at #3. ![image](https://user-images.githubusercontent.com/9479367/56834223-1c7c1d80-6871-11e9-9687-ae5dc12d0336.png) -

+ 7. **Bollinger Channels**: This is a non-standard indicator derived from the Bollinger Bands. These types of channels are calculated using the Bollinger Bands moving average. Essentially an upward channel begins when the moving average turns from going down to going up, and the channel finishes when it turns from going up to down. A downward channel starts when the Bollinger Band moving average turns from going up to down, and it finishes when it starts going up again. Upward channels are plotted in green, while downward channels in red. Additional information can be found at the indicator's panel, like the number of periods contained at the channel. From cfa1b0ce3bd560f1350b69ee165dd412cb71cd7f Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Tue, 28 May 2019 19:10:26 +0200 Subject: [PATCH 20/29] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8b333c950..7fd0905c9 100644 --- a/README.md +++ b/README.md @@ -125,15 +125,16 @@ Superalgos is an open system, meaning anyone can build layers for the _Charting The chart features lines at %B value 30 and 70 since those are the most common values for traders to forecast when a reversal may happen. In our chart, %B is the one represented at #1. I've found useful to add a moving average in order to smooth volatility a bit, and to be able to ask—at any time—if it is going up or down. The moving average calculated with the last 5 %B values is plotted as line #2. Finally I also added a property called Bandwidth, which represents the separation of the upper band from the lower band. It is a measure of the volatility and is plotted at #3. ![image](https://user-images.githubusercontent.com/9479367/56834223-1c7c1d80-6871-11e9-9687-ae5dc12d0336.png) - +

7. **Bollinger Channels**: This is a non-standard indicator derived from the Bollinger Bands. These types of channels are calculated using the Bollinger Bands moving average. Essentially an upward channel begins when the moving average turns from going down to going up, and the channel finishes when it turns from going up to down. A downward channel starts when the Bollinger Band moving average turns from going up to down, and it finishes when it starts going up again. Upward channels are plotted in green, while downward channels in red. Additional information can be found at the indicator's panel, like the number of periods contained at the channel. -![image](https://user-images.githubusercontent.com/9479367/56834955-30c11a00-6873-11e9-8601-9d8abc8fab84.png) +![Bollinger-Channels](https://user-images.githubusercontent.com/13994516/58497359-146b1280-817c-11e9-9f4d-99fee41cd27f.gif) 8. **Bollinger Sub-Channels**: If we consider that one Bollinger Channel can have sub-channels with the same direction (up or down) but different slopes, then we get to the concept of Bollinger Sub-Channels. The most important property of a sub-channel is its slope. The possible values are: side, gentle, medium, high and extreme. With this information, a trading bot could easily ask if it is in a sub-channel with a certain slope and for how many periods. -![image](https://user-images.githubusercontent.com/9479367/56835528-c610de00-6874-11e9-8431-3cfe0c515f3e.png) +![Bollinger-Sub-Channels](https://user-images.githubusercontent.com/13994516/58497358-146b1280-817c-11e9-83df-219d0fffa9f0.gif) +

#### Private Layers From 84f54e5cb7f31d80794a0c520aaf52d4fdeac7cf Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Wed, 29 May 2019 12:14:26 +0200 Subject: [PATCH 21/29] Update README.md --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7fd0905c9..7222aa72d 100644 --- a/README.md +++ b/README.md @@ -140,9 +140,6 @@ The chart features lines at %B value 30 and 70 since those are the most common v 1. **Trading Simulation**: The Trading Simulation layer displays a backtest + fordwardtest (paper trading) of whatever strategies you have created in the system. At sign up, you are provided with an initial set of strategies so that you can be up and running as quickly as possible. By activating the Trading Simulation layer you should be able to see something like this: -![image](https://user-images.githubusercontent.com/9479367/56860461-0799aa00-6997-11e9-9c2d-5ace122a5c25.png) - -Let's take a moment to analyze what you see on the chart: - -A. This shows you when you entered into one of your strategies (think of it as if the strategy was activated because when activation conditions were met). The first icon represents the moment when you entered into that particular strategy, and the second icon represents the moment you left the strategy. +![Trading-Simulation](https://user-images.githubusercontent.com/13994516/58548756-3f9c4300-820a-11e9-9b39-cb7e11ae0ee6.gif) +

From c8f845c6e3f6af9c13f7bbcf666312b41c93175a Mon Sep 17 00:00:00 2001 From: Matias Date: Wed, 29 May 2019 11:31:44 -0300 Subject: [PATCH 22/29] Integration with saweb-api --- Dashboard.js | 56 +--- Exchange/ExchangeAPI.js | 131 -------- FloatingSpace/CodeEditor.js | 4 +- StrategySpace/StrategizerGateway.js | 16 +- TopSpace/EndUser.js | 84 ----- TopSpace/Login.js | 490 ++++++++-------------------- 6 files changed, 144 insertions(+), 637 deletions(-) delete mode 100644 Exchange/ExchangeAPI.js delete mode 100644 TopSpace/EndUser.js diff --git a/Dashboard.js b/Dashboard.js index 773606797..46d5dd536 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -91,61 +91,7 @@ function newDashboard () { function loadImages (callBack) { try { const accessToken = '' - - /* - Soon, we will need to get images from the Financial Beings Module. I live this core here as a sample for that: - - const apolloClient = new Apollo.lib.ApolloClient({ - networkInterface: Apollo.lib.createNetworkInterface({ - uri: window.canvasApp.graphQL.masterAppApiUrl, - transportBatching: true, - }), - connectToDevTools: true, - }) - - const QUERY = Apollo.gql` - query($authId: String){ - users_UserByAuthId (authId: $authId){ - id - referrerId - alias - firstName - middleName - lastName - bio - email - emailVerified - isDeveloper - isDataAnalyst - isTrader - avatarHandle - avatarChangeDate - role { - id - } - } - } - ` - const getUser = () => { - return new Promise((resolve, reject) => { - apolloClient.query({ - query: QUERY, - variables: { - authId: authId - } - }) - .then(response => { - window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId)); - resolve({ user: response.data.users_UserByAuthId }) - }) - .catch(error => { - console.log("apolloClient error getting user query", error) - reject(error) - }); - }); - } - - */ + // Soon, we will need to get images from the Financial Beings Module. const networkInterfaceTeams = Apollo.lib.createNetworkInterface({ uri: window.canvasApp.graphQL.masterAppApiUrl diff --git a/Exchange/ExchangeAPI.js b/Exchange/ExchangeAPI.js deleted file mode 100644 index f72cfa729..000000000 --- a/Exchange/ExchangeAPI.js +++ /dev/null @@ -1,131 +0,0 @@ - function newExchangeAPI () { - const INFO_LOG = true - const LOG_FILE_CONTENT = true - - const MODULE_NAME = 'CloudVM -> Exchange API' - - const SERVER_URL = window.canvasApp.urlPrefix + 'ExchangeAPI/' - - let thisObject = { - initialize: initialize, - getTicker: getTicker, - getOpenPositions: getOpenPositions, - getExecutedTrades: getExecutedTrades, - putPosition: putPosition, - movePosition: movePosition, - getPublicTradeHistory: getPublicTradeHistory - } - - return thisObject - - function initialize (callBackFunction) { - /* When this initialized is called from the Browser, there is no need to send it to the server since the server will - anyways initialize this library at each method call. */ - - callBackFunction(window.DEFAULT_OK_RESPONSE) - } - - function getTicker (pMarket, callBackFunction) { - let authToken = window.localStorage.getItem('access_token') - - let path = SERVER_URL - + "getTicker" + "/" - + authToken - - callServer(undefined, path + '/NO-LOG', onServerResponse) - - function onServerResponse (pServerResponse) { - let response = JSON.parse(pServerResponse) - if (response.result === window.DEFAULT_FAIL_RESPONSE.result) { - callBackFunction(window.DEFAULT_FAIL_RESPONSE) - } else { - callBackFunction(window.DEFAULT_OK_RESPONSE, response) - } - } - } - - function getOpenPositions (pMarket, callBackFunction) { - let authToken = window.localStorage.getItem('access_token'); - - let path = SERVER_URL - + "getOpenPositions" + "/" - + authToken - - callServer(undefined, path + '/NO-LOG', onServerResponse) - - function onServerResponse(pServerResponse) { - let response = JSON.parse(pServerResponse); - if (response.result === window.DEFAULT_FAIL_RESPONSE.result) - callBackFunction(window.DEFAULT_FAIL_RESPONSE); - else - callBackFunction(window.DEFAULT_OK_RESPONSE, response); - } - } - - function getExecutedTrades(pPositionId, callBackFunction) { - - let authToken = window.localStorage.getItem('access_token'); - - let path = SERVER_URL - + "getExecutedTrades" + "/" - + authToken + "/" - + pPositionId - ; - - callServer(undefined, path + "/NO-LOG", onServerResponse); - - function onServerResponse(pServerResponse) { - let response = JSON.parse(pServerResponse); - if (response.result === window.DEFAULT_FAIL_RESPONSE.result) - callBackFunction(window.DEFAULT_FAIL_RESPONSE); - else - callBackFunction(window.DEFAULT_OK_RESPONSE, response); - } - } - - function putPosition(pMarket, pType, pRate, pAmountA, pAmountB, callBackFunction) { - - let authToken = window.localStorage.getItem('access_token'); - - let path = SERVER_URL - + "putPosition" + "/" - + authToken + "/" - + pType + "/" - + pRate + "/" - + pAmountA + "/" - + pAmountB - ; - - callServer(undefined, path + '/NO-LOG', onServerResponse) - - function onServerResponse (pServerResponse) { - let response = JSON.parse(pServerResponse) - if (response.result === window.DEFAULT_FAIL_RESPONSE.result) { - callBackFunction(window.DEFAULT_FAIL_RESPONSE) - } else { - callBackFunction(window.DEFAULT_OK_RESPONSE, response) - } - } - } - - function getPublicTradeHistory (pMarket, startTime, endTime, callBackFunction) { - let authToken = window.localStorage.getItem('access_token') - - let path = SERVER_URL - + CURRENT_BOT_CODE_NAME + '/' - + 'getPublicTradeHistory' + '/' - + authToken + '/' - + startTime + '/' - + endTime - - callServer(undefined, path + '/NO-LOG', onServerResponse) - - function onServerResponse(pServerResponse) { - let response = JSON.parse(pServerResponse); - if (response.result === window.DEFAULT_FAIL_RESPONSE.result) - callBackFunction(window.DEFAULT_FAIL_RESPONSE); - else - callBackFunction(window.DEFAULT_OK_RESPONSE, response); - } - } -} diff --git a/FloatingSpace/CodeEditor.js b/FloatingSpace/CodeEditor.js index 8df2e4311..9b910f842 100644 --- a/FloatingSpace/CodeEditor.js +++ b/FloatingSpace/CodeEditor.js @@ -61,8 +61,8 @@ function newCodeEditor () { } thisObject.iconNOT_OK.src = window.canvasApp.urlPrefix + thisObject.imagePathNOT_OK } - thisObject.iconOK.src = window.canvasApp.urlPrefix + thisObject.imagePathOK - thisObject.icon = thisObject.iconOK // The default value is ON. + // thisObject.iconOK.src = window.canvasApp.urlPrefix + thisObject.imagePathOK + // thisObject.icon = thisObject.iconOK // The default value is ON. } function deactivate () { diff --git a/StrategySpace/StrategizerGateway.js b/StrategySpace/StrategizerGateway.js index 1e06d799b..2f2ad4195 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/StrategySpace/StrategizerGateway.js @@ -275,18 +275,14 @@ function newStrategizerGateway () { /* Getting the FB that own the Strategies */ 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 - } - teams = JSON.parse(teams) + let ecosystem = JSON.parse(window.localStorage.getItem('ecosystem')) + let teams = ecosystem.devTeams 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 + for (let j = 0; j < team.bots.length; j++) { + let bot = team.bots[j] + if (bot.codeName.indexOf('simulator') >= 0) { + teamtradingSystemSimulationFB = bot.codeName } } } diff --git a/TopSpace/EndUser.js b/TopSpace/EndUser.js deleted file mode 100644 index b8699eb69..000000000 --- a/TopSpace/EndUser.js +++ /dev/null @@ -1,84 +0,0 @@ -  -function newEndUser () { - let thisObject = { - container: undefined, - draw: draw, - getContainer: getContainer, - initialize: initialize - } - - let container = newContainer() - container.initialize() - thisObject.container = container - - thisObject.container.frame.width = 200 - thisObject.container.frame.height = COCKPIT_SPACE_HEIGHT - - container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 5 - container.frame.position.y = viewPort.visibleArea.bottomLeft.y + BREAKPOINT_HEIGHT - - container.isDraggeable = false - - return thisObject - - function initialize () { - let storedUser = window.localStorage.getItem('loggedInUser') - - if (storedUser === null || storedUser === '') { - // User is currently not logged in. - window.USER_LOGGED_IN = '' - return - } - - let loggedInUser = JSON.parse(storedUser) - - window.USER_LOGGED_IN = loggedInUser.alias - - /* Here we will rearrange the storage permissions array into a map, so that it can be easily consumed when needed. */ - - let permissionsMap = new Map() - - for (i = 0; i < window.USER_PROFILE.storagePermissions.length; i++) { - let permission = window.USER_PROFILE.storagePermissions[i] - - permissionsMap.set(permission[0], permission[1]) - } - - window.USER_PROFILE.storagePermissions = permissionsMap - } - - function getContainer (point) { - let container - - /* First we check if this point is inside this object UI. */ - - if (thisObject.container.frame.isThisPointHere(point, true) === true) { - return this.container - } else { - /* This point does not belong to this space. */ - - return undefined - } - } - - function draw () { - return // nothing to show - - thisObject.container.frame.draw(false, false) - - let fontSize = 12 - let label = window.USER_LOGGED_IN - if (label === undefined) { label = '' }; - - let point = { - x: thisObject.container.frame.width * 1 / 3, - y: (thisObject.container.frame.height / 2) + 4 - } - - point = thisObject.container.frame.frameThisPoint(point) - - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' - browserCanvasContext.fillText(label, point.x, point.y) - } -} diff --git a/TopSpace/Login.js b/TopSpace/Login.js index c5a8a58af..099176916 100644 --- a/TopSpace/Login.js +++ b/TopSpace/Login.js @@ -1,8 +1,6 @@ -function newLogin () { +function newLogin() { const MODULE_NAME = 'Login' - const INFO_LOG = false - const INTENSIVE_LOG = false const ERROR_LOG = true const logger = newWebDebugLog() logger.fileName = MODULE_NAME @@ -27,381 +25,163 @@ function newLogin () { container.isDraggeable = false container.isClickeable = true - let currentLabel - - let userAuthorization - return thisObject - async function initialize (pSharedStatus) { + async function initialize(sharedStatus) { try { const accessToken = window.localStorage.getItem('access_token') - let user = window.localStorage.getItem('user') - sharedStatus = pSharedStatus - - if (user === null) { - // if there is no user that means that we are logged off, which means it is time to clean the local storage of things from the last log in. - - window.localStorage.removeItem('loggedInUser') - return + if (accessToken) { + await getEvents(accessToken, sharedStatus) + await getClones(accessToken) } - user = JSON.parse(user) - - const authId = user.authId - - const apolloClient = new Apollo.lib.ApolloClient({ - networkInterface: Apollo.lib.createNetworkInterface({ - uri: window.canvasApp.graphQL.masterAppApiUrl, - transportBatching: true - }), - connectToDevTools: true - }) - - const USERS_QUERY = Apollo.gql` - query($authId: String){ - users_UserByAuthId (authId: $authId){ - id - referrerId - alias - firstName - middleName - lastName - bio - email - emailVerified - isDeveloper - isDataAnalyst - isTrader - avatarHandle - avatarChangeDate - role { - id - } - } - } - ` - const getUser = () => { - return new Promise((resolve, reject) => { - apolloClient.query({ - query: USERS_QUERY, - variables: { - authId: authId - } - }) - .then(response => { - window.localStorage.setItem('loggedInUser', JSON.stringify(response.data.users_UserByAuthId)) - resolve({ user: response.data.users_UserByAuthId}) - }) - .catch(error => { - console.log('apolloClient error getting user query', error.graphQLErrors, error.stack) - reject(error) - }) - }) - } - - /* Getting all Teams */ - - const networkInterfaceTeams = Apollo.lib.createNetworkInterface({ - uri: window.canvasApp.graphQL.masterAppApiUrl - }) - - networkInterfaceTeams.use([{ - applyMiddleware (req, next) { - req.options.headers = { - authorization: `Bearer ${accessToken}` - } - next() - } - }]) - - const apolloClientTeams = new Apollo.lib.ApolloClient({ - networkInterface: networkInterfaceTeams, - connectToDevTools: true - }) - - const TEAM_BY_OWNER_QUERY = Apollo.gql` - query teamsByOwnerQuery { - teams_TeamsByOwner { - id - name - slug - profile { - avatar - banner - description - motto - updatedAt - } - members { - member { - alias - } - } - fb { - id - name - slug - avatar - kind - status { - status - reason - createdAt - } - } - } - } - ` - - const getTeamByOwner = () => { - return new Promise((resolve, reject) => { - apolloClientTeams.query({ - query: TEAM_BY_OWNER_QUERY - }) - .then(response => { - window.localStorage.setItem('userTeams', JSON.stringify(response.data.teams_TeamsByOwner)) - resolve({ teams: response.data.teams_TeamsByOwner}) - }) - .catch(error => { - console.log('apolloClient error getting user teams', error.graphQLErrors, error.stack) - reject(error) - }) - }) - } - - /* Gettings All Events */ - - const networkInterfaceEvents = Apollo.lib.createNetworkInterface({ - uri: window.canvasApp.graphQL.masterAppApiUrl - }) - - const apolloClientEvents = new Apollo.lib.ApolloClient({ - networkInterface: networkInterfaceEvents, - connectToDevTools: true, - addTypename: false - }) - - const EVENTS_QUERY = Apollo.gql` - query events($maxStartDate: Int, $minEndDate: Int){ - events_Events(maxStartDate: $maxStartDate, minEndDate: $minEndDate){ - id - title - startDatetime - endDatetime - participants{ - clone{ - id - team{ - slug - } - bot{ - slug - } - } - } - } - } - ` - - const getCurrentEvents = () => { - var d = new Date() - var nowSeconds = Math.round(d.getTime() / 1000) - var twoWeeksAgoSeconds = nowSeconds - 1209600 - return new Promise((resolve, reject) => { - apolloClientEvents.query({ - query: EVENTS_QUERY, - variables: { maxStartDate: nowSeconds, minEndDate: twoWeeksAgoSeconds } - }) - .then(response => { - window.localStorage.setItem('currentEvents', JSON.stringify(response.data.events_Events)) - currentEvent = window.localStorage.getItem('currentEventObject') - if (currentEvent === null || currentEvent === '[]' || currentEvent === '') { - sharedStatus.currentEventIndex = -1 - } else { - currentEvent = JSON.parse(currentEvent) - sharedStatus.currentEventIndex = response.data.events_Events.findIndex(function (element) { - return element.id == currentEvent.id - }) - } - resolve({ currentEvents: response.data.events_Events}) - }) - .catch(error => { - console.log('apolloClient error getting current events', error.graphQLErrors, error.stack) - reject(error) - }) - }) - } - - /* Getting all Clones */ - - const networkInterfaceClones = Apollo.lib.createNetworkInterface({ - uri: window.canvasApp.graphQL.masterAppApiUrl - }) - - networkInterfaceClones.use([{ - applyMiddleware (req, next) { - req.options.headers = { - authorization: `Bearer ${accessToken}` - } - next() - } - }]) - - const apolloClientClones = new Apollo.lib.ApolloClient({ - networkInterface: networkInterfaceClones, - connectToDevTools: true - }) - - const CLONES_QUERY = Apollo.gql` - query Operations_Clones{ - operations_Clones { - id - authId - teamId - botId - mode - resumeExecution - beginDatetime - endDatetime - waitTime - state - stateDatetime - createDatetime - lastLogs - runAsTeam - summaryDate - buyAverage - sellAverage - marketRate - combinedProfitsA - combinedProfitsB - assetA - assetB - botType - teamName - botName - botAvatar - teamAvatar - processName - keyId - botSlug - } - } - ` - - const getClones = () => { - return new Promise((resolve, reject) => { - apolloClientClones.query({ - query: CLONES_QUERY - }) - .then(response => { - window.localStorage.setItem('userClones', JSON.stringify(response.data.operations_Clones)) - let clones = response.data.operations_Clones - for (let i = 0; i < clones.length; i++) { - let clone = clones[i] - if (clone.botType === 'Trading') { - let teamSlug = clone.teamName.toLowerCase() - teamSlug = teamSlug.replace(' ', '-') - let devTeam = ecosystem.getTeam(teamSlug) - let bot = ecosystem.getBot(devTeam, clone.botSlug) - if (bot !== undefined) { - bot.cloneId = clone.id - } - } - } - - resolve({ clones: response.data.operations_Clones}) - }) - .catch(error => { - console.log('apolloClient error getting user clones', error.graphQLErrors, error.stack) - reject(error) - }) - }) - } - - // To avoid race conditions, add asynchronous fetches to array - let fetchDataPromises = [] - - fetchDataPromises.push(getUser(), getTeamByOwner(), getCurrentEvents(), getClones(), authenticateUser()) - - // When all asynchronous fetches resolve, authenticate user or throw error. - await Promise.all(fetchDataPromises).then(result => { - - }, err => { - console.error('[ERROR] Login -> GraphQL Fetch Error -> err = ', err) - }) - thisObject.container.eventHandler.listenToEvent('onMouseClick', onClick) - async function authenticateUser () { - // TODO USER_PROFILE should be retrieved from saweb-api ecosystem - return - - let path = window.canvasApp.urlPrefix + 'AABrowserAPI/authenticateUser/' - - return new Promise( - function (resolve, reject) { - callServer(undefined, path, (result) => { - let responseFromServer = JSON.parse(result) - - err = responseFromServer.err - - if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { - console.log('Please make sure you create a new team!') - reject(err) - } - - window.USER_PROFILE = responseFromServer.userProfile - - currentLabel = 'Logged In' - resolve() - }) - } - ) - } } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err.stack) } + if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err.stack = ' + err.stack) } } } - function onClick () { + async function getEvents(accessToken, sharedStatus) { + var d = new Date() + var nowSeconds = Math.round(d.getTime() / 1000) + var twoWeeksAgoSeconds = nowSeconds - 1209600 + + let response = await axios({ + url: window.canvasApp.graphQL.masterAppApiUrl, + method: 'post', + data: { + query: + `query events($maxStartDate: Int, $minEndDate: Int){ + events_Events(maxStartDate: $maxStartDate, minEndDate: $minEndDate){ + id + title + startDatetime + endDatetime + participants{ + clone{ + id + team{ + slug + } + bot{ + slug + } + } + } + } + }`, + }, + variables: { + variables: { maxStartDate: nowSeconds, minEndDate: twoWeeksAgoSeconds } + }, + headers: { + authorization: 'Bearer ' + accessToken + } + }) + + if (response.data.errors) { + console.log('Error getting events: ' + JSON.stringify(response.data.errors)) + throw 'Error getting events: ' + JSON.stringify(response.data.errors) + } else { + window.localStorage.setItem('currentEvents', JSON.stringify(response.data.data.events_Events)) + currentEvent = window.localStorage.getItem('currentEventObject') + if (currentEvent === null || currentEvent === '[]' || currentEvent === '') { + sharedStatus.currentEventIndex = -1 + } else { + currentEvent = JSON.parse(currentEvent) + sharedStatus.currentEventIndex = response.data.data.events_Events.findIndex(function (element) { + return element.id == currentEvent.id + }) + } + } + } + + async function getClones(accessToken) { + let response = await axios({ + url: window.canvasApp.graphQL.masterAppApiUrl, + method: 'post', + data: { + query: + `query Operations_Clones{ + operations_Clones { + id + authId + teamId + botId + mode + resumeExecution + beginDatetime + endDatetime + waitTime + state + stateDatetime + createDatetime + lastLogs + runAsTeam + summaryDate + buyAverage + sellAverage + marketRate + combinedProfitsA + combinedProfitsB + assetA + assetB + botType + teamName + botName + botAvatar + teamAvatar + processName + keyId + botSlug + } + } + ` + }, + headers: { + authorization: 'Bearer ' + accessToken + } + }) + + if (response.data.errors) { + console.log('Error getting clones: ' + JSON.stringify(response.data.errors)) + throw 'Error getting clones: ' + JSON.stringify(response.data.errors) + } else { + window.localStorage.setItem('userClones', JSON.stringify(response.data.data.operations_Clones)) + let clones = response.data.data.operations_Clones + for (let i = 0; i < clones.length; i++) { + let clone = clones[i] + if (clone.botType === 'Trading') { + let teamSlug = clone.teamName.toLowerCase() + teamSlug = teamSlug.replace(' ', '-') + let devTeam = ecosystem.getTeam(teamSlug) + let bot = ecosystem.getBot(devTeam, clone.botSlug) + if (bot !== undefined) { + bot.cloneId = clone.id + } + } + } + } + } + + function onClick() { } - function getContainer (point) { - let container - - /* First we check if this point is inside this object UI. */ - + function getContainer(point) { + /* First we check if this point is inside this object UI. */ if (thisObject.container.frame.isThisPointHere(point, true) === true) { return this.container } else { - /* This point does not belong to this space. */ - + /* This point does not belong to this space. */ return undefined } } - function draw () { + function draw() { return // nothing to show. - - thisObject.container.frame.draw(false, false) - - let fontSize = 12 - let label = currentLabel - if (label === undefined) { label = '' }; - - let point = { - x: thisObject.container.frame.width * 1 / 3, - y: (thisObject.container.frame.height / 2) + 4 - } - - point = thisObject.container.frame.frameThisPoint(point) - - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' - browserCanvasContext.fillText(label, point.x, point.y) } } From 6621d85e69d294c85664dd166b2f29ceeb1b1b60 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Wed, 29 May 2019 16:32:50 +0200 Subject: [PATCH 23/29] Update README.md --- README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7222aa72d..609b31ce9 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,33 @@ The chart features lines at %B value 30 and 70 since those are the most common v 1. **Trading Simulation**: The Trading Simulation layer displays a backtest + fordwardtest (paper trading) of whatever strategies you have created in the system. At sign up, you are provided with an initial set of strategies so that you can be up and running as quickly as possible. By activating the Trading Simulation layer you should be able to see something like this: -![Trading-Simulation](https://user-images.githubusercontent.com/13994516/58548756-3f9c4300-820a-11e9-9b39-cb7e11ae0ee6.gif) +![Trading-Simulation](https://user-images.githubusercontent.com/13994516/58564550-6c158680-822d-11e9-8bb1-102912d4bfd0.gif)

+Notice Asset Balances in the bottom left corner of the screen. Asset A is your _base asset_. + +![Trading-Simulation-Asset-Balances](https://user-images.githubusercontent.com/13994516/58564447-3e304200-822d-11e9-9e90-e4f02212de5a.gif) +

+ +The dashed line represents the duration of the trade at the price of the _take profit_ event. Notice how the _base asset_ is exchanged for Asset B and back to the _base asset_ as the trade closes. + +![Trading-Simulation-Trade-Duration](https://user-images.githubusercontent.com/13994516/58564452-3ec8d880-822d-11e9-8b4e-4cd892df69e7.gif) +

+ +Notice the green horizontal bars indicating the _take profit_ value for each period (candle). _Take profit_ is managed in _phases_, marked with the corresponding icons. + +![Trading-Simulation-Take-Profit](https://user-images.githubusercontent.com/13994516/58564451-3ec8d880-822d-11e9-84c4-7e2147018297.gif) +

+ +Notice the red horizontal bars indicating the _stop_ value for each period (candle). Stop is managed in _phases_, marked with the corresponding icons. + +![Trading-Simulation-Stop](https://user-images.githubusercontent.com/13994516/58564450-3e304200-822d-11e9-8281-cc4b9cc22746.gif) +

+ +2. **Trading Conditions**: The Trading Conditions layer helps identify which _conditions_ are met at each candle. Notice how _conditions_ are highlighted as the cursor moves through different candles. + +![Trading-Simulation-Conditions](https://user-images.githubusercontent.com/13994516/58564448-3e304200-822d-11e9-967b-8c74fb8532fe.gif) +

+ + + From 2fd4a2558b3190f1a47ce41d65f9d46666dd8c31 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Wed, 29 May 2019 16:40:21 +0200 Subject: [PATCH 24/29] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 609b31ce9..9fc7cb5f2 100644 --- a/README.md +++ b/README.md @@ -168,5 +168,8 @@ Notice the red horizontal bars indicating the _stop_ value for each period (cand ![Trading-Simulation-Conditions](https://user-images.githubusercontent.com/13994516/58564448-3e304200-822d-11e9-967b-8c74fb8532fe.gif)

+3. **Simulation Strategies**: The Simulation Strategies layer identifies trigger on and trigger off events, signaling the activation and deactivation of strategies. +![Trading-Simulation-Strategies](https://user-images.githubusercontent.com/13994516/58565955-fd85f800-822f-11e9-9f95-9d0a477a4460.gif) +

From eb06d49a5aedb9ab95dd6396d26d9739b365b5d8 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Wed, 29 May 2019 18:46:38 +0200 Subject: [PATCH 25/29] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9fc7cb5f2..ced4a3059 100644 --- a/README.md +++ b/README.md @@ -173,3 +173,6 @@ Notice the red horizontal bars indicating the _stop_ value for each period (cand ![Trading-Simulation-Strategies](https://user-images.githubusercontent.com/13994516/58565955-fd85f800-822f-11e9-9f95-9d0a477a4460.gif)

+4. **Simulation Trades**: The Simulation Trades layer marks trades with a triangle whose hypotenuse connects the price at the _take position_ event with the _exit_ price. When the trade is profitable, the triangle is green; when the _exit_ happens at a loss, the triangle is red. + +![Trading-Simulation-Trades](https://user-images.githubusercontent.com/13994516/58574801-1a76f700-8241-11e9-9144-0db81636dace.gif) From ddfef803217e9b926a3ba83a9ecff548af2f3887 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Wed, 29 May 2019 19:21:36 +0200 Subject: [PATCH 26/29] Update README.md --- README.md | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index ced4a3059..162a19b94 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The Canvas App provides a visual environment for the _Charting System_ and the _ 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. ![Access-Demo](https://user-images.githubusercontent.com/13994516/58415158-dbe50f00-807d-11e9-812c-3b4de503bc34.gif) -

+


## Overview @@ -18,21 +18,21 @@ The first time you access the _Charts_, you will see the following screen, split Use the control in the center of the turquoise bar to pull the bar up and down in order to make more room to either application. ![Drag-Panels](https://user-images.githubusercontent.com/13994516/58413461-1ac49600-8079-11e9-9dd8-96f416e75b33.gif) -

+


Pulling the bar to the very top of the screen causes the _Charting System_ to stop consuming resources in your local machine, and gives you an ample view of the _Strategy Designer_. The **_Strategy Designer_** allows you to manage your _Trading System_. The structure represented by the various icons nested in a hierarchy of elements is the representation of the logic behind your _Strategies_. ![image](https://user-images.githubusercontent.com/13994516/58325421-f32bbe80-7e29-11e9-9478-9e6e4a02ae47.png) -

+


Pulling the bar to the very bottom of the screen causes the _Strategy Designer_ to stop consuming resources from your local machine, and offers a full-screen view of the _Charting System_. The **_Charting System_** plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. ![image](https://user-images.githubusercontent.com/13994516/58325972-c37db600-7e2b-11e9-9aa2-9f6faaf8dd94.png) -

+


The **_Superalgos Protocol_** (also refered to as the _protocol_) determines the structure in which all the information regarding a trading system is stored and—at the same time—provides a clear guidance on how traders using the various tools developed and distributed by the Superalgos Project shall create and automate their strategies. @@ -54,7 +54,7 @@ The layer title bar can have 3 possible background colors: 3. **Yellow**: layer is loading. If it stays yellow, it means it can't load fully. ![Layers](https://user-images.githubusercontent.com/13994516/58434206-c04c2980-80ba-11e9-964b-8223ad99eb0b.gif) -

+


### Main Elements @@ -75,7 +75,7 @@ There are many things you can do with your mouse wheel. 1. Scroll elsewhere over the chart to zoom in and out. The App will not only zoom in and out of the chart, but also automatically adjust the time period to the most convenient one (for the current zoom level). ![Mouse-Wheel](https://user-images.githubusercontent.com/13994516/58434568-a01d6a00-80bc-11e9-9a58-3edd4852f07c.gif) -

+


### Minimizing & Moving Floating Panels @@ -84,7 +84,7 @@ To minimize a panel, click on the small triangle on the right of their title bar You may also drag and drop the panels by right-clicking on the title bar. ![Panels](https://user-images.githubusercontent.com/13994516/58434864-1bcbe680-80be-11e9-8262-ccca1685f68b.gif) -

+


### Layers @@ -95,7 +95,7 @@ Superalgos is an open system, meaning anyone can build layers for the _Charting 1. **Candles**: Typical candlesticks. ![Candles](https://user-images.githubusercontent.com/13994516/58435905-1a50ed00-80c3-11e9-860a-bb4afc8e0f42.gif) -

+


2. **Volumes**: I innovated a bit placing the buy volume at the bottom (in green), and the sell volume at the top (in red). @@ -105,27 +105,27 @@ Superalgos is an open system, meaning anyone can build layers for the _Charting 3. **Candle Stairs Patterns**: This is an unusual pattern proving any dataset may be plotted on the charts (and by extension, that anything can be added to the system). A Stair Pattern is defined as a set of candles going in the same direction, either up or down. You can think of these patterns as "Candle Channels", as they represent channels with an up or down direction based on underlying candles direction. ![Candle-Stairs](https://user-images.githubusercontent.com/13994516/58435906-1ae98380-80c3-11e9-893e-1f8cd1b5c925.gif) -

+


4. **Volume Stairs Patterns**: A similar concept, this time with volumes. Whenever a sequence of volume bars is found where each one is bigger than the previous one, they are bundled together in a "Stair". The same applies when they are going down (the next is smaller than the previous one). For a trading bot, this serves to identify if sell or buy volumes are raising or declining, if any. ![Volume-Stairs](https://user-images.githubusercontent.com/13994516/58435908-1ae98380-80c3-11e9-8c0d-87a105b4e021.gif) -

+


5. **Bollinger Bands**: This is the traditional [Bollinger Bands indicator](https://en.wikipedia.org/wiki/Bollinger_Bands). Bollinger Bands have a moving average, in our case calculated with the last 20 periods (the line in the middle of the bands). We are plotting the moving average with one color when it is going up, and with a different color when it's going down. The upper band is at 2 Standard Deviations from the center, pretty much like the lower band, also at 2 Standard Deviations. These are the most widely used Bollinger Bands settings. ![Bollinger-Bands](https://user-images.githubusercontent.com/13994516/58435901-1a50ed00-80c3-11e9-853a-68d39ba7958b.gif) -

+


6. **Percentage Bandwidth or %B**: This is a well-known indicator that derives from the Bollinger Bands. In a nutshell it tells you how close the price is either to the upper band or the lower band at any point in time. When the price is in the middle of the bands (it is calculated with the close value of each candle), then %B is in the middle of its chart, at value 50. When the price touches the upper band, then %B is at 100, and finally when the price is at the lower band, then %B is at 0. ![Bollinger-Bands-Percentage-Bandwidth](https://user-images.githubusercontent.com/13994516/58435903-1a50ed00-80c3-11e9-90d5-e0d5293c76ad.gif) -

+


The chart features lines at %B value 30 and 70 since those are the most common values for traders to forecast when a reversal may happen. In our chart, %B is the one represented at #1. I've found useful to add a moving average in order to smooth volatility a bit, and to be able to ask—at any time—if it is going up or down. The moving average calculated with the last 5 %B values is plotted as line #2. Finally I also added a property called Bandwidth, which represents the separation of the upper band from the lower band. It is a measure of the volatility and is plotted at #3. ![image](https://user-images.githubusercontent.com/9479367/56834223-1c7c1d80-6871-11e9-9687-ae5dc12d0336.png) -

+


7. **Bollinger Channels**: This is a non-standard indicator derived from the Bollinger Bands. These types of channels are calculated using the Bollinger Bands moving average. Essentially an upward channel begins when the moving average turns from going down to going up, and the channel finishes when it turns from going up to down. A downward channel starts when the Bollinger Band moving average turns from going up to down, and it finishes when it starts going up again. Upward channels are plotted in green, while downward channels in red. Additional information can be found at the indicator's panel, like the number of periods contained at the channel. @@ -134,45 +134,46 @@ The chart features lines at %B value 30 and 70 since those are the most common v 8. **Bollinger Sub-Channels**: If we consider that one Bollinger Channel can have sub-channels with the same direction (up or down) but different slopes, then we get to the concept of Bollinger Sub-Channels. The most important property of a sub-channel is its slope. The possible values are: side, gentle, medium, high and extreme. With this information, a trading bot could easily ask if it is in a sub-channel with a certain slope and for how many periods. ![Bollinger-Sub-Channels](https://user-images.githubusercontent.com/13994516/58497358-146b1280-817c-11e9-83df-219d0fffa9f0.gif) -

+


#### Private Layers 1. **Trading Simulation**: The Trading Simulation layer displays a backtest + fordwardtest (paper trading) of whatever strategies you have created in the system. At sign up, you are provided with an initial set of strategies so that you can be up and running as quickly as possible. By activating the Trading Simulation layer you should be able to see something like this: ![Trading-Simulation](https://user-images.githubusercontent.com/13994516/58564550-6c158680-822d-11e9-8bb1-102912d4bfd0.gif) -

+


Notice Asset Balances in the bottom left corner of the screen. Asset A is your _base asset_. ![Trading-Simulation-Asset-Balances](https://user-images.githubusercontent.com/13994516/58564447-3e304200-822d-11e9-9e90-e4f02212de5a.gif) -

+


The dashed line represents the duration of the trade at the price of the _take profit_ event. Notice how the _base asset_ is exchanged for Asset B and back to the _base asset_ as the trade closes. ![Trading-Simulation-Trade-Duration](https://user-images.githubusercontent.com/13994516/58564452-3ec8d880-822d-11e9-8b4e-4cd892df69e7.gif) -

+


Notice the green horizontal bars indicating the _take profit_ value for each period (candle). _Take profit_ is managed in _phases_, marked with the corresponding icons. ![Trading-Simulation-Take-Profit](https://user-images.githubusercontent.com/13994516/58564451-3ec8d880-822d-11e9-84c4-7e2147018297.gif) -

+


Notice the red horizontal bars indicating the _stop_ value for each period (candle). Stop is managed in _phases_, marked with the corresponding icons. ![Trading-Simulation-Stop](https://user-images.githubusercontent.com/13994516/58564450-3e304200-822d-11e9-8281-cc4b9cc22746.gif) -

+


2. **Trading Conditions**: The Trading Conditions layer helps identify which _conditions_ are met at each candle. Notice how _conditions_ are highlighted as the cursor moves through different candles. ![Trading-Simulation-Conditions](https://user-images.githubusercontent.com/13994516/58564448-3e304200-822d-11e9-967b-8c74fb8532fe.gif) -

+


3. **Simulation Strategies**: The Simulation Strategies layer identifies trigger on and trigger off events, signaling the activation and deactivation of strategies. ![Trading-Simulation-Strategies](https://user-images.githubusercontent.com/13994516/58565955-fd85f800-822f-11e9-9f95-9d0a477a4460.gif) -

+


4. **Simulation Trades**: The Simulation Trades layer marks trades with a triangle whose hypotenuse connects the price at the _take position_ event with the _exit_ price. When the trade is profitable, the triangle is green; when the _exit_ happens at a loss, the triangle is red. ![Trading-Simulation-Trades](https://user-images.githubusercontent.com/13994516/58574801-1a76f700-8241-11e9-9144-0db81636dace.gif) +


From aad46b681d0fda9e2f0cc7b82dde605a17285d2d Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Wed, 29 May 2019 19:26:45 +0200 Subject: [PATCH 27/29] Update README.md --- README.md | 67 +++++++++++++++++++------------------------------------ 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 162a19b94..ec9688d9e 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,7 @@ The Canvas App provides a visual environment for the _Charting System_ and the _ 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. ![Access-Demo](https://user-images.githubusercontent.com/13994516/58415158-dbe50f00-807d-11e9-812c-3b4de503bc34.gif) -


- +

## Overview The first time you access the _Charts_, you will see the following screen, split in half. The top half features the space used by the _Charting System_ and the bottom half features the _Strategy Designer_. @@ -18,22 +17,19 @@ The first time you access the _Charts_, you will see the following screen, split Use the control in the center of the turquoise bar to pull the bar up and down in order to make more room to either application. ![Drag-Panels](https://user-images.githubusercontent.com/13994516/58413461-1ac49600-8079-11e9-9dd8-96f416e75b33.gif) -


- +

Pulling the bar to the very top of the screen causes the _Charting System_ to stop consuming resources in your local machine, and gives you an ample view of the _Strategy Designer_. The **_Strategy Designer_** allows you to manage your _Trading System_. The structure represented by the various icons nested in a hierarchy of elements is the representation of the logic behind your _Strategies_. ![image](https://user-images.githubusercontent.com/13994516/58325421-f32bbe80-7e29-11e9-9478-9e6e4a02ae47.png) -


- +

Pulling the bar to the very bottom of the screen causes the _Strategy Designer_ to stop consuming resources from your local machine, and offers a full-screen view of the _Charting System_. The **_Charting System_** plots indicators data along with the actions taken by the _Strategy Engine_ and the _Executor_, integrated with market data. ![image](https://user-images.githubusercontent.com/13994516/58325972-c37db600-7e2b-11e9-9aa2-9f6faaf8dd94.png) -


- +

The **_Superalgos Protocol_** (also refered to as the _protocol_) determines the structure in which all the information regarding a trading system is stored and—at the same time—provides a clear guidance on how traders using the various tools developed and distributed by the Superalgos Project shall create and automate their strategies. > You don't really _need_ to know this, but for the sake of context... @@ -54,8 +50,7 @@ The layer title bar can have 3 possible background colors: 3. **Yellow**: layer is loading. If it stays yellow, it means it can't load fully. ![Layers](https://user-images.githubusercontent.com/13994516/58434206-c04c2980-80ba-11e9-964b-8223ad99eb0b.gif) -


- +

### Main Elements Notice the following three elements relative to the position of the mouse pointer: @@ -75,8 +70,7 @@ There are many things you can do with your mouse wheel. 1. Scroll elsewhere over the chart to zoom in and out. The App will not only zoom in and out of the chart, but also automatically adjust the time period to the most convenient one (for the current zoom level). ![Mouse-Wheel](https://user-images.githubusercontent.com/13994516/58434568-a01d6a00-80bc-11e9-9a58-3edd4852f07c.gif) -


- +

### Minimizing & Moving Floating Panels To minimize a panel, click on the small triangle on the right of their title bar. This will automatically position the panel at the bottom of the screen. Clicking again restores the panel to its previous position. @@ -84,8 +78,7 @@ To minimize a panel, click on the small triangle on the right of their title bar You may also drag and drop the panels by right-clicking on the title bar. ![Panels](https://user-images.githubusercontent.com/13994516/58434864-1bcbe680-80be-11e9-8262-ccca1685f68b.gif) -


- +

### Layers Superalgos is an open system, meaning anyone can build layers for the _Charting System_. So far—with our current limited manpower—we have created 8 public layers (available without logging in) and 2 private layers (available to logged-in users): @@ -95,8 +88,7 @@ Superalgos is an open system, meaning anyone can build layers for the _Charting 1. **Candles**: Typical candlesticks. ![Candles](https://user-images.githubusercontent.com/13994516/58435905-1a50ed00-80c3-11e9-860a-bb4afc8e0f42.gif) -


- +

2. **Volumes**: I innovated a bit placing the buy volume at the bottom (in green), and the sell volume at the top (in red). ![Volumes](https://user-images.githubusercontent.com/13994516/58435907-1ae98380-80c3-11e9-90e5-de9052b166c4.gif) @@ -105,75 +97,62 @@ Superalgos is an open system, meaning anyone can build layers for the _Charting 3. **Candle Stairs Patterns**: This is an unusual pattern proving any dataset may be plotted on the charts (and by extension, that anything can be added to the system). A Stair Pattern is defined as a set of candles going in the same direction, either up or down. You can think of these patterns as "Candle Channels", as they represent channels with an up or down direction based on underlying candles direction. ![Candle-Stairs](https://user-images.githubusercontent.com/13994516/58435906-1ae98380-80c3-11e9-893e-1f8cd1b5c925.gif) -


- +

4. **Volume Stairs Patterns**: A similar concept, this time with volumes. Whenever a sequence of volume bars is found where each one is bigger than the previous one, they are bundled together in a "Stair". The same applies when they are going down (the next is smaller than the previous one). For a trading bot, this serves to identify if sell or buy volumes are raising or declining, if any. ![Volume-Stairs](https://user-images.githubusercontent.com/13994516/58435908-1ae98380-80c3-11e9-8c0d-87a105b4e021.gif) -


- +

5. **Bollinger Bands**: This is the traditional [Bollinger Bands indicator](https://en.wikipedia.org/wiki/Bollinger_Bands). Bollinger Bands have a moving average, in our case calculated with the last 20 periods (the line in the middle of the bands). We are plotting the moving average with one color when it is going up, and with a different color when it's going down. The upper band is at 2 Standard Deviations from the center, pretty much like the lower band, also at 2 Standard Deviations. These are the most widely used Bollinger Bands settings. ![Bollinger-Bands](https://user-images.githubusercontent.com/13994516/58435901-1a50ed00-80c3-11e9-853a-68d39ba7958b.gif) -


- +

6. **Percentage Bandwidth or %B**: This is a well-known indicator that derives from the Bollinger Bands. In a nutshell it tells you how close the price is either to the upper band or the lower band at any point in time. When the price is in the middle of the bands (it is calculated with the close value of each candle), then %B is in the middle of its chart, at value 50. When the price touches the upper band, then %B is at 100, and finally when the price is at the lower band, then %B is at 0. ![Bollinger-Bands-Percentage-Bandwidth](https://user-images.githubusercontent.com/13994516/58435903-1a50ed00-80c3-11e9-90d5-e0d5293c76ad.gif) -


- +

The chart features lines at %B value 30 and 70 since those are the most common values for traders to forecast when a reversal may happen. In our chart, %B is the one represented at #1. I've found useful to add a moving average in order to smooth volatility a bit, and to be able to ask—at any time—if it is going up or down. The moving average calculated with the last 5 %B values is plotted as line #2. Finally I also added a property called Bandwidth, which represents the separation of the upper band from the lower band. It is a measure of the volatility and is plotted at #3. ![image](https://user-images.githubusercontent.com/9479367/56834223-1c7c1d80-6871-11e9-9687-ae5dc12d0336.png) -


- +

7. **Bollinger Channels**: This is a non-standard indicator derived from the Bollinger Bands. These types of channels are calculated using the Bollinger Bands moving average. Essentially an upward channel begins when the moving average turns from going down to going up, and the channel finishes when it turns from going up to down. A downward channel starts when the Bollinger Band moving average turns from going up to down, and it finishes when it starts going up again. Upward channels are plotted in green, while downward channels in red. Additional information can be found at the indicator's panel, like the number of periods contained at the channel. ![Bollinger-Channels](https://user-images.githubusercontent.com/13994516/58497359-146b1280-817c-11e9-9f4d-99fee41cd27f.gif) - +

8. **Bollinger Sub-Channels**: If we consider that one Bollinger Channel can have sub-channels with the same direction (up or down) but different slopes, then we get to the concept of Bollinger Sub-Channels. The most important property of a sub-channel is its slope. The possible values are: side, gentle, medium, high and extreme. With this information, a trading bot could easily ask if it is in a sub-channel with a certain slope and for how many periods. ![Bollinger-Sub-Channels](https://user-images.githubusercontent.com/13994516/58497358-146b1280-817c-11e9-83df-219d0fffa9f0.gif) -


- +

#### Private Layers 1. **Trading Simulation**: The Trading Simulation layer displays a backtest + fordwardtest (paper trading) of whatever strategies you have created in the system. At sign up, you are provided with an initial set of strategies so that you can be up and running as quickly as possible. By activating the Trading Simulation layer you should be able to see something like this: ![Trading-Simulation](https://user-images.githubusercontent.com/13994516/58564550-6c158680-822d-11e9-8bb1-102912d4bfd0.gif) -


- +

Notice Asset Balances in the bottom left corner of the screen. Asset A is your _base asset_. ![Trading-Simulation-Asset-Balances](https://user-images.githubusercontent.com/13994516/58564447-3e304200-822d-11e9-9e90-e4f02212de5a.gif) -


- +

The dashed line represents the duration of the trade at the price of the _take profit_ event. Notice how the _base asset_ is exchanged for Asset B and back to the _base asset_ as the trade closes. ![Trading-Simulation-Trade-Duration](https://user-images.githubusercontent.com/13994516/58564452-3ec8d880-822d-11e9-8b4e-4cd892df69e7.gif) -


- +

Notice the green horizontal bars indicating the _take profit_ value for each period (candle). _Take profit_ is managed in _phases_, marked with the corresponding icons. ![Trading-Simulation-Take-Profit](https://user-images.githubusercontent.com/13994516/58564451-3ec8d880-822d-11e9-84c4-7e2147018297.gif) -


- +

Notice the red horizontal bars indicating the _stop_ value for each period (candle). Stop is managed in _phases_, marked with the corresponding icons. ![Trading-Simulation-Stop](https://user-images.githubusercontent.com/13994516/58564450-3e304200-822d-11e9-8281-cc4b9cc22746.gif) -


- +

2. **Trading Conditions**: The Trading Conditions layer helps identify which _conditions_ are met at each candle. Notice how _conditions_ are highlighted as the cursor moves through different candles. ![Trading-Simulation-Conditions](https://user-images.githubusercontent.com/13994516/58564448-3e304200-822d-11e9-967b-8c74fb8532fe.gif) -


- +

3. **Simulation Strategies**: The Simulation Strategies layer identifies trigger on and trigger off events, signaling the activation and deactivation of strategies. ![Trading-Simulation-Strategies](https://user-images.githubusercontent.com/13994516/58565955-fd85f800-822f-11e9-9f95-9d0a477a4460.gif) -


- +

4. **Simulation Trades**: The Simulation Trades layer marks trades with a triangle whose hypotenuse connects the price at the _take position_ event with the _exit_ price. When the trade is profitable, the triangle is green; when the _exit_ happens at a loss, the triangle is red. ![Trading-Simulation-Trades](https://user-images.githubusercontent.com/13994516/58574801-1a76f700-8241-11e9-9144-0db81636dace.gif) -


+

From d2594cc498af2b3ff2c1823a1c996f7eeb2112cd Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Wed, 29 May 2019 19:47:41 +0200 Subject: [PATCH 28/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec9688d9e..c8e240072 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ Notice Asset Balances in the bottom left corner of the screen. Asset A is your _ ![Trading-Simulation-Asset-Balances](https://user-images.githubusercontent.com/13994516/58564447-3e304200-822d-11e9-9e90-e4f02212de5a.gif)

-The dashed line represents the duration of the trade at the price of the _take profit_ event. Notice how the _base asset_ is exchanged for Asset B and back to the _base asset_ as the trade closes. +The dashed line represents the duration of the trade at the price of the _take position_ event. Notice how the _base asset_ is exchanged for Asset B and back to the _base asset_ as the trade closes. ![Trading-Simulation-Trade-Duration](https://user-images.githubusercontent.com/13994516/58564452-3ec8d880-822d-11e9-8b4e-4cd892df69e7.gif)

From a2a085a850792ceea91ae0c34a0d0053d332ec7f Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Wed, 29 May 2019 20:11:33 +0200 Subject: [PATCH 29/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c8e240072..789f59b54 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ To minimize a panel, click on the small triangle on the right of their title bar You may also drag and drop the panels by right-clicking on the title bar. -![Panels](https://user-images.githubusercontent.com/13994516/58434864-1bcbe680-80be-11e9-8262-ccca1685f68b.gif) +![Panels](https://user-images.githubusercontent.com/13994516/58580610-d0e0d900-824d-11e9-8c57-501eb9429ba6.gif)

### Layers