Multi Period deletef for now

This commit is contained in:
Luis Fernando Molina committed 2018-02-10 11:48:26 +01:00
1 parent 2300f76d46
commit 53d34b2849
5 files changed
+2 -1354

No files matched your search

Binary file not shown.
+2 -6
View File
@@ -6,8 +6,8 @@
<ProjectGuid>{045bbaef-3c35-4017-8458-e46aef438790}</ProjectGuid>
<ProjectHome />
<ProjectView>ShowAllFiles</ProjectView>
<StartupFile>Multi-Period-Daily-Candles-Volumes\run.js</StartupFile>
<WorkingDirectory>C:\Users\Luis\source\repos\AABruce\Multi-Period-Daily-Candles-Volumes\</WorkingDirectory>
<StartupFile>One-Min-Daily-Candles-Volumes\run.js</StartupFile>
<WorkingDirectory>C:\Users\Luis\source\repos\One-Min-Daily-Candles-Volumes\</WorkingDirectory>
<OutputPath>.</OutputPath>
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
@@ -23,9 +23,6 @@
<Compile Include="Azure Web Job Shutdown.js" />
<Compile Include="Debug Log.js" />
<Compile Include="Markets.js" />
<Compile Include="Multi-Period-Daily-Candles-Volumes\Interval.js" />
<Compile Include="Multi-Period-Daily-Candles-Volumes\Interval Executor.js" />
<Compile Include="Multi-Period-Daily-Candles-Volumes\run.js" />
<Compile Include="One-Min-Daily-Candles-Volumes\Interval.js" />
<Compile Include="Poloniex API Client.js" />
<Compile Include="Utilities.js" />
@@ -43,7 +40,6 @@
<Folder Include="logs\AA Masters\Connectivity\Carol" />
<Folder Include="logs\AA Masters\Connectivity\Carol\1.0.0" />
<Folder Include="logs\AA Masters\Connectivity\Carol\1.0.0\Order-Books" />
<Folder Include="Multi-Period-Daily-Candles-Volumes\" />
<Folder Include="obj" />
<Folder Include="obj\Debug" />
<Folder Include="One-Min-Daily-Candles-Volumes\" />
@@ -1,169 +0,0 @@
exports.newIntervalExecutor = function newIntervalExecutor(BOT) {
let bot = BOT;
const ROOT_DIR = '../';
const INTERVAL_LAPSE = 10 * 1000;
const MODULE_NAME = "Interval Executor";
const LOG_INFO = true;
const INTERVAL_MODULE = require('./Interval');
const DEBUG_MODULE = require(ROOT_DIR + 'Debug Log');
const logger = DEBUG_MODULE.newDebugLog();
logger.fileName = MODULE_NAME;
logger.bot = bot;
const INTERVAL_MAX_LOOPS = -1; // -1 for infinite loop.
poloniexHoleFixing = {
initialize: initialize,
start: start
};
const SHUTDOWN_EVENT = require(ROOT_DIR + 'Azure Web Job Shutdown');
let shutdownEvent = SHUTDOWN_EVENT.newShutdownEvent(bot);
const UTILITIES = require(ROOT_DIR + 'Utilities');
let utilities = UTILITIES.newUtilities(bot);
let year;
let month;
return poloniexHoleFixing;
function initialize(yearAssigend, monthAssigned, callBackFunction) {
try {
year = yearAssigend;
month = monthAssigned;
month = utilities.pad(month, 2); // Adding a left zero when needed.
logger.fileName = MODULE_NAME + "-" + year + "-" + month;
const logText = "[INFO] initialize - Entering function 'initialize' " + " @ " + year + "-" + month;
console.log(logText);
logger.write(logText);
callBackFunction();
} catch (err) {
const logText = "[ERROR] initialize - ' ERROR : " + err.message;
console.log(logText);
logger.write(logText);
}
}
function start() {
try {
if (LOG_INFO === true) {
logger.write("[INFO] Entering function 'start', with year = " + year + " and month = " + month);
}
let intervalId;
if (INTERVAL_MAX_LOOPS === 0) {
intervalId = setInterval(startNewInterval, INTERVAL_LAPSE);
}
let intervalLoopCounter = 0;
startNewInterval(); // First, inmadiate run.
function startNewInterval() {
try {
if (LOG_INFO === true) {
if (INTERVAL_MAX_LOOPS !== 0) {
logger.write("[INFO] Entering function 'startNewInterval', next execution inmediately after the current Interval finishes.");
} else {
logger.write("[INFO] Entering function 'startNewInterval', next execution in " + INTERVAL_LAPSE / 1000 / 60 + " minutes.");
}
}
if (shutdownEvent.isShuttingDown() === false) {
let fileProcessingInterval = INTERVAL_MODULE.newInterval(bot);
fileProcessingInterval.initialize(year, month, onReadyToStart);
function onReadyToStart() {
fileProcessingInterval.start(loopControl);
}
}
else {
clearInterval(intervalId);
const logText = "[INFO] requestNewData - Terminating Set Interval - About to exit gracefully the process. ";
console.log(logText);
logger.write(logText);
}
}
catch (err) {
const logText = "[ERROR] 'startNewInterval' - ERROR : " + err.message;
logger.write(logText);
}
}
function loopControl(moreIntervalExecutionsNeeded) {
if (moreIntervalExecutionsNeeded === true) {
intervalLoopCounter++;
if (intervalLoopCounter === INTERVAL_MAX_LOOPS) {
const logText = "[WARN] 'INTERVAL_MAX_LOOPS' reached. Stopping execution. ";
logger.write(logText);
} else {
const logText = "[WARN] 'loopControl'. Staring new Interval. ";
logger.write(logText);
setTimeout(startNewInterval, INTERVAL_LAPSE);// Looped Execution.
}
} else {
logger.write("[WARN] Received the signal from last Interval execution to not call it anymore. Stopping execution. ");
}
}
}
catch (err) {
const logText = "[ERROR] 'Start' - ERROR : " + err.message;
logger.write(logText);
}
}
};
File diff suppressed because it is too large. Load diff
-97
View File
@@ -1,97 +0,0 @@
let bot = {
name: "Bruce",
process: "Multi-Period-Daily-Candles-Volumes",
type: "Indicator",
version: "1.0.0",
devTeam: "AA Masters"
};
const ROOT_DIR = '../';
const MODULE_NAME = "run";
const START_ALL_MONTHS = false;
const START_ONE_MONTH = true;
const INTERVAL_EXECUTOR_MODULE = require('./Interval Executor');
const DEBUG_MODULE = require(ROOT_DIR + 'Debug Log');
const logger = DEBUG_MODULE.newDebugLog();
logger.fileName = MODULE_NAME;
logger.bot = bot;
process.on('uncaughtException', function (err) {
logger.write('uncaughtException - ' + err.message);
});
process.on('unhandledRejection', (reason, p) => {
logger.write("Unhandled Rejection at: Promise " + JSON.stringify(p) + " reason: " + reason);
});
process.on('exit', function (code) {
logger.write('About to exit with code:' + code);
});
try {
if (START_ALL_MONTHS === true) {
for (let year = 2018; year > 2014; year--) {
for (let month = 12; month > 0; month--) {
let timeDelay = Math.random() * 10 * 1000; // We introduce a short delay so as to not overload the machine.
setTimeout(startProcess, timeDelay);
function startProcess() {
const newIntervalExecutor = INTERVAL_EXECUTOR_MODULE.newIntervalExecutor(bot);
newIntervalExecutor.initialize(year, month, onInitializeReady);
function onInitializeReady() {
newIntervalExecutor.start();
}
}
}
}
}
if (START_ONE_MONTH === true) {
startProcess();
function startProcess() {
const newIntervalExecutor = INTERVAL_EXECUTOR_MODULE.newIntervalExecutor(bot);
let month = 2;
let year = 2018;
newIntervalExecutor.initialize(year, month, onInitializeReady);
function onInitializeReady() {
newIntervalExecutor.start();
}
}
}
} catch (err) {
console.log(err.message);
logger.write(err.message);
}