diff --git a/.vs/AAWebPlatform/v15/.suo b/.vs/AAWebPlatform/v15/.suo index a4cbb8bd0..22e83fd57 100644 Binary files a/.vs/AAWebPlatform/v15/.suo and b/.vs/AAWebPlatform/v15/.suo differ diff --git a/AAWebPlatform.njsproj b/AAWebPlatform.njsproj index e082539ca..53dafe941 100644 --- a/AAWebPlatform.njsproj +++ b/AAWebPlatform.njsproj @@ -113,9 +113,6 @@ - - Code - diff --git a/ecosystem.json b/ecosystem.json deleted file mode 100644 index 850ecb930..000000000 --- a/ecosystem.json +++ /dev/null @@ -1,255 +0,0 @@ -{ - "devTeams": [ - { - "codeName": "AAMasters", - "displayName": "AA Masters", - "organization": { - "name": "AAMasters", - "type": "Open Source Community", - "displayName": "AA Masters", - "location": "Global", - "leader": "Luis Molina", - "logo": "AAMasters.jpg" - }, - "teamMembers": [ - { - "member": { - "displayName": "Luis Molina", - "githubUsername": "Luis-Fernando-Molina", - "profilePicture": "Luis.jpg" - } - } - ], - "bots": [ - { - "codeName": "AAOlivia", - "displayName": "Olivia", - "type": "Indicator", - "version": { - "number": "1.0.0", - "status": "Mantained" - }, - "products": [ - { - "codeName": "Candles", - "displayName": "Market Candles per Period", - "description": "Two sets of files per period that contains candles.", - "storageAccount": "aaolivia", - "sets": [ - { - "type": "Market Files", - "validPeriods": [ "24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs" ], - "filePath": "@Exchange/Output/Candles/Multi-Period-Market/@Period", - "fileName": "@AssetA_@AssetB.json" - }, - { - "type": "Daily Files", - "validPeriods": [ "45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min" ], - "filePath": "@Exchange/Output/Candles/Multi-Period-Daily/@Period/@Year/@Month/@Day", - "fileName": "@AssetA_@AssetB.json" - } - ], - "exchangeList": [ - { - "name": "Poloniex" - } - ] - , - "plotter": { - "devTeam": "AAMasters", - "repo": "Plotters-Candles-Volumes", - "moduleName": "Candles" - } - }, - { - "codeName": "Volumes", - "displayName": "Buy and Sell Volumes", - "description": "Two sets of files per period that contains buy and sell volumes.", - "storageAccount": "aaolivia", - "sets": [ - { - "type": "Market Files", - "validPeriods": [ "24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs" ], - "filePath": "@Exchange/Output/Volumes/Multi-Period-Market/@Period", - "fileName": "@AssetA_@AssetB.json" - }, - { - "type": "Daily Files", - "validPeriods": [ "45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min" ], - "filePath": "@Exchange/Output/Volumes/Multi-Period-Daily/@Period/@Year/@Month/@Day", - "fileName": "@AssetA_@AssetB.json" - } - ], - "exchangeList": [ - { - "name": "Poloniex" - } - ], - "plotter": { - "devTeam": "AAMasters", - "repo": "Plotters-Candles-Volumes", - "moduleName": "Volumes" - } - } - ], - "storage": { - "sas": "?sv=2017-04-17&ss=f&srt=sco&sp=rl&se=2018-12-31T02:34:32Z&st=2018-02-01T18:34:32Z&spr=https,http&sig=24UJjGDVpPrHjhBoZtt3iKj4sxgenfSV4VTJD2v0q1U%3D", - "fileUri": "https://aaolivia.file.core.windows.net" - } - }, - { - "codeName": "AATom", - "displayName": "Tom", - "type": "Indicator", - "version": { - "number": "1.0.0", - "status": "Mantained" - }, - "products": [ - { - "codeName": "Candle-Stairs", - "displayName": "Candle-Stairs Patters", - "description": "Two sets of files per period that contains candle-stairs patterns.", - "storageAccount": "aatom", - "sets": [ - { - "type": "Market Files", - "validPeriods": [ "24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs" ], - "filePath": "@Exchange/Tom/dataSet.V1/Output/Candle-Stairs/Multi-Period-Market/@Period", - "fileName": "@AssetA_@AssetB.json" - }, - { - "type": "Daily Files", - "validPeriods": [ "45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min" ], - "filePath": "@Exchange/Tom/dataSet.V1/Output/Candle-Stairs/Multi-Period-Daily/@Period/@Year/@Month/@Day", - "fileName": "@AssetA_@AssetB.json" - } - ], - "exchangeList": [ - { - "name": "Poloniex" - } - ], - "plotter": { - "devTeam": "AAMasters", - "repo": "Plotters-Stairs-Patterns", - "moduleName": "CandleStairs" - } - }, - { - "codeName": "Volume-Stairs", - "displayName": "Volume-Stairs Patters", - "description": "Two sets of files per period that contains volume-stairs patterns.", - "storageAccount": "aatom", - "sets": [ - { - "type": "Market Files", - "validPeriods": [ "24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs" ], - "filePath": "@Exchange/Tom/dataSet.V1/Output/Volume-Stairs/Multi-Period-Market/@Period", - "fileName": "@AssetA_@AssetB.json" - }, - { - "type": "Daily Files", - "validPeriods": [ "45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min" ], - "filePath": "@Exchange/Tom/dataSet.V1/Output/Volume-Stairs/Multi-Period-Daily/@Period/@Year/@Month/@Day", - "fileName": "@AssetA_@AssetB.json" - } - ], - "exchangeList": [ - { - "name": "Poloniex" - } - ], - "plotter": { - "devTeam": "AAMasters", - "repo": "Plotters-Stairs-Patterns", - "moduleName": "VolumeStairs" - } - } - ], - "storage": { - "sas": "?sv=2017-04-17&ss=f&srt=sco&sp=r&se=2018-12-31T19:28:33Z&st=2018-02-22T11:28:33Z&spr=https&sig=YaprSp9zO%2Fsz0nPPWwPMqPACxZTnYhSWKApfun%2Bfez4%3D", - "fileUri": "https://aatom.file.core.windows.net" - } - }, - { - "codeName": "AAMariam", - "displayName": "Mariam", - "type": "Trading", - "version": { - "number": "1.0.0", - "status": "Mantained" - }, - "products": [ - { - "codeName": "Trading History", - "displayName": "Mariam Trading History", - "description": "General information about Mariam trading history.", - "storageAccount": "aamariam", - "sets": [ - { - "type": "Single File", - "validPeriods": [ "24-hs", "12-hs", "08-hs", "06-hs", "04-hs", "03-hs", "02-hs", "01-hs", "45-min", "40-min", "30-min", "20-min", "15-min", "10-min", "05-min", "04-min", "03-min", "02-min", "01-min" ], - "filePath": "@Exchange/Mariam/dataSet.V1/Output/Trading-Process", - "fileName": "Execution.History.json" - } - ], - "exchangeList": [ - { - "name": "Poloniex" - } - ], - "plotter": { - "devTeam": "AAMasters", - "repo": "Plotters-Trading", - "moduleName": "History" - } - } - ], - "storage": { - "sas": "?sv=2017-07-29&ss=f&srt=sco&sp=r&se=2018-12-30T23:44:52Z&st=2018-02-25T15:44:52Z&spr=https&sig=0pzOTcVAAOkgH7C4KmA1Rbs15kyjvVC1XFCsLQYjXKU%3D", - "fileUri": "https://aamariam.file.core.windows.net" - } - } - ], - "plotters": [ - { - "description": "Plots traditional red and green candles.", - "repo": "Plotters-Candles-Volumes", - "moduleName": "Candles", - "target": "Timeline" - }, - { - "description": "Plots volumes separated in buy and sell.", - "repo": "Plotters-Candles-Volumes", - "moduleName": "Volumes", - "target": "Timeline" - }, - { - "description": "Plots Candle Stairs patterns.", - "repo": "Plotters-Stairs-Patterns", - "moduleName": "CandleStairs", - "target": "Timeline" - }, - { - "description": "Plots Volume Stairs patterns.", - "repo": "Plotters-Stairs-Patterns", - "moduleName": "VolumeStairs", - "target": "Timeline" - }, - { - "description": "Plots a trading history.", - "repo": "Plotters-Trading", - "moduleName": "History", - "target": "Timeline" - }, - { - "description": "Plots trading decitions in an easy to understand way.", - "repo": "Plotters-Trading", - "moduleName": "Details", - "target": "Timeline" - } - ] - } - ] -} \ No newline at end of file diff --git a/server.js b/server.js index 1b8a9449b..acf52b795 100644 --- a/server.js +++ b/server.js @@ -6,7 +6,7 @@ if (CONSOLE_LOG === true) { } -let debugMode = false; // This forces the server to read Plotters from the local drive. +let debugMode = true; // This forces the server to read Plotters from the local drive. if (CONSOLE_LOG === true && debugMode === true) { @@ -14,7 +14,7 @@ if (CONSOLE_LOG === true && debugMode === true) { } -let githubPages = new Map; +let githubData = new Map; let ecosystem; let ecosystemObject; @@ -34,7 +34,7 @@ function initialize() { let fs = require('fs'); try { - let fileName = 'ecosystem.json'; + let fileName = '../AAPlatform/ecosystem.json'; fs.readFile(fileName, onFileRead); function onFileRead(err, file) { @@ -83,7 +83,7 @@ function onBrowserRequest(request, response) { case "clear-cache": { - githubPages = new Map; + githubData = new Map; respondWithContent("command acepted", response); @@ -91,6 +91,14 @@ function onBrowserRequest(request, response) { break; case "Plotters.js": { + /* + + This file is build dinamically because it has the code to instantiate the different configured Plotters. The instantiation code + will be generated using a pre-defined string with replacement points. We will go through the configuration file to learn + about all the possible plotters the system can load. + + */ + let fs = require('fs'); try { let fileName = 'Plotters.js'; @@ -121,8 +129,6 @@ function onBrowserRequest(request, response) { let plotter = devTeam.plotters[j]; - /* Now each of these layers has a plotter that we need to define on the Plotter.js file. */ - let caseStringCopy = caseString; let newFunctionName = devTeam.codeName + plotter.repo + plotter.moduleName; @@ -158,6 +164,13 @@ function onBrowserRequest(request, response) { case "Ecosystem.js": { + /* + + At this page we need to insert the configuration file for the whole system that we assamble before at the begining of this module + execution. So what we do is to load a template file with an insertion point where the configuration json is injected in. + + */ + let fs = require('fs'); try { let fileName = 'Ecosystem.js'; @@ -190,6 +203,15 @@ function onBrowserRequest(request, response) { case "Plotters": // This means the plotter folder, not to be confused with the Plotters script! { + /* + + There are 3 different sources for plotters: + + 1.If we are in debug mode, from the filesystem. + 2.If we are in production from a cache we keep in memory at the node server. + 3.If the cache does not have the file, then we get it from github.com, put in on the cache and serve it. + + */ if (debugMode === true) { @@ -197,7 +219,7 @@ function onBrowserRequest(request, response) { } else { - let cacheVersion = githubPages.get(requestParameters[2] + requestParameters[3] + requestParameters[4]) + let cacheVersion = githubData.get(requestParameters[2] + requestParameters[3] + requestParameters[4]) if (cacheVersion !== undefined) { @@ -226,7 +248,7 @@ function onBrowserRequest(request, response) { respondWithContent(cleanString, response); - githubPages.set(requestParameters[2] + requestParameters[3] + requestParameters[4], cleanString); + githubData.set(requestParameters[2] + requestParameters[3] + requestParameters[4], cleanString); } }