Assistant Template
This commit is contained in:
1 parent
d199b3108f
commit
6a3ea13603
5 files changed
+65
-3
No files matched your search
Binary file not shown.
@@ -20,6 +20,9 @@
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="Assistant.js">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Azure File Storage.js" />
|
||||
<Compile Include="Azure Web Job Shutdown.js" />
|
||||
<Compile Include="Context.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.");
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
+7
-2
@@ -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); }
|
||||
|
||||
+7
-1
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user