Trading Position Error Handling improved, connected to the Docs.
This commit is contained in:
1 parent
e588048edf
commit
80f063e92a
10 files changed
+290
-59
No files matched your search
-32
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"topic": "TS LF Trading Bot Errors",
|
||||
"pageNumber": "6",
|
||||
"type": "TS LF Trading Bot Error - Minimum Balance Reached",
|
||||
"definition": {
|
||||
"text": "The execution of the Trading System was halted because the minimun balance configured was reached. ",
|
||||
"updated": 1611588526786
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "You are allowed to configure at the Session Base Asset and Session Quoted Asset nodes a minimum balance. If you do that -- because it is optional -- the LF Trading Bot will check at every candle during the Trading Simulation that the balance has not reached that minimum. If it does, this error is triggered and the Trading System stops it's execution inmediatelly.",
|
||||
"updated": 1611588663021
|
||||
},
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Maximum Balance Reached"
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Context Information"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "When this error happened, some context information was preserved for you to analize. Following is that info:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "contectInfo "
|
||||
}
|
||||
]
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"topic": "TS LF Trading Bot Errors",
|
||||
"pageNumber": "7",
|
||||
"type": "TS LF Trading Bot Error - Initial Targets Node Missing",
|
||||
"definition": {
|
||||
"text": "A Initial Targets Node was expected but not found at the node where the error poped up.",
|
||||
"updated": 1611595619753
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Initial Targets Node Missing",
|
||||
"updated": 1611597134772
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "Add the missing node and try again."
|
||||
}
|
||||
]
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"topic": "TS LF Trading Bot Errors",
|
||||
"pageNumber": "8",
|
||||
"type": "TS LF Trading Bot Error - Target Rate Node Missing",
|
||||
"definition": {
|
||||
"text": "A Target Rate Node was expected but not found at the node where the error poped up.",
|
||||
"updated": 1611595784678
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Target Rate Node Missing",
|
||||
"updated": 1611597188490
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "Add the missing node and try again."
|
||||
}
|
||||
]
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"topic": "TS LF Trading Bot Errors",
|
||||
"pageNumber": "9",
|
||||
"type": "TS LF Trading Bot Error - Formula Node Missing",
|
||||
"definition": {
|
||||
"text": "A Formula Node was expected but not found at the node where the error poped up.",
|
||||
"updated": 1611595849189
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Formula Node Missing",
|
||||
"updated": 1611597209589
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "Add the missing node and try again."
|
||||
}
|
||||
]
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"topic": "TS LF Trading Bot Errors",
|
||||
"pageNumber": "10",
|
||||
"type": "TS LF Trading Bot Error - Target Rate Node Value Undefined",
|
||||
"definition": {
|
||||
"text": "The value of the Target Rate Node can not be undefined.",
|
||||
"updated": 1611595915288
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Target Rate Node Value Undefined",
|
||||
"updated": 1611597251672
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "Check the Formula and try again."
|
||||
}
|
||||
]
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"topic": "TS LF Trading Bot Errors",
|
||||
"pageNumber": "11",
|
||||
"type": "TS LF Trading Bot Error - Target Rate Node Value Not A Number",
|
||||
"definition": {
|
||||
"text": "The value of the Target Rate Node must be a number.",
|
||||
"updated": 1611596016533
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Target Rate Node Value Not A Number",
|
||||
"updated": 1611597315894
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The value found for this node was:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "nodeValue"
|
||||
}
|
||||
]
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"topic": "TS LF Trading Bot Errors",
|
||||
"pageNumber": "12",
|
||||
"type": "TS LF Trading Bot Error - Only One Target Size Allowed",
|
||||
"definition": {
|
||||
"text": "You can not define a Target Size In Base Asset and a Target Size In Quoted Asset simultaneously. You need to pick one of the two and delete the not chosen one.",
|
||||
"updated": 1611596226356
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Only One Target Size Allowed",
|
||||
"updated": 1611597356700
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "Delete one of the nodes and try again."
|
||||
}
|
||||
]
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"topic": "TS LF Trading Bot Errors",
|
||||
"pageNumber": "13",
|
||||
"type": "TS LF Trading Bot Error - Target Size Value Undefined",
|
||||
"definition": {
|
||||
"text": "The value of the Target Size can not be undefined.",
|
||||
"updated": 1611595969754
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Target Size Value Undefined",
|
||||
"updated": 1611597396791
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "Check the Formula and try again."
|
||||
}
|
||||
]
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"topic": "TS LF Trading Bot Errors",
|
||||
"pageNumber": "14",
|
||||
"type": "TS LF Trading Bot Error - Target Size Value Zero",
|
||||
"definition": {
|
||||
"text": "The Target Size can not be Zero, and that was what was found.",
|
||||
"updated": 1611596320709
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Target Size Value Zero",
|
||||
"updated": 1611597441758
|
||||
},
|
||||
{
|
||||
"style": "Success",
|
||||
"text": "Make yourself sure that the Formula you defined does ont evaluate to Zero, and try again."
|
||||
}
|
||||
]
|
||||
}
|
||||
+126
-27
@@ -153,7 +153,7 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
|
||||
during the same candle.
|
||||
*/
|
||||
node.finalValue.value = node.value
|
||||
}
|
||||
}
|
||||
|
||||
function updateStopLossTakeProfitBeginEnd(node) {
|
||||
/*
|
||||
@@ -181,8 +181,16 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
|
||||
function initialTargets(tradingSystemStageNode, tradingEngineStageNode) {
|
||||
|
||||
if (tradingSystemStageNode.initialTargets === undefined) {
|
||||
const message = 'Stage without Initial Targets node. Add one please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode)
|
||||
const message = 'Initial Targets Node Missing'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode, docs)
|
||||
}
|
||||
|
||||
setTargetRate()
|
||||
@@ -190,22 +198,56 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
|
||||
|
||||
function setTargetRate() {
|
||||
if (tradingSystemStageNode.initialTargets.targetRate === undefined) {
|
||||
const message = 'Target Rate Node not Found. Fix this please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets)
|
||||
const message = 'Target Rate Node Missing'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets, docs)
|
||||
}
|
||||
if (tradingSystemStageNode.initialTargets.targetRate.formula === undefined) {
|
||||
const message = 'Formula of Target Rate Node not Found. Fix this please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetRate)
|
||||
const message = 'Formula Node Missing'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetRate, docs)
|
||||
}
|
||||
|
||||
let value = tradingSystem.formulas.get(tradingSystemStageNode.initialTargets.targetRate.formula.id)
|
||||
if (value === undefined) {
|
||||
const message = 'Target Rate can not be undefined. Fix this please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetRate)
|
||||
const message = 'Target Rate Node Value Undefined'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetRate, docs)
|
||||
}
|
||||
if (isNaN(value)) {
|
||||
const message = 'Target Rate must be a number. Fix this please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetRate)
|
||||
const message = 'Target Rate Node Value Not A Number'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, undefined, undefined, undefined, value, undefined)
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetRate, docs)
|
||||
}
|
||||
|
||||
switch (tradingSystemStageNode.type) {
|
||||
@@ -226,8 +268,17 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
|
||||
tradingSystemStageNode.initialTargets.targetSizeInBaseAsset !== undefined &&
|
||||
tradingSystemStageNode.initialTargets.targetSizeInQuotedAsset !== undefined
|
||||
) {
|
||||
const message = 'Only Target Size In Base Asset or Target Size In Quoted Asset is allowed. Remove one of them please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode)
|
||||
// 'Only Target Size In Base Asset or Target Size In Quoted Asset is allowed.'
|
||||
const message = 'Only One Target Size Allowed'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets, docs)
|
||||
}
|
||||
|
||||
/* Position In Base Asset */
|
||||
@@ -235,12 +286,28 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
|
||||
if (tradingSystemStageNode.initialTargets.targetSizeInBaseAsset.formula !== undefined) {
|
||||
let value = tradingSystem.formulas.get(tradingSystemStageNode.initialTargets.targetSizeInBaseAsset.formula.id)
|
||||
if (value === undefined) {
|
||||
const message = 'Target Size In Base Asset cannot be undefined. Fix this please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInBaseAsset)
|
||||
const message = 'Target Size Value Undefined'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInBaseAsset, docs)
|
||||
}
|
||||
if (value === 0) {
|
||||
const message = 'Target Size In Base Asset cannot be zero. Fix this please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInBaseAsset)
|
||||
const message = 'Target Size Value Zero'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInBaseAsset, docs)
|
||||
}
|
||||
|
||||
switch (tradingSystemStageNode.type) {
|
||||
@@ -261,8 +328,16 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
|
||||
/* Remember how the end user defined this stage. */
|
||||
tradingEngineStageNode.stageDefinedIn.value = 'Base Asset'
|
||||
} else {
|
||||
const message = 'You need to specify a Formula for this.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInBaseAsset)
|
||||
const message = 'Formula Node Missing'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInBaseAsset, docs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,12 +346,28 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
|
||||
if (tradingSystemStageNode.initialTargets.targetSizeInQuotedAsset.formula !== undefined) {
|
||||
let value = tradingSystem.formulas.get(tradingSystemStageNode.initialTargets.targetSizeInQuotedAsset.formula.id)
|
||||
if (value === undefined) {
|
||||
const message = 'Target Size In Quoted Asset cannot be undefined. Fix this please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInQuotedAsset)
|
||||
const message = 'Target Size Value Undefined'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInQuotedAsset, docs)
|
||||
}
|
||||
if (value === 0) {
|
||||
const message = 'Target Size In Quoted Asset cannot be zero. Fix this please.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInQuotedAsset)
|
||||
const message = 'Target Size Value Zero'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInQuotedAsset, docs)
|
||||
}
|
||||
switch (tradingSystemStageNode.type) {
|
||||
case 'Open Stage': {
|
||||
@@ -296,8 +387,16 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
|
||||
/* Remember how the end user defined this stage. */
|
||||
tradingEngineStageNode.stageDefinedIn.value = 'Quoted Asset'
|
||||
} else {
|
||||
const message = 'You need to specify a Formula for this.'
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInQuotedAsset)
|
||||
const message = 'Formula Node Missing'
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
badDefinitionUnhandledException(undefined, message, tradingSystemStageNode.initialTargets.targetSizeInQuotedAsset, docs)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,8 +516,8 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
function badDefinitionUnhandledException(err, message, node) {
|
||||
tradingSystem.errors.push([node.id, message])
|
||||
function badDefinitionUnhandledException(err, message, node, docs) {
|
||||
tradingSystem.errors.push([node.id, message, docs])
|
||||
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> " + message);
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] -> node.name = " + node.name);
|
||||
|
||||
Reference in new issue
Block a user