From 6a3ea13603c61a47ca37bedcd83d2c6e62cd52d1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 6 Mar 2018 14:14:26 +0100 Subject: [PATCH] Assistant Template --- .vs/AACloudPlatform/v15/.suo | Bin 69120 -> 69632 bytes AACloudPlatform.njsproj | 3 +++ Assistant.js | 48 +++++++++++++++++++++++++++++++++++ Datasource.js | 9 +++++-- ExchangeAPI.js | 8 +++++- 5 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 Assistant.js diff --git a/.vs/AACloudPlatform/v15/.suo b/.vs/AACloudPlatform/v15/.suo index 871593d713a4f8cd5e86b0f3ff5392e3e20a58e4..afb7d2c91ebdf5e31502d998151ad0e6b38bdd75 100644 GIT binary patch delta 750 zcma)3YiN>D7(VZJnSS4F%}XnoPFADYAREgV{V5$%(DtJsx)78y3T)&Mg;*Dmf?z-0 z>(F$P*%n=3Q;!f)3t{BkRpnub5M<-b9m1Cp7-#)m*@CL1bOJ|pIp`{4{4q$%|P3zf>{@+M}r z3_bL-bg@P}&)gy%sE^jdB}}O{&~|+u(oNr#T(6G)*jVZWJNny zuz9^Mug{4P+YDos2tK*oj*f^(Q^A`8IwxDPII;ti;UhE~vGTHAv&2^tOa*WJMLB#$ zl<|2qk+>y5XL`I0s17w_-}Eu+Px=9e(k&Q^nrL@A0|+5KzMZY3ZJ8ImNQle2q90x& z_MvbR%`q*mn%ISf@h&X!^Ak(E4x&_48WVnEL>UJcm~!My!vl zt)$1hsom%ZE|$W!%mM75Xl+=-#9CgKs$)+q4nH^Cfgk5`vb-GrLlbm7F6b21Cl#}N z)yKm7Ml6~HG%XmYf8KAPfzf`zy~7gD+&+!jv1Z!$DF?VZr;K5e;^RlqF&3!|C^ ArvLx| delta 540 zcmbV|Ur3W-6vp54{aN2PhkbJ*1#{+2Mps4C)Qj4h7hTB&p&K=!yb$`sLXuhH3*B`m zXOjJa#z#5oB0hJdK^OATXy^#ZPzbLU2;D?;1!4xSxll_t24cZ>&Lx0Aq$ACl%KV7F|Z(SApg?qJWVP%j7L=1KhEf6oTSeXgUGhv^J;RHumS( z_t-d}O5otuj+s0-_i(=q>Ob>n6?}oC4Eb3;mdfJ6%GV1dS7b9mp$aJN4(@se)3YA5 z%7y=mX&vQoh2K6DBfed^alEZk91Eq!XT)@00I#hLqWku8?RRd^1&vyp{X)^_$8dN( mjhDh<3V;6S&)qfPAv`MiAfAi+z)`Vu>pBjrjXA{&d+-;}YP+`p diff --git a/AACloudPlatform.njsproj b/AACloudPlatform.njsproj index 6f6b1681b..a9b5c3925 100644 --- a/AACloudPlatform.njsproj +++ b/AACloudPlatform.njsproj @@ -20,6 +20,9 @@ + + Code + diff --git a/Assistant.js b/Assistant.js new file mode 100644 index 000000000..99c05c607 --- /dev/null +++ b/Assistant.js @@ -0,0 +1,48 @@ +exports.newAssistant = function newAssistant(BOT, DEBUG_MODULE) { + + /* + + This module allows trading bots to execute actions on the exchange, and also on its current recorded state. + + */ + + const MODULE_NAME = "Assistant"; + + thisObject = { + initialize: initialize + }; + + let bot = BOT; + + const logger = DEBUG_MODULE.newDebugLog(); + logger.fileName = MODULE_NAME; + + + return thisObject; + + function initialize(callBackFunction) { + + try { + + + + } catch (err) { + + logger.write("[ERROR] initialize -> err = " + err); + callBackFunction("Operation Failed."); + } + } + + function getCandles(callBack) { + + try { + + + + } catch (err) { + logger.write("[ERROR] getCandles -> err = " + err); + callBack("Operation Failed."); + } + } + +}; \ No newline at end of file diff --git a/Datasource.js b/Datasource.js index d97ca50c3..e5c27c7d8 100644 --- a/Datasource.js +++ b/Datasource.js @@ -1,4 +1,4 @@ -exports.newDatasource = function newDatasource(BOT) { +exports.newDatasource = function newDatasource(BOT, DEBUG_MODULE, FILE_STORAGE) { /* @@ -18,16 +18,21 @@ let bot = BOT; - const DEBUG_MODULE = require('./Debug Log'); const logger = DEBUG_MODULE.newDebugLog(); logger.fileName = MODULE_NAME; + let oliviaAzureFileStorage = FILE_STORAGE.newAzureFileStorage(bot); + let tomAzureFileStorage = FILE_STORAGE.newAzureFileStorage(bot); + return thisObject; function initialize(callBackFunction) { try { + oliviaAzureFileStorage.initialize("Olivia"); + tomAzureFileStorage.initialize("Tom"); + getCandles(onCandlesReady); function onCandlesReady() {getPatterns(onPatternsReady); } diff --git a/ExchangeAPI.js b/ExchangeAPI.js index b32a13b7a..c1db28746 100644 --- a/ExchangeAPI.js +++ b/ExchangeAPI.js @@ -37,10 +37,16 @@ function readApiKey() { try { - return JSON.parse(fs.readFileSync('../' + 'API-Keys' + '/' + EXCHANGE_NAME + '.json', 'utf8')); + let fs = require('fs'); + let filePath = '../' + 'API-Keys' + '/' + EXCHANGE_NAME + '.json'; + return JSON.parse(fs.readFileSync(filePath, 'utf8')); } catch (err) { logger.write("[ERROR] initialize -> readApiKey -> err = " + err); + logger.write("[HINT] You need to have a file at this path -> " + filePath); + logger.write("[HINT] The file must have the keys to access your poloniex account, in this format -> " + '{ "Key" : "4FB9TMEB-234VH2W1-BYJIXHGM-GL15DSA1", "Secret" : "1a24298skdjdf734uuyhbdagdasdtyut276587256hdsdas765asdasdasd76asdasda765asdasfas6asfda57657asd5a76sd5a7s65d7a6sd57as65d7as65d"}'); + logger.write("[HINT] You get this key logging in to your Poloniex web account, enabling API keys and getting a new one. "); + logger.write("[HINT] Be sure not to allow withdrawls with this Key. When asked at the exchange key page, say no. "); callBackFunction("Operation Failed."); } }