Session Concept Introduced
This commit is contained in:
1 parent
3632ace5b8
commit
99d98b1089
6 files changed
+32
-19
No files matched your search
+3
-3
@@ -45,7 +45,7 @@ function newDailyFiles () {
|
||||
}
|
||||
}
|
||||
|
||||
function initialize (pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) {
|
||||
function initialize (pDevTeam, pBot, pSession, pProduct, pSet, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) {
|
||||
try {
|
||||
callBackWhenFileReceived = callBackFunction
|
||||
|
||||
@@ -60,7 +60,7 @@ function newDailyFiles () {
|
||||
|
||||
/* First we will get the Data Range */
|
||||
|
||||
fileCloud.getFile(pDevTeam, pBot, pSet, exchange, pMarket, undefined, undefined, undefined, true, onDataRangeReceived)
|
||||
fileCloud.getFile(pDevTeam, pBot, pSession, pSet, exchange, pMarket, undefined, undefined, undefined, true, onDataRangeReceived)
|
||||
|
||||
function onDataRangeReceived (err, pFile) {
|
||||
try {
|
||||
@@ -110,7 +110,7 @@ function newDailyFiles () {
|
||||
if (pSet.validPeriods.includes(periodName) === true) {
|
||||
let fileCursor = newFileCursor()
|
||||
fileCursor.eventHandler = thisObject.eventHandler // We share our event handler with each file cursor, so that they can raise events there when files are changed.s
|
||||
fileCursor.initialize(fileCloud, pDevTeam, pBot, pProduct, pSet, exchange, pMarket, periodName, periodTime, pDatetime, pTimePeriod, beginDateRange, endDateRange, onInitialized)
|
||||
fileCursor.initialize(fileCloud, pDevTeam, pBot, pSession, pProduct, pSet, exchange, pMarket, periodName, periodTime, pDatetime, pTimePeriod, beginDateRange, endDateRange, onInitialized)
|
||||
function onInitialized (err) {
|
||||
try {
|
||||
switch (err.result) {
|
||||
|
||||
+7
-3
@@ -46,15 +46,15 @@ function newFileCloud () {
|
||||
}
|
||||
}
|
||||
|
||||
function getFile (pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction) {
|
||||
function getFile (pDevTeam, pBot, pSession, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction) {
|
||||
try {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] getFile -> Entering function.') }
|
||||
|
||||
const MAX_RETRIES = 3
|
||||
|
||||
getFileRecursively(0, pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction)
|
||||
getFileRecursively(0, pDevTeam, pBot, pSession, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction)
|
||||
|
||||
function getFileRecursively (pRetryCounter, pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction) {
|
||||
function getFileRecursively (pRetryCounter, pDevTeam, pBot, pSession, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction) {
|
||||
try {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] getFile -> getFileRecursively -> Entering function.') }
|
||||
if (INFO_LOG === true) { logger.write('[INFO] getFile -> getFileRecursively -> key = ' + pDevTeam.codeName + '-' + pBot.codeName + '-' + pSet.filePath + '-' + pSet.fileName) }
|
||||
@@ -112,6 +112,10 @@ function newFileCloud () {
|
||||
}
|
||||
}
|
||||
|
||||
if (pSession !== undefined) {
|
||||
filePath = filePath.replace('@Session', pSession.name.replace(' ', '-'))
|
||||
}
|
||||
|
||||
if (pExchange !== undefined) {
|
||||
filePath = filePath.replace('@Exchange', pExchange.name)
|
||||
}
|
||||
|
||||
+6
-3
@@ -27,6 +27,7 @@ function newFileCursor () {
|
||||
let fileCloud
|
||||
let devTeam
|
||||
let bot
|
||||
let session
|
||||
let product
|
||||
let thisSet
|
||||
let periodName
|
||||
@@ -50,6 +51,7 @@ function newFileCursor () {
|
||||
fileCloud = undefined
|
||||
devTeam = undefined
|
||||
bot = undefined
|
||||
session = undefined
|
||||
product = undefined
|
||||
thisSet = undefined
|
||||
periodName = undefined
|
||||
@@ -68,13 +70,14 @@ function newFileCursor () {
|
||||
}
|
||||
}
|
||||
|
||||
function initialize (pFileCloud, pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, pPeriodName, pTimePeriod, pCursorDate, pCurrentTimePeriod, pBeginDateRange, pEndDateRange, callBackFunction) {
|
||||
function initialize (pFileCloud, pDevTeam, pBot, pSession, pProduct, pSet, pExchange, pMarket, pPeriodName, pTimePeriod, pCursorDate, pCurrentTimePeriod, pBeginDateRange, pEndDateRange, callBackFunction) {
|
||||
try {
|
||||
market = pMarket
|
||||
exchange = pExchange
|
||||
fileCloud = pFileCloud
|
||||
devTeam = pDevTeam
|
||||
bot = pBot
|
||||
session = pSession
|
||||
product = pProduct
|
||||
thisSet = pSet
|
||||
periodName = pPeriodName
|
||||
@@ -109,7 +112,7 @@ function newFileCursor () {
|
||||
|
||||
dateString = targetDate.getUTCFullYear() + '-' + pad(targetDate.getUTCMonth() + 1, 2) + '-' + pad(targetDate.getUTCDate(), 2)
|
||||
|
||||
fileCloud.getFile(devTeam, bot, thisSet, exchange, market, periodName, targetDate, undefined, undefined, onFileReceived)
|
||||
fileCloud.getFile(devTeam, bot, session, thisSet, exchange, market, periodName, targetDate, undefined, undefined, onFileReceived)
|
||||
|
||||
function onFileReceived (err, file) {
|
||||
try {
|
||||
@@ -409,7 +412,7 @@ function newFileCursor () {
|
||||
if (thisObject.files.get(dateString) === undefined) {
|
||||
// We dont reload files we already have.
|
||||
|
||||
fileCloud.getFile(devTeam, bot, thisSet, exchange, market, periodName, targetDate, undefined, undefined, onFileReceived)
|
||||
fileCloud.getFile(devTeam, bot, session, thisSet, exchange, market, periodName, targetDate, undefined, undefined, onFileReceived)
|
||||
} else {
|
||||
controlLoop()
|
||||
}
|
||||
|
||||
+8
-5
@@ -22,6 +22,7 @@ function newFileSequence () {
|
||||
let market
|
||||
let devTeam
|
||||
let bot
|
||||
let session
|
||||
let thisSet
|
||||
let product
|
||||
let finalized = false
|
||||
@@ -48,6 +49,7 @@ function newFileSequence () {
|
||||
market = undefined
|
||||
devTeam = undefined
|
||||
bot = undefined
|
||||
session = undefined
|
||||
thisSet = undefined
|
||||
product = undefined
|
||||
|
||||
@@ -57,7 +59,7 @@ function newFileSequence () {
|
||||
}
|
||||
}
|
||||
|
||||
function initialize (pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, callBackFunction) {
|
||||
function initialize (pDevTeam, pBot, pSession, pProduct, pSet, pExchange, pMarket, callBackFunction) {
|
||||
try {
|
||||
exchange = ecosystem.getExchange(pProduct, pExchange)
|
||||
|
||||
@@ -68,6 +70,7 @@ function newFileSequence () {
|
||||
market = pMarket
|
||||
devTeam = pDevTeam
|
||||
bot = pBot
|
||||
session = pSession
|
||||
thisSet = pSet
|
||||
product = pProduct
|
||||
|
||||
@@ -85,7 +88,7 @@ function newFileSequence () {
|
||||
|
||||
/* First we will get the sequence max number */
|
||||
|
||||
fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, 'Sequence', undefined, onSequenceFileReceived)
|
||||
fileCloud.getFile(devTeam, bot, session, thisSet, exchange, market, undefined, undefined, 'Sequence', undefined, onSequenceFileReceived)
|
||||
|
||||
function onSequenceFileReceived (err, file) {
|
||||
try {
|
||||
@@ -130,7 +133,7 @@ function newFileSequence () {
|
||||
/* Now we will get the sequence of files */
|
||||
|
||||
for (let i = 0; i <= maxSequence; i++) {
|
||||
fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, i, undefined, onFileReceived)
|
||||
fileCloud.getFile(devTeam, bot, session, thisSet, exchange, market, undefined, undefined, i, undefined, onFileReceived)
|
||||
|
||||
function onFileReceived (err, file) {
|
||||
try {
|
||||
@@ -195,7 +198,7 @@ function newFileSequence () {
|
||||
|
||||
let currentMaxSequence = maxSequence
|
||||
|
||||
fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, 'Sequence', undefined, onSequenceFileReceived)
|
||||
fileCloud.getFile(devTeam, bot, session, thisSet, exchange, market, undefined, undefined, 'Sequence', undefined, onSequenceFileReceived)
|
||||
|
||||
function onSequenceFileReceived (err, sequenceFile) {
|
||||
try {
|
||||
@@ -231,7 +234,7 @@ function newFileSequence () {
|
||||
/* Now we will get the sequence of files, but in this case only from the currentMaxSequence and above. */
|
||||
|
||||
for (let i = currentMaxSequence; i <= maxSequence; i++) {
|
||||
fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, i, undefined, onFileReceived)
|
||||
fileCloud.getFile(devTeam, bot, session, thisSet, exchange, market, undefined, undefined, i, undefined, onFileReceived)
|
||||
|
||||
function onFileReceived (err, file) {
|
||||
try {
|
||||
|
||||
+6
-3
@@ -26,6 +26,7 @@ function newMarketFiles () {
|
||||
let exchange
|
||||
let devTeam
|
||||
let bot
|
||||
let session
|
||||
let thisSet
|
||||
let product
|
||||
let periodName
|
||||
@@ -53,6 +54,7 @@ function newMarketFiles () {
|
||||
exchange = undefined
|
||||
devTeam = undefined
|
||||
bot = undefined
|
||||
session = undefined
|
||||
thisSet = undefined
|
||||
product = undefined
|
||||
periodName = undefined
|
||||
@@ -63,7 +65,7 @@ function newMarketFiles () {
|
||||
}
|
||||
}
|
||||
|
||||
function initialize (pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, callBackFunction) {
|
||||
function initialize (pDevTeam, pBot, pSession, pProduct, pSet, pExchange, pMarket, callBackFunction) {
|
||||
try {
|
||||
exchange = ecosystem.getExchange(pProduct, pExchange)
|
||||
|
||||
@@ -74,6 +76,7 @@ function newMarketFiles () {
|
||||
market = pMarket
|
||||
devTeam = pDevTeam
|
||||
bot = pBot
|
||||
session = pSession
|
||||
thisSet = pSet
|
||||
product = pProduct
|
||||
|
||||
@@ -87,7 +90,7 @@ function newMarketFiles () {
|
||||
let periodName = marketFilesPeriods[i][1]
|
||||
|
||||
if (thisSet.validPeriods.includes(periodName) === true) {
|
||||
fileCloud.getFile(devTeam, bot, thisSet, exchange, market, periodName, undefined, undefined, undefined, onFileReceived)
|
||||
fileCloud.getFile(devTeam, bot, session, thisSet, exchange, market, periodName, undefined, undefined, undefined, onFileReceived)
|
||||
|
||||
function onFileReceived (err, file) {
|
||||
try {
|
||||
@@ -134,7 +137,7 @@ function newMarketFiles () {
|
||||
let periodName = marketFilesPeriods[i][1]
|
||||
|
||||
if (thisSet.validPeriods.includes(periodName) === true) {
|
||||
fileCloud.getFile(devTeam, bot, thisSet, exchange, market, periodName, undefined, undefined, undefined, onFileReceived)
|
||||
fileCloud.getFile(devTeam, bot, session, thisSet, exchange, market, periodName, undefined, undefined, undefined, onFileReceived)
|
||||
|
||||
function onFileReceived (err, file) {
|
||||
try {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ function newSingleFile () {
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize (pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, callBackFunction) {
|
||||
function initialize (pDevTeam, pBot, pSession, pProduct, pSet, pExchange, pMarket, callBackFunction) {
|
||||
try {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] initialize -> Entering function.') }
|
||||
if (INFO_LOG === true) { logger.write('[INFO] initialize -> key = ' + pDevTeam.codeName + '-' + pBot.codeName + '-' + pProduct.codeName) }
|
||||
@@ -34,7 +34,7 @@ function newSingleFile () {
|
||||
|
||||
/* Now we will get the file */
|
||||
|
||||
fileCloud.getFile(pDevTeam, pBot, pSet, exchange, pMarket, undefined, undefined, undefined, undefined, onFileReceived)
|
||||
fileCloud.getFile(pDevTeam, pBot, pSession, pSet, exchange, pMarket, undefined, undefined, undefined, undefined, onFileReceived)
|
||||
|
||||
function onFileReceived (err, pFile) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user