Learning Mine Simplified
This commit is contained in:
1 parent
d70422593d
commit
d1a703d72b
2 files changed
+1
-129
No files matched your search
@@ -1 +1 @@
|
||||
{"type":"Learning Mine","name":"Masters","config":"{ \n\"codeName\": \"Masters\"\n}","project":"Superalgos","learningBots":[{"type":"Learning Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Learning","config":"{\n \"codeName\": \"Learning\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Learning-Process\"\n }\n }","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Learning Engine","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Trading Episode","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Episode Counters","project":"Superalgos","id":"c0de6b69-60e2-4574-890a-35743f75c569","savedPayload":{"position":{"x":11131.109355831457,"y":18399.62641535906},"targetPosition":{"x":10916.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"ac1bc967-9c9f-47f0-8815-535abd7cb777"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Counters","project":"Superalgos","id":"da23a8ff-8b3d-4caa-a27c-f59352911212","savedPayload":{"position":{"x":11054.736015653314,"y":18432.230211733928},"targetPosition":{"x":10916.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"6881069e-a4d1-4b41-892f-557d2031adea"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Statistics","project":"Superalgos","id":"dfdcb71e-c123-429e-bc2d-cf33963378d6","savedPayload":{"position":{"x":10973.672144862325,"y":18450.245302086223},"targetPosition":{"x":10916.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"8408c316-e04d-4b0d-8c81-1bf3b4126894"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Statistics","project":"Superalgos","id":"fa9e000d-199c-4ed4-b10f-6c586bfc2fa5","savedPayload":{"position":{"x":10890.678276352872,"y":18453.05820412071},"targetPosition":{"x":10916.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"553a0b49-2a61-41c4-ac95-f762051c1cab"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","project":"Superalgos","id":"a9a7b1fe-ecff-4d08-bd3b-297e4263c703","savedPayload":{"position":{"x":10808.580666776874,"y":18440.573127832315},"targetPosition":{"x":10916.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"a08a3974-75ac-4a2b-bc09-f80547a61381"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","project":"Superalgos","id":"d80bea92-bca6-4826-aa32-34bc7c13f952","savedPayload":{"position":{"x":10730.175051763214,"y":18413.21523751984},"targetPosition":{"x":10916.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"46221186-fff7-4333-a087-a32a649e9ce8"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Balances","project":"Superalgos","id":"7f1463e2-38f8-4850-8198-bf9cee6507df","savedPayload":{"position":{"x":10658.13144049401,"y":18371.916173325702},"targetPosition":{"x":10916.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"ee987e46-ed3c-4ade-8ab8-e6e503f46963"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Balances","project":"Superalgos","id":"3651b117-ece2-4a25-b2a4-21a54a737d50","savedPayload":{"position":{"x":10594.903191744248,"y":18318.082325348263},"targetPosition":{"x":10916.997186924276,"y":18003.828513487584},"floatingObjectLine truncated
|
||||
{"type":"Learning Mine","name":"Masters","config":"{ \n\"codeName\": \"Masters\"\n}","project":"Superalgos","learningBots":[{"type":"Learning Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Learning","config":"{\n \"codeName\": \"Learning\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Learning-Process\"\n }\n }","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Learning Engine","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Trading Episode","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Trading Episode Counters","project":"Superalgos","id":"c0de6b69-60e2-4574-890a-35743f75c569","savedPayload":{"position":{"x":11096.193715496249,"y":18419.16327303778},"targetPosition":{"x":10922.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"ac1bc967-9c9f-47f0-8815-535abd7cb777"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Trading Episode Counters","project":"Superalgos","id":"da23a8ff-8b3d-4caa-a27c-f59352911212","savedPayload":{"position":{"x":10972.16471539031,"y":18451.134397804504},"targetPosition":{"x":10922.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"6881069e-a4d1-4b41-892f-557d2031adea"}}},{"type":"Output Dataset","name":"Multi-Period-Market Learning Episode Statistics","project":"Superalgos","id":"dfdcb71e-c123-429e-bc2d-cf33963378d6","savedPayload":{"position":{"x":10844.152454538604,"y":18446.867460054396},"targetPosition":{"x":10922.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"8408c316-e04d-4b0d-8c81-1bf3b4126894"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Learning Episode Statistics","project":"Superalgos","id":"fa9e000d-199c-4ed4-b10f-6c586bfc2fa5","savedPayload":{"position":{"x":10722.527724997106,"y":18406.708141707517},"targetPosition":{"x":10922.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"553a0b49-2a61-41c4-ac95-f762051c1cab"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","project":"Superalgos","id":"a9a7b1fe-ecff-4d08-bd3b-297e4263c703","savedPayload":{"position":{"x":10617.14383902315,"y":18333.909911899664},"targetPosition":{"x":10922.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"a08a3974-75ac-4a2b-bc09-f80547a61381"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","project":"Superalgos","id":"d80bea92-bca6-4826-aa32-34bc7c13f952","savedPayload":{"position":{"x":10536.538372316247,"y":18234.370450262126},"targetPosition":{"x":10922.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"46221186-fff7-4333-a087-a32a649e9ce8"}}},{"type":"Output Dataset","name":"Multi-Period-Market Distance To Learning Event","project":"Superalgos","id":"0b8ef0c4-c7a9-48cf-9f9b-e48d32f5ed27","savedPayload":{"position":{"x":10487.241500409818,"y":18116.153851992807},"targetPosition":{"x":10922.997186924276,"y":18003.828513487584},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"0d746a41-6726-41fd-9312-862b6835b8ba"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Distance To Learning Event","project":"Superalgos","id":"a8951035-4bf1-4d0d-8666-879b2c481b6d","savedPayload":{"position":{"x":10473.246962685937,"y":17988.837322822303},"targetPosition":{"x":109Line truncated
|
||||
-128
@@ -257,15 +257,6 @@ exports.newSuperalgosBotModulesLearningSimulation = function (processIndex) {
|
||||
'[IMPORTANT] runSimulation -> Final Datetime Reached. Stopping the Session now. ')
|
||||
return
|
||||
}
|
||||
|
||||
if (checkMinimunAndMaximunBalance() === false) {
|
||||
closeEpisode('Min or Max Balance Reached')
|
||||
breakLoop = true
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.stopSession(processIndex, 'Min or Max Balance Reached')
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
'[IMPORTANT] runSimulation -> Min or Max Balance Reached. Stopping the Session now. ')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
function checkIfWeNeedToStopAfterBothCycles() {
|
||||
@@ -548,125 +539,6 @@ exports.newSuperalgosBotModulesLearningSimulation = function (processIndex) {
|
||||
return true
|
||||
}
|
||||
|
||||
function checkMinimunAndMaximunBalance() {
|
||||
/* Checks for Minimun and Maximun Balance. We do the check while not inside any strategy only. */
|
||||
if (
|
||||
learningEngine.learningCurrent.strategy.index.value === learningEngine.learningCurrent.strategy.index.config.initialValue
|
||||
) {
|
||||
/*
|
||||
We will perform this check only when we are not inside a position,
|
||||
because there the balances have shifted from their resting position.
|
||||
*/
|
||||
|
||||
let stopRunningDate = (new Date(learningEngine.learningCurrent.learningEpisode.candle.begin.value)).toUTCString()
|
||||
|
||||
if (sessionParameters.sessionBaseAsset.config.minimumBalance !== undefined) {
|
||||
if (learningEngine.learningCurrent.learningEpisode.episodeBaseAsset.balance.value <= sessionParameters.sessionBaseAsset.config.minimumBalance) {
|
||||
const errorMessage = 'Min Balance reached @ ' + stopRunningDate
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Learning Bot Error - Minimum Balance Reached',
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
let contextInfo = {
|
||||
timestamp: stopRunningDate,
|
||||
episodeBaseAssetBalance: learningEngine.learningCurrent.learningEpisode.episodeBaseAsset.balance.value,
|
||||
sessionBaseAssetMinimumBalance: sessionParameters.sessionBaseAsset.config.minimumBalance
|
||||
}
|
||||
|
||||
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
|
||||
|
||||
learningSystem.addError([learningSystem.id, errorMessage, docs])
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
'[WARN] runSimulation -> checkMinimunAndMaximunBalance -> ' + errorMessage)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (sessionParameters.sessionBaseAsset.config.maximumBalance !== undefined) {
|
||||
if (learningEngine.learningCurrent.learningEpisode.episodeBaseAsset.balance.value >= sessionParameters.sessionBaseAsset.config.maximumBalance) {
|
||||
const errorMessage = 'Max Balance reached @ ' + stopRunningDate
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Learning Bot Error - Maximum Balance Reached',
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
let contextInfo = {
|
||||
timestamp: stopRunningDate,
|
||||
episodeBaseAssetBalance: learningEngine.learningCurrent.learningEpisode.episodeBaseAsset.balance.value,
|
||||
sessionBaseAssetMaximumBalance: sessionParameters.sessionBaseAsset.config.maximumBalance
|
||||
}
|
||||
|
||||
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
|
||||
|
||||
learningSystem.addError([learningSystem.id, errorMessage, docs])
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
'[WARN] runSimulation -> checkMinimunAndMaximunBalance -> ' + errorMessage)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (sessionParameters.sessionQuotedAsset.config.minimumBalance !== undefined) {
|
||||
if (learningEngine.learningCurrent.learningEpisode.episodeQuotedAsset.balance.value <= sessionParameters.sessionQuotedAsset.config.minimumBalance) {
|
||||
const errorMessage = 'Min Balance reached @ ' + stopRunningDate
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Learning Bot Error - Minimum Balance Reached',
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
let contextInfo = {
|
||||
timestamp: stopRunningDate,
|
||||
episodeQuotedAssetBalance: learningEngine.learningCurrent.learningEpisode.episodeQuotedAsset.balance.value,
|
||||
sessionQuotedAssetMinimumBalance: sessionParameters.sessionQuotedAsset.config.minimumBalance
|
||||
}
|
||||
|
||||
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
|
||||
|
||||
learningSystem.addError([learningSystem.id, errorMessage, docs])
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
'[WARN] runSimulation -> checkMinimunAndMaximunBalance -> ' + errorMessage)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (sessionParameters.sessionQuotedAsset.config.maximumBalance !== undefined) {
|
||||
if (learningEngine.learningCurrent.learningEpisode.episodeQuotedAsset.balance.value >= sessionParameters.sessionQuotedAsset.config.maximumBalance) {
|
||||
const errorMessage = 'Max Balance reached @ ' + stopRunningDate
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Learning Bot Error - Maximum Balance Reached',
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
let contextInfo = {
|
||||
timestamp: stopRunningDate,
|
||||
episodeQuotedAssetBalance: learningEngine.learningCurrent.learningEpisode.episodeQuotedAsset.balance.value,
|
||||
sessionQuotedAssetMaximumBalance: sessionParameters.sessionQuotedAsset.config.maximumBalance
|
||||
}
|
||||
|
||||
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, undefined, contextInfo)
|
||||
|
||||
learningSystem.addError([learningSystem.id, errorMessage, docs])
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
'[WARN] runSimulation -> checkMinimunAndMaximunBalance -> ' + errorMessage)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true
|
||||
}
|
||||
} catch (err) {
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).UNEXPECTED_ERROR = err
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
|
||||
Reference in new issue
Block a user