From 2c588cba717cf5e1afbf71afea01a29fb0068d91 Mon Sep 17 00:00:00 2001 From: Matias Date: Wed, 29 May 2019 11:29:37 -0300 Subject: [PATCH] Adding stable version --- src/config/ecosystem.json | 886 +++++++++++++++++++++++++++ src/models/ecosystem.js | 30 +- src/schema/mutations/AddTeam.js | 36 +- src/schema/mutations/DeleteTeam.js | 6 +- src/schema/queries/Ecosystem.js | 2 +- src/schema/queries/FileContent.js | 20 +- src/schema/types/Bot.js | 1 + src/schema/types/PlotterReference.js | 11 +- src/schema/types/input/DeleteTeam.js | 18 + src/schema/types/input/Team.js | 3 +- src/schema/types/input/index.js | 6 +- src/storage/CopyBot.js | 2 +- src/storage/CopyBots.js | 22 + src/storage/CopySimulator.js | 2 +- src/storage/CreateTeam.js | 27 - 15 files changed, 1005 insertions(+), 67 deletions(-) create mode 100644 src/config/ecosystem.json create mode 100644 src/schema/types/input/DeleteTeam.js create mode 100644 src/storage/CopyBots.js delete mode 100644 src/storage/CreateTeam.js diff --git a/src/config/ecosystem.json b/src/config/ecosystem.json new file mode 100644 index 000000000..1c76887be --- /dev/null +++ b/src/config/ecosystem.json @@ -0,0 +1,886 @@ +{ + "authId": "", + "devTeams": [ + { + "codeName": "AAMasters", + "displayName": "Masters", + "host": { + "url": "http://localhost:4100/", + "storage": "https://aadevelop.blob.core.windows.net", + "container": "aamasters", + "accessKey": "?st=2019-05-21T12%3A00%3A00Z&se=2020-05-22T12%3A00%3A00Z&sp=rl&sv=2018-03-28&sr=c&sig=PsGM67klPfLjdfjymziEQEQcD5Wzy3SMcZWsTCQrhd8%3D" + }, + "bots": [ + { + "codeName": "AAOlivia", + "displayName": "Olivia", + "type": "Indicator", + "profilePicture": "Olivia.png", + "repo": "AAOlivia-Indicator-Bot", + "configFile": "this.bot.config.json", + "products": [ + { + "codeName": "Candles", + "displayName": "Candles", + "description": "Two sets of files per period that contains candles.", + "dataSets": [ + { + "codeName": "Multi-Period-Market", + "type": "Market Files", + "validPeriods": [ + "24-hs", + "12-hs", + "08-hs", + "06-hs", + "04-hs", + "03-hs", + "02-hs", + "01-hs" + ], + "filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candles/Multi-Period-Market/@Period", + "fileName": "@AssetA_@AssetB.json" + }, + { + "codeName": "Multi-Period-Daily", + "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": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candles/Multi-Period-Daily/@Period/@Year/@Month/@Day", + "fileName": "@AssetA_@AssetB.json", + "dataRange": { + "filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candles/Multi-Period-Daily", + "fileName": "Data.Range.@AssetA_@AssetB.json" + } + } + ], + "exchangeList": [ + { + "name": "Poloniex" + }, + { + "name": "Coss" + } + ], + "plotter": { + "devTeam": "AAMasters", + "codeName": "PlottersCandlesVolumes", + "moduleName": "Candles" + } + }, + { + "codeName": "Volumes", + "displayName": "Buy and Sell Volumes", + "description": "Two sets of files per period that contains buy and sell volumes.", + "dataSets": [ + { + "codeName": "Multi-Period-Market", + "type": "Market Files", + "validPeriods": [ + "24-hs", + "12-hs", + "08-hs", + "06-hs", + "04-hs", + "03-hs", + "02-hs", + "01-hs" + ], + "filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volumes/Multi-Period-Market/@Period", + "fileName": "@AssetA_@AssetB.json" + }, + { + "codeName": "Multi-Period-Daily", + "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": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volumes/Multi-Period-Daily/@Period/@Year/@Month/@Day", + "fileName": "@AssetA_@AssetB.json", + "dataRange": { + "filePath": "AAMasters/AAOlivia.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volumes/Multi-Period-Daily", + "fileName": "Data.Range.@AssetA_@AssetB.json" + } + } + ], + "exchangeList": [ + { + "name": "Poloniex" + }, + { + "name": "Coss" + } + ], + "plotter": { + "devTeam": "AAMasters", + "codeName": "PlottersCandlesVolumes", + "moduleName": "Volumes" + } + } + ] + }, + { + "codeName": "AATom", + "displayName": "Tom", + "type": "Indicator", + "profilePicture": "Tom.png", + "repo": "AATom-Indicator-Bot", + "configFile": "this.bot.config.json", + "products": [ + { + "codeName": "Candle-Stairs", + "displayName": "Candle-Stairs Patters", + "description": "Two sets of files per period that contains candle-stairs patterns.", + "dataSets": [ + { + "codeName": "Multi-Period-Market", + "type": "Market Files", + "validPeriods": [ + "24-hs", + "12-hs", + "08-hs", + "06-hs", + "04-hs", + "03-hs", + "02-hs", + "01-hs" + ], + "filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candle-Stairs/Multi-Period-Market/@Period", + "fileName": "@AssetA_@AssetB.json" + }, + { + "codeName": "Multi-Period-Daily", + "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": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candle-Stairs/Multi-Period-Daily/@Period/@Year/@Month/@Day", + "fileName": "@AssetA_@AssetB.json", + "dataRange": { + "filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Candle-Stairs/Multi-Period-Daily", + "fileName": "Data.Range.@AssetA_@AssetB.json" + } + } + ], + "exchangeList": [ + { + "name": "Poloniex" + }, + { + "name": "Coss" + } + ], + "plotter": { + "devTeam": "AAMasters", + "codeName": "PlottersStairsPatterns", + "moduleName": "CandleStairs" + } + }, + { + "codeName": "Volume-Stairs", + "displayName": "Volume-Stairs Patters", + "description": "Two sets of files per period that contains volume-stairs patterns.", + "dataSets": [ + { + "codeName": "Multi-Period-Market", + "type": "Market Files", + "validPeriods": [ + "24-hs", + "12-hs", + "08-hs", + "06-hs", + "04-hs", + "03-hs", + "02-hs", + "01-hs" + ], + "filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volume-Stairs/Multi-Period-Market/@Period", + "fileName": "@AssetA_@AssetB.json" + }, + { + "codeName": "Multi-Period-Daily", + "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": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volume-Stairs/Multi-Period-Daily/@Period/@Year/@Month/@Day", + "fileName": "@AssetA_@AssetB.json", + "dataRange": { + "filePath": "AAMasters/AATom.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Volume-Stairs/Multi-Period-Daily", + "fileName": "Data.Range.@AssetA_@AssetB.json" + } + } + ], + "exchangeList": [ + { + "name": "Poloniex" + }, + { + "name": "Coss" + } + ], + "plotter": { + "devTeam": "AAMasters", + "codeName": "PlottersStairsPatterns", + "moduleName": "VolumeStairs" + } + } + ] + }, + { + "codeName": "AAChris", + "displayName": "Chris", + "type": "Indicator", + "profilePicture": "Chris.png", + "repo": "AAChris-Indicator-Bot", + "configFile": "this.bot.config.json", + "products": [ + { + "codeName": "Bollinger-Bands", + "displayName": "Bollinger Bands", + "description": "Bollinger Bands", + "dataSets": [ + { + "codeName": "Multi-Period-Market", + "type": "Market Files", + "validPeriods": [ + "24-hs", + "12-hs", + "08-hs", + "06-hs", + "04-hs", + "03-hs", + "02-hs", + "01-hs" + ], + "filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Bands/Multi-Period-Market/@Period", + "fileName": "@AssetA_@AssetB.json" + }, + { + "codeName": "Multi-Period-Daily", + "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": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Bands/Multi-Period-Daily/@Period/@Year/@Month/@Day", + "fileName": "@AssetA_@AssetB.json", + "dataRange": { + "filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Bands/Multi-Period-Daily", + "fileName": "Data.Range.@AssetA_@AssetB.json" + } + } + ], + "exchangeList": [ + { + "name": "Poloniex" + }, + { + "name": "Coss" + } + ], + "plotter": { + "devTeam": "AAMasters", + "codeName": "PlottersBollingerBands", + "moduleName": "BollingerBands" + } + }, + { + "codeName": "Percentage-Bandwidth", + "displayName": "Percentage Bandwidth", + "description": "Percentage Bandwidth", + "dataSets": [ + { + "codeName": "Multi-Period-Market", + "type": "Market Files", + "validPeriods": [ + "24-hs", + "12-hs", + "08-hs", + "06-hs", + "04-hs", + "03-hs", + "02-hs", + "01-hs" + ], + "filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Percentage-Bandwidth/Multi-Period-Market/@Period", + "fileName": "@AssetA_@AssetB.json" + }, + { + "codeName": "Multi-Period-Daily", + "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": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Percentage-Bandwidth/Multi-Period-Daily/@Period/@Year/@Month/@Day", + "fileName": "@AssetA_@AssetB.json", + "dataRange": { + "filePath": "AAMasters/AAChris.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Percentage-Bandwidth/Multi-Period-Daily", + "fileName": "Data.Range.@AssetA_@AssetB.json" + } + } + ], + "exchangeList": [ + { + "name": "Poloniex" + }, + { + "name": "Coss" + } + ], + "plotter": { + "devTeam": "AAMasters", + "codeName": "PlottersBollingerBands", + "moduleName": "PercentageBandwidth" + } + } + ] + }, + { + "codeName": "AAPaula", + "displayName": "Paula", + "type": "Indicator", + "profilePicture": "Paula.png", + "repo": "AAPaula-Indicator-Bot", + "configFile": "this.bot.config.json", + "products": [ + { + "codeName": "Bollinger-Channels", + "displayName": "Bollinger-Channels", + "description": "Two sets of files per period that contains band-channel patterns.", + "dataSets": [ + { + "codeName": "Multi-Period-Market", + "type": "Market Files", + "validPeriods": [ + "24-hs", + "12-hs", + "08-hs", + "06-hs", + "04-hs", + "03-hs", + "02-hs", + "01-hs" + ], + "filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Channels/Multi-Period-Market/@Period", + "fileName": "@AssetA_@AssetB.json" + }, + { + "codeName": "Multi-Period-Daily", + "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": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Channels/Multi-Period-Daily/@Period/@Year/@Month/@Day", + "fileName": "@AssetA_@AssetB.json", + "dataRange": { + "filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Channels/Multi-Period-Daily", + "fileName": "Data.Range.@AssetA_@AssetB.json" + } + } + ], + "exchangeList": [ + { + "name": "Poloniex" + }, + { + "name": "Coss" + } + ], + "plotter": { + "devTeam": "AAMasters", + "codeName": "PlottersBollingerChannels", + "moduleName": "BollingerChannels" + } + }, + { + "codeName": "Bollinger-Sub-Channels", + "displayName": "Bollinger-Sub-Channels", + "description": "Bollinger Sub Channels with slope.", + "dataSets": [ + { + "codeName": "Multi-Period-Market", + "type": "Market Files", + "validPeriods": [ + "24-hs", + "12-hs", + "08-hs", + "06-hs", + "04-hs", + "03-hs", + "02-hs", + "01-hs" + ], + "filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Sub-Channels/Multi-Period-Market/@Period", + "fileName": "@AssetA_@AssetB.json" + }, + { + "codeName": "Multi-Period-Daily", + "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": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Sub-Channels/Multi-Period-Daily/@Period/@Year/@Month/@Day", + "fileName": "@AssetA_@AssetB.json", + "dataRange": { + "filePath": "AAMasters/AAPaula.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/Bollinger-Sub-Channels/Multi-Period-Daily", + "fileName": "Data.Range.@AssetA_@AssetB.json" + } + } + ], + "exchangeList": [ + { + "name": "Poloniex" + }, + { + "name": "Coss" + } + ], + "plotter": { + "devTeam": "AAMasters", + "codeName": "PlottersBollingerChannels", + "moduleName": "BollingerSubChannels" + } + } + ] + } + ], + "plotters": [ + { + "displayName": "Plotters Candles & Volumes", + "codeName": "PlottersCandlesVolumes", + "devTeam": "AAMasters", + "modules": [ + { + "codeName": "Candles", + "moduleName": "Candles", + "description": "Plots traditional red and green candles.", + "profilePicture": "Candles.png", + "panels": [ + { + "codeName": "CandlePanel", + "moduleName": "CandlePanel", + "event": "Current Candle Changed" + } + ] + }, + { + "codeName": "Volumes", + "description": "Plots volumes separated in buy and sell.", + "moduleName": "Volumes", + "profilePicture": "Volumes.png", + "panels": [ + { + "codeName": "VolumePanel", + "moduleName": "VolumePanel", + "event": "Current Volume Changed" + } + ] + } + ], + "repo": "Plotters-Candles-Volumes", + "configFile": "this.plotter.config.json" + }, + { + "displayName": "Plotters Stairs Patterns", + "codeName": "PlottersStairsPatterns", + "devTeam": "AAMasters", + "modules": [ + { + "codeName": "CandleStairs", + "moduleName": "CandleStairs", + "description": "Plots Candle Stairs patterns.", + "profilePicture": "CandleStairs.png", + "panels": [] + }, + { + "codeName": "VolumeStairs", + "description": "Plots Volume Stairs patterns.", + "moduleName": "VolumeStairs", + "profilePicture": "VolumeStairs.png", + "panels": [] + } + ], + "repo": "Plotters-Stairs-Patterns", + "configFile": "this.plotter.config.json" + }, + { + "displayName": "Plotters Trading", + "codeName": "PlottersTrading", + "devTeam": "AAMasters", + "modules": [ + { + "codeName": "Details", + "moduleName": "Details", + "description": "Plots trading decitions in an easy to understand way.", + "panels": [] + }, + { + "codeName": "History", + "moduleName": "History", + "description": "Plots trading history.", + "profilePicture": "History.png", + "panels": [] + } + ], + "repo": "Plotters-Trading", + "configFile": "this.plotter.config.json" + }, + { + "displayName": "Plotters Bollinger Bands", + "codeName": "PlottersBollingerBands", + "devTeam": "AAMasters", + "modules": [ + { + "codeName": "BollingerBands", + "moduleName": "BollingerBands", + "description": "Plots Bollinger Bands.", + "profilePicture": "BollingerBands.png", + "panels": [ + { + "codeName": "BollingerBandsPanel", + "moduleName": "BollingerBandsPanel", + "event": "Current Band Changed" + } + ] + }, + { + "codeName": "PercentageBandwidth", + "moduleName": "PercentageBandwidth", + "description": "Plots Bollinger Bands.", + "profilePicture": "PercentageBandwidth.png", + "panels": [] + } + ], + "repo": "Plotters-Bollinger-Bands", + "configFile": "this.plotter.config.json" + }, + { + "displayName": "Plotters Trading Simulation", + "codeName": "PlottersTradingSimulation", + "devTeam": "AAMasters", + "modules": [ + { + "codeName": "TradingSimulation", + "moduleName": "TradingSimulation", + "description": "Plots Bollinger Records.", + "profilePicture": "TradingSimulation.png", + "panels": [ + { + "codeName": "TradingSimulationPanel", + "moduleName": "TradingSimulationPanel", + "event": "Current Record Changed" + } + ] + }, + { + "codeName": "Conditions", + "moduleName": "Conditions", + "description": "Plots Simulation Conditions.", + "profilePicture": "Conditions.png", + "panels": [] + }, + { + "codeName": "Strategies", + "moduleName": "Strategies", + "description": "Plots Strategies.", + "profilePicture": "Strategies.png", + "panels": [] + }, + { + "codeName": "Trades", + "moduleName": "Trades", + "description": "Plots Trades.", + "profilePicture": "Trades.png", + "panels": [] + }, + { + "codeName": "SimulationExecution", + "moduleName": "SimulationExecution", + "description": "Plots Simulation Execution.", + "profilePicture": "SimulationExecution.png", + "panels": [] + } + ], + "repo": "Plotters-Trading-Simulation", + "configFile": "this.plotter.config.json" + }, + { + "displayName": "Plotters Bollinger Channels", + "codeName": "PlottersBollingerChannels", + "devTeam": "AAMasters", + "modules": [ + { + "codeName": "BollingerChannels", + "moduleName": "BollingerChannels", + "description": "Plots Bollinger Channels.", + "profilePicture": "BollingerChannels.png", + "panels": [ + { + "codeName": "ChannelPanel", + "moduleName": "ChannelPanel", + "event": "Current Channel Changed" + } + ] + }, + { + "codeName": "BollingerSubChannels", + "moduleName": "BollingerSubChannels", + "description": "Plots Bollinger Sub-Channels.", + "profilePicture": "BollingerSubChannels.png", + "panels": [ + { + "codeName": "SubChannelPanel", + "moduleName": "SubChannelPanel", + "event": "Current Sub-Channel Changed" + } + ] + } + ], + "repo": "Plotters-Bollinger-Channels", + "configFile": "this.plotter.config.json" + } + ] + }, + { + "codeName": "AAVikings", + "displayName": "Vikings", + "host": { + "url": "http://localhost:4100/", + "container": "aavikings", + "storage": "https://aadevelop.blob.core.windows.net", + "accessKey": "?st=2019-05-20T12%3A00%3A00Z&se=2020-05-21T12%3A00%3A00Z&sp=rl&sv=2018-03-28&sr=c&sig=hJuV9aEP4KVZo5z54FEF1BQtkbksfwkTJFv1FYkHFRg%3D" + }, + "bots": [ + { + "codeName": "AAGauss", + "displayName": "Gauss", + "type": "Indicator", + "profilePicture": "Gauss.png", + "repo": "AAGauss-Indicator-Bot", + "configFile": "this.bot.config.json", + "products": [ + { + "codeName": "LRCPoints", + "displayName": "LRCPoints", + "description": "Two sets of files per period that contains LRC points.", + "dataSets": [ + { + "codeName": "Multi-Period-Market", + "type": "Market Files", + "validPeriods": [ + "24-hs", + "12-hs", + "08-hs", + "06-hs", + "04-hs", + "03-hs", + "02-hs", + "01-hs" + ], + "filePath": "AAVikings/AAGauss.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/LRC-Points/Multi-Period-Market/@Period", + "fileName": "@AssetA_@AssetB.json" + }, + { + "codeName": "Multi-Period-Daily", + "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": "AAVikings/AAGauss.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/LRC-Points/Multi-Period-Daily/@Period/@Year/@Month/@Day", + "fileName": "@AssetA_@AssetB.json", + "dataRange": { + "filePath": "AAVikings/AAGauss.1.0/AACloud.1.1/@Exchange/dataSet.V1/Output/LRC-Points/Multi-Period-Daily", + "fileName": "Data.Range.@AssetA_@AssetB.json" + } + } + ], + "exchangeList": [ + { + "name": "Poloniex" + }, + { + "name": "Coss" + } + ], + "plotter": { + "devTeam": "AAVikings", + "codeName": "PlotterLinearRegressionCurve", + "moduleName": "LRC" + } + } + ] + } + ], + "plotters": [ + { + "displayName": "Plotter LRC", + "codeName": "PlotterLinearRegressionCurve", + "devTeam": "AAVikings", + "modules": [ + { + "codeName": "LRC", + "moduleName": "LRC", + "description": "Plots the linear regression curve.", + "profilePicture": "LRC.png", + "panels": [ + { + "codeName": "ChannelPanel", + "moduleName": "ChannelPanel", + "event": "Current LRC Changed" + } + ] + } + ], + "repo": "Plotters-Linear-Regression-Curve", + "configFile": "this.plotter.config.json" + } + ] + } + ], + "hosts": [ + { + "codeName": "AAMasters", + "displayName": "AA Arena", + "host": { + "url": "http://localhost:4100/", + "storage": "https://aadevelop.blob.core.windows.net", + "container": "aaplatform", + "accessKey": "?sv=2018-03-28&ss=b&srt=co&sp=rw&se=2020-01-04T00:00:00Z&st=2019-01-08T11:25:04Z&spr=https&sig=xZU1PO%2BdtVilqlZp%2BVRWW55LYl8oGZU7x4JnP%2BhMc%2FY%3D" + }, + "competitions": [ + { + "codeName": "Weekend-Deathmatch", + "description": "First AA Internal Competition. Bots will be trading during 3 days at the USDT/BTC market of Poloniex to see who can make the gratest return over investment (ROI).", + "displayName": "AA Internal Challenge", + "startDatetime": "2018-01-01T16:00:00.000Z", + "finishDatetime": "2018-01-02T16:00:00.000Z", + "formula": "ROI", + "plotter": { + "devTeam": "AAMasters", + "codeName": "PlottersROI", + "host": { + "url": "http://localhost:4100/", + "storage": "https://aadevelop.blob.core.windows.net", + "container": "aamasters", + "accessKey": "?st=2019-05-21T12%3A00%3A00Z&se=2020-05-22T12%3A00%3A00Z&sp=rl&sv=2018-03-28&sr=c&sig=PsGM67klPfLjdfjymziEQEQcD5Wzy3SMcZWsTCQrhd8%3D" + }, + "moduleName": "CombinedProfits", + "repo": "Plotters-ROI" + }, + "rules": [], + "prizes": [], + "participants": [], + "repo": "Weekend-Deathmatch", + "configFile": "this.competition.config.json" + } + ], + "plotters": [ + { + "displayName": "Plotters ROI", + "codeName": "PlottersROI", + "devTeam": "AAMasters", + "modules": [ + { + "codeName": "CombinedProfits", + "moduleName": "CombinedProfits", + "description": "Plots participants of a competition by the ROI each one had over time.", + "panels": [] + } + ], + "repo": "Plotters-ROI", + "configFile": "this.plotter.config.json" + } + ] + } + ] +} diff --git a/src/models/ecosystem.js b/src/models/ecosystem.js index 36ce90642..827a3ae42 100644 --- a/src/models/ecosystem.js +++ b/src/models/ecosystem.js @@ -44,7 +44,11 @@ const ecosystemSchema = new Schema({ }, type: { type: String, - required: false + required: true + }, + profilePicture: { + type: String, + required: true }, repo: { type: String, @@ -225,13 +229,31 @@ const ecosystemSchema = new Schema({ required: false }, plotter: { + devTeam: { + type: String, + required: true + }, codeName: { type: String, - required: false + required: true }, host: { - type: String, - required: false + url: { + type: String, + required: true + }, + storage: { + type: String, + required: true + }, + container: { + type: String, + required: true + }, + accessKey: { + type: String, + required: true + } }, repo: { type: String, diff --git a/src/schema/mutations/AddTeam.js b/src/schema/mutations/AddTeam.js index 87e339e94..81030d41f 100644 --- a/src/schema/mutations/AddTeam.js +++ b/src/schema/mutations/AddTeam.js @@ -3,12 +3,12 @@ import { AuthenticationError, WrongArgumentsError } from '../../errors' import { TeamType } from '../types' import { Ecosystem } from '../../models' import { TeamInputType } from '../types/input' -import { createTeam } from '../../storage/CreateTeam' +import { copyBots } from '../../storage/CopyBots' export const args = { team: { type: TeamInputType } } const resolve = async (parent, { team }, context) => { - logger.debug('addTeam -> Entering Fuction.') + logger.debug('addTeam -> Entering Function.') if (!context.userId) { throw new AuthenticationError() @@ -34,35 +34,27 @@ const resolve = async (parent, { team }, context) => { } } - let accessKey = await createTeam(team) + let storage = require ('../../storage/providers/AzureStorage') // Default value + if (process.env.STORAGE_PROVIDER === 'Minio') { + storage = require ('../../storage/providers/MinioStorage') + } + + let containerName = team.codeName + await storage.createContainer(containerName) + let accessKey = storage.createPrivateAccessKey(containerName, "WRITE", 365) + + let botsConfigurations = await copyBots(storage, team) + team.bots = botsConfigurations if (!team.host) { let nodeEndpoint = { url: process.env.SUPERALGOS_NODE_ENDPOINT, + storage: process.env.STORAGE_URL, container: team.codeName, accessKey: accessKey, } team.host = nodeEndpoint } - let bots = [] - let tradingBot = { - codeName: team.bot.codeName, - displayName: team.bot.displayName, - repo: team.bot.codeName + '-Trading-Bot', - configFile: 'this.bot.config.json' - } - bots.push(tradingBot) - - let simulatorBot = { - codeName: 'simulator-' + team.bot.codeName, - displayName: 'Simulator ' + team.bot.displayName, - repo: 'simulator-' + team.bot.codeName + '-Indicator-Bot', - configFile: 'this.bot.config.json' - } - bots.push(simulatorBot) - - team.bots = bots - userEcosystem.devTeams.push(team) await userEcosystem.save() return team diff --git a/src/schema/mutations/DeleteTeam.js b/src/schema/mutations/DeleteTeam.js index dd4061919..9e8ee3626 100644 --- a/src/schema/mutations/DeleteTeam.js +++ b/src/schema/mutations/DeleteTeam.js @@ -2,13 +2,13 @@ import logger from '../../utils/logger' import { AuthenticationError, WrongArgumentsError } from '../../errors' import { TeamType } from '../types' import { Ecosystem } from '../../models' -import { TeamInputType } from '../types/input' +import { DeleteTeamInputType } from '../types/input' import { deleteTeam } from '../../storage/DeleteTeam' -export const args = { team: { type: TeamInputType } } +export const args = { team: { type: DeleteTeamInputType } } const resolve = async (parent, { team }, context) => { - logger.debug('deleteTeam -> Entering Fuction.') + logger.debug('deleteTeam -> Entering Function.') if (!context.userId) { throw new AuthenticationError() diff --git a/src/schema/queries/Ecosystem.js b/src/schema/queries/Ecosystem.js index ca55b7fce..d6eeafb6f 100644 --- a/src/schema/queries/Ecosystem.js +++ b/src/schema/queries/Ecosystem.js @@ -5,7 +5,7 @@ import { EcosystemType } from '../types' const args = {} const resolve = async (parent, args, context) => { - logger.debug('getEcosystem -> Entering Fuction.') + logger.debug('getEcosystem -> Entering Function.') try { if (!context.userId) { diff --git a/src/schema/queries/FileContent.js b/src/schema/queries/FileContent.js index 910fa8df5..0c5ce7515 100644 --- a/src/schema/queries/FileContent.js +++ b/src/schema/queries/FileContent.js @@ -5,7 +5,7 @@ import { GraphQLString } from 'graphql' export const args = { file: { type: FileInputType } } const resolve = async (parent, { file }, context) => { - logger.debug('getFileContent -> Entering Fuction: ' + file.filePath) + logger.debug('getFileContent -> Entering Function: ' + file.filePath) try { @@ -14,7 +14,23 @@ const resolve = async (parent, { file }, context) => { storage = require('../storage/providers/MinioStorage') } - return storage.getFileContentRemote(file.container, file.filePath, file.storage, file.accessKey) + //Temporary fix for plotter and plotter pannels + if (file.storage === '' && file.accessKey === ''){ + let defaultEcosystem = require('../../config/ecosystem.json') + for (let index = 0; index < defaultEcosystem.devTeams.length; index++) { + const devTeam = defaultEcosystem.devTeams[index]; + if(devTeam.codeName.toLowerCase() === file.container){ + file.storage = devTeam.host.storage + file.accessKey = devTeam.host.accessKey + } + } + } + if (file.storage === '' || file.accessKey === ''){ + throw "Wrong parameters." + } + + let fileContent = await storage.getFileContentRemote(file.container, file.filePath, file.storage, file.accessKey) + return fileContent } catch (err) { logger.error('getFileContent -> Error: %s', err.stack) diff --git a/src/schema/types/Bot.js b/src/schema/types/Bot.js index f983f1129..9ce0405ab 100644 --- a/src/schema/types/Bot.js +++ b/src/schema/types/Bot.js @@ -12,6 +12,7 @@ const BotType = new GraphQLObjectType({ codeName: { type: GraphQLString }, displayName: { type: GraphQLString }, type: { type: GraphQLString }, + profilePicture: { type: GraphQLString }, repo: { type: GraphQLString }, configFile: { type: GraphQLString }, products: { diff --git a/src/schema/types/PlotterReference.js b/src/schema/types/PlotterReference.js index 1c6007032..06baa44f0 100644 --- a/src/schema/types/PlotterReference.js +++ b/src/schema/types/PlotterReference.js @@ -3,12 +3,19 @@ import { GraphQLString } from 'graphql'; +import { HostType } from './index'; + const PlotterReferenceType = new GraphQLObjectType({ name: 'PlotterReference', fields: () => ({ - codeName: { type: GraphQLString }, - host: { type: GraphQLString }, devTeam: { type: GraphQLString }, + codeName: { type: GraphQLString }, + host: { + type: HostType, + resolve(parent) { + return parent.host; + } + }, moduleName: { type: GraphQLString }, repo: { type: GraphQLString } }), diff --git a/src/schema/types/input/DeleteTeam.js b/src/schema/types/input/DeleteTeam.js new file mode 100644 index 000000000..bd7ed63d2 --- /dev/null +++ b/src/schema/types/input/DeleteTeam.js @@ -0,0 +1,18 @@ +import { + GraphQLString, + GraphQLInputObjectType, + GraphQLNonNull +} from 'graphql'; + +import { HostInputType } from './index'; + +const Type = new GraphQLInputObjectType({ + name: 'DeleteTeamInput', + description: 'Payload for team input', + fields: () => ({ + codeName: { type: new GraphQLNonNull(GraphQLString) }, + host: { type: HostInputType } + }), +}); + +export default Type; diff --git a/src/schema/types/input/Team.js b/src/schema/types/input/Team.js index 37f49a33c..c4423a55a 100644 --- a/src/schema/types/input/Team.js +++ b/src/schema/types/input/Team.js @@ -1,8 +1,7 @@ import { GraphQLString, GraphQLInputObjectType, - GraphQLNonNull, - GraphQLList + GraphQLNonNull } from 'graphql'; import { BotInputType, HostInputType } from './index'; diff --git a/src/schema/types/input/index.js b/src/schema/types/input/index.js index ec822c308..2e3d3dd55 100644 --- a/src/schema/types/input/index.js +++ b/src/schema/types/input/index.js @@ -2,10 +2,12 @@ import TeamInputType from './Team' import BotInputType from './Bot' import HostInputType from './Host' import FileInputType from './File' +import DeleteTeamInputType from './DeleteTeam' export { TeamInputType, BotInputType, HostInputType, - FileInputType -}; + FileInputType, + DeleteTeamInputType +} diff --git a/src/storage/CopyBot.js b/src/storage/CopyBot.js index 357f1c493..309bb8808 100644 --- a/src/storage/CopyBot.js +++ b/src/storage/CopyBot.js @@ -35,7 +35,7 @@ export const copyBot = async (storage, teamCodeName, botCodeName, botDisplayName await storage.writeFileContent(teamCodeName, newBotPath + '/Trading-Bot/User.Bot.js', code) logger.debug('copyBot completed for bot %s', botCodeName) - + return parsedConfig } catch (err) { logger.error('copyBot error for bot: %s. %s', botCodeName, err) throw err diff --git a/src/storage/CopyBots.js b/src/storage/CopyBots.js new file mode 100644 index 000000000..ede1b352b --- /dev/null +++ b/src/storage/CopyBots.js @@ -0,0 +1,22 @@ +import logger from '../utils/logger' +import { copyBot } from './CopyBot' +import { copySimulator } from './CopySimulator' + +export const copyBots = async (storage, team) => { + try { + logger.debug('copyBots started for team %s', team.codeName) + let bots = [] + + let tradingBot = await copyBot(storage, team.codeName, team.bot.codeName, team.bot.displayName) + bots.push(tradingBot) + + let simulatorBot = await copySimulator(storage, team.codeName, team.bot.codeName, team.bot.displayName) + bots.push(simulatorBot) + + return bots + + } catch (err) { + logger.error('copyBots error for teamCodeName: %s, error: %s', team.bot.codeName, err.stack) + throw err + } +} diff --git a/src/storage/CopySimulator.js b/src/storage/CopySimulator.js index ca2466891..1931ee9df 100644 --- a/src/storage/CopySimulator.js +++ b/src/storage/CopySimulator.js @@ -55,7 +55,7 @@ export const copySimulator = async (storage, teamCodeName, botCodeName, botDispl await storage.writeFileContent(teamCodeName, newSimulatorPath + '/Multi-Period-Market/User.Bot.js', codeMarket) logger.debug('copySimulator completed for bot %s', newBotCodeName) - + return parsedConfig } catch (err) { logger.error('copySimulator error for bot: %s. %s', botCodeName, err) throw err diff --git a/src/storage/CreateTeam.js b/src/storage/CreateTeam.js deleted file mode 100644 index a2833250d..000000000 --- a/src/storage/CreateTeam.js +++ /dev/null @@ -1,27 +0,0 @@ -import logger from '../utils/logger' -import { copyBot } from './CopyBot' -import { copySimulator } from './CopySimulator' - -export const createTeam = async (team) => { - try { - logger.debug('createTeam started for team %s', team.codeName) - - let storage = require ('./providers/AzureStorage') // Default value - if (process.env.STORAGE_PROVIDER === 'Minio') { - storage = require ('./providers/MinioStorage') - } - - let containerName = team.codeName - await storage.createContainer(containerName) - let accessKey = storage.createPrivateAccessKey(containerName, "WRITE", 365) - - await copyBot(storage, team.codeName, team.bot.codeName, team.bot.displayName) - await copySimulator(storage, team.codeName, team.bot.codeName, team.bot.displayName) - - return accessKey - - } catch (err) { - logger.error('createTeam error for teamCodeName: %s, error: %s', team.bot.codeName, err.stack) - throw err - } -}