Learning Session Running
This commit is contained in:
1 parent
6f96be5934
commit
4d38e06633
4 files changed
+32
-182
No files matched your search
@@ -781,6 +781,21 @@
|
||||
"fileName": "ExchangeAPI.js",
|
||||
"folderName": "Trading-Bot/Low-Frequency-Trading/APIs"
|
||||
},
|
||||
{
|
||||
"name": "Single Market Learning Bot",
|
||||
"propertyName": "singleMarketLearningBot",
|
||||
"functionName": "newSuperalgosBotModulesSingleMarketLearningBot",
|
||||
"fileName": "SingleMarketLearningBot.js",
|
||||
"folderName": "Learning-Bot",
|
||||
"botType": "Learning Bot"
|
||||
},
|
||||
{
|
||||
"name": "Learning Session",
|
||||
"propertyName": "learningSession",
|
||||
"functionName": "newSuperalgosBotModulesLearningSession",
|
||||
"fileName": "LearningSession.js",
|
||||
"folderName": "Learning-Bot"
|
||||
},
|
||||
{
|
||||
"name": "Learning Process",
|
||||
"propertyName": "learningProcess",
|
||||
|
||||
@@ -9644,6 +9644,18 @@
|
||||
"childType": "Learning Algorithm",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "timeRange",
|
||||
"type": "node",
|
||||
"childType": "Time Range",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "timeFrame",
|
||||
"type": "node",
|
||||
"childType": "Time Frame",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "heartbeats",
|
||||
"type": "node",
|
||||
@@ -9932,7 +9944,7 @@
|
||||
},
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Trading Parameters->"
|
||||
"compatibleTypes": "->Trading Parameters->Learning Parameters->"
|
||||
},
|
||||
"propertyNameAtParent": "timeRange"
|
||||
},
|
||||
@@ -9965,7 +9977,7 @@
|
||||
},
|
||||
"level": 3,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Trading Parameters->"
|
||||
"compatibleTypes": "->Trading Parameters->Learning Parameters->"
|
||||
},
|
||||
"propertyNameAtParent": "timeFrame"
|
||||
},
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
let aYearAgo = today - TS.projects.superalgos.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
let aYearFromNow = today + TS.projects.superalgos.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
|
||||
switch (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type) {
|
||||
case 'Backtesting Session': {
|
||||
case 'Back Learning Session': {
|
||||
useDefaultDatetimes(aYearAgo, today)
|
||||
break
|
||||
}
|
||||
@@ -303,14 +303,6 @@
|
||||
useDefaultDatetimes(today, aYearFromNow)
|
||||
break
|
||||
}
|
||||
case 'Fordward Testing Session': {
|
||||
useDefaultDatetimes(today, aYearFromNow)
|
||||
break
|
||||
}
|
||||
case 'Paper Learning Session': {
|
||||
useDefaultDatetimes(today, aYearFromNow)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
function useDefaultDatetimes(initialDefault, finalDefault) {
|
||||
@@ -396,110 +388,6 @@
|
||||
return false
|
||||
}
|
||||
|
||||
/* Session Base Asset */
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.sessionBaseAsset === undefined) {
|
||||
let errorMessage = "Session Base Asset Node Missing"
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] initialize -> checkParemeters -> " + errorMessage)
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS Learning Session Error - ' + errorMessage,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters, errorMessage, docs)
|
||||
return false
|
||||
}
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.sessionBaseAsset.config.initialBalance === undefined) {
|
||||
let errorMessage = "Initial Balance Property Missing"
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] initialize -> checkParemeters -> " + errorMessage)
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS Learning Session Error - ' + errorMessage,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.sessionBaseAsset, errorMessage, docs)
|
||||
return false
|
||||
}
|
||||
|
||||
/* Session Quoted Asset */
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.sessionQuotedAsset === undefined) {
|
||||
let errorMessage = "Session Quoted Asset Node Missing"
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] initialize -> checkParemeters -> " + errorMessage)
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS Learning Session Error - ' + errorMessage,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters, errorMessage, docs)
|
||||
return false
|
||||
}
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.sessionQuotedAsset.config.initialBalance === undefined) {
|
||||
let errorMessage = "Initial Balance Property Missing"
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] initialize -> checkParemeters -> " + errorMessage)
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS Learning Session Error - ' + errorMessage,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.sessionQuotedAsset, errorMessage, docs)
|
||||
return false
|
||||
}
|
||||
|
||||
/* Slippage */
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.slippage === undefined) { // if the Slippage is missing we create a default one.
|
||||
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.slippage = {
|
||||
name: 'Missing Slippage',
|
||||
type: 'Slippage',
|
||||
config: {
|
||||
marketOrderRate: 0,
|
||||
stopLoss: 0,
|
||||
takeProfit: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.slippage.config.marketOrderRate === undefined) { // if the marketOrderRate is missing we create a default one.
|
||||
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.slippage.config.marketOrderRate = 0
|
||||
}
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.slippage.config.stopLoss === undefined) { // if the stopLoss is missing we create a default one.
|
||||
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.slippage.config.stopLoss = 0
|
||||
}
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.slippage.config.takeProfit === undefined) { // if the takeProfit is missing we create a default one.
|
||||
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.slippage.config.takeProfit = 0
|
||||
}
|
||||
|
||||
/* Fee Structure */
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.feeStructure === undefined) { // if the Fee Structure is missing we create a default one.
|
||||
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.feeStructure = {
|
||||
name: 'Missing Fee Structure',
|
||||
type: 'Fee Structure',
|
||||
config: {
|
||||
maker: 0,
|
||||
taker: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.feeStructure.config.maker === undefined) { // if the maker is missing we create a default one.
|
||||
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.feeStructure.config.maker = 0
|
||||
}
|
||||
if (TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.feeStructure.config.taker === undefined) { // if the taker is missing we create a default one.
|
||||
TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.feeStructure.config.taker = 0
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -507,72 +395,8 @@
|
||||
return true
|
||||
}
|
||||
|
||||
function checkKey() {
|
||||
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference === undefined) {
|
||||
let errorMessage = "Key Reference Node Missing"
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] initialize -> checkKey -> " + errorMessage)
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS Learning Session Error - ' + errorMessage,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.taskConstants.TASK_NODE, errorMessage, docs)
|
||||
return false
|
||||
}
|
||||
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent === undefined) {
|
||||
let errorMessage = "Exchange Account Key Node Missing"
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] initialize -> checkKey -> " + errorMessage)
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS Learning Session Error - ' + errorMessage,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference, errorMessage, docs)
|
||||
return false
|
||||
}
|
||||
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.codeName === undefined) {
|
||||
let errorMessage = "Codename Property Missing"
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] initialize -> checkKey -> " + errorMessage)
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS Learning Session Error - ' + errorMessage,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent, errorMessage, docs)
|
||||
return false
|
||||
}
|
||||
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent.config.secret === undefined) {
|
||||
let errorMessage = "Secret Property Missing"
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_INSTANCE_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] initialize -> checkKey -> " + errorMessage)
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS Learning Session Error - ' + errorMessage,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.sessionFunctions.sessionError(processIndex, TS.projects.superalgos.globals.taskConstants.TASK_NODE.keyReference.referenceParent, errorMessage, docs)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function startLiveLearning() {
|
||||
return checkKey()
|
||||
return true
|
||||
}
|
||||
|
||||
function getTimeFrameFromLabel(timeFrameLabel) {
|
||||
|
||||
@@ -127,8 +127,7 @@ function newSuperalgosFunctionLibraryLearningSessionFunctions() {
|
||||
lightingPath = '' +
|
||||
'Back Learning Session->Live Learning Session->' +
|
||||
'Learning Parameters->' +
|
||||
'Session Base Asset->Session Quoted Asset->Time Range->Time Frame->Slippage->Fee Structure->Snapshots->Heartbeats->User Defined Parameters->' +
|
||||
'Exchange Account Asset->Asset->' +
|
||||
'Learning Algorithm->Time Range->Time Frame->Heartbeats->User Defined Parameters->' +
|
||||
'Social Bots->Telegram Bot->'
|
||||
|
||||
let session = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node, false, true, true, false, false, lightingPath)
|
||||
|
||||
Reference in new issue
Block a user