Warnings plotted, completely integrated with the docs

This commit is contained in:
Luis Fernando Molina committed 2021-01-29 10:10:31 +01:00
1 parent fce5866da8
commit 86ba3bcfbe
4 files changed
+80 -26

No files matched your search

@@ -1 +1 @@
{"type":"Trading Mine","name":"Masters","config":"{ \n\"codeName\": \"Masters\"\n}","project":"Superalgos","tradingBots":[{"type":"Trading Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Trading","config":"{\n \"codeName\": \"Trading\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Trading-Process\"\n }\n }","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Trading Engine","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Episode","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Episode Counters","project":"Superalgos","id":"ec8d74ba-a4ad-417a-b479-6bae95b8a1fe","savedPayload":{"position":{"x":24910.97457254189,"y":18457.46644293786},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"3ed03a02-381d-43fe-9faa-761728c53bd8"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Counters","project":"Superalgos","id":"22b0af33-8c2f-4194-839b-affd18f298d5","savedPayload":{"position":{"x":24834.601232363748,"y":18490.07023931273},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"15f5b150-f1cf-403c-8cb9-2c7c4e1db8e8"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Statistics","project":"Superalgos","id":"23ab91ae-2e78-4993-bb69-855f69cef1ce","savedPayload":{"position":{"x":24753.53736157276,"y":18508.085329665024},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"fc9dc0f7-35e0-4548-bb91-f920825d694f"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Statistics","project":"Superalgos","id":"d0a4515a-279d-4c27-8de2-168108861242","savedPayload":{"position":{"x":24670.543493063306,"y":18510.89823169951},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"91953362-8751-4440-a898-21245cd47c15"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","project":"Superalgos","id":"7fc80977-5b37-413e-8107-0a89a16e08b0","savedPayload":{"position":{"x":24588.445883487308,"y":18498.413155411115},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"17fb41f5-61b5-4433-9a10-950ff8216a7e"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","project":"Superalgos","id":"a6888750-1043-420c-9253-633e1399c5e4","savedPayload":{"position":{"x":24510.040268473647,"y":18471.05526509864},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"bbc9467d-28bf-432b-9e49-582d1bcabfb9"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Balances","project":"Superalgos","id":"0ad114df-f076-4a86-8c62-4c4a146da73c","savedPayload":{"position":{"x":24437.996657204443,"y":18429.756200904503},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"acddff59-b51b-4b45-b58f-71d4077755ee"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Balances","project":"Superalgos","id":"04b51302-957d-4365-ad55-9f89d60e261c","savedPayload":{"position":{"x":24374.76840845468,"y":18375.922352927064},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFroLine truncated
{"type":"Trading Mine","name":"Masters","config":"{ \n\"codeName\": \"Masters\"\n}","project":"Superalgos","tradingBots":[{"type":"Trading Bot","name":"Low Frequency","config":"{\n\"codeName\": \"Low-Frequency\"\n}","project":"Superalgos","processes":[{"type":"Process Definition","name":"Trading","config":"{\n \"codeName\": \"Trading\",\n \"sessionRunWaitTime\": 5000,\n \"retryWaitTime\": 10000,\n \"framework\": {\n \"name\": \"Low-Frequency-Trading-Process\"\n }\n }","project":"Superalgos","processOutput":{"type":"Process Output","name":"New Process Output","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Trading Engine","project":"Superalgos","outputDatasets":[],"outputDatasetFolders":[{"type":"Output Dataset Folder","name":"Episode","project":"Superalgos","outputDatasets":[{"type":"Output Dataset","name":"Multi-Period-Market Episode Counters","project":"Superalgos","id":"ec8d74ba-a4ad-417a-b479-6bae95b8a1fe","savedPayload":{"position":{"x":24910.97457254189,"y":18457.46644293786},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"3ed03a02-381d-43fe-9faa-761728c53bd8"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Counters","project":"Superalgos","id":"22b0af33-8c2f-4194-839b-affd18f298d5","savedPayload":{"position":{"x":24834.601232363748,"y":18490.07023931273},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"15f5b150-f1cf-403c-8cb9-2c7c4e1db8e8"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Statistics","project":"Superalgos","id":"23ab91ae-2e78-4993-bb69-855f69cef1ce","savedPayload":{"position":{"x":24753.53736157276,"y":18508.085329665024},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"fc9dc0f7-35e0-4548-bb91-f920825d694f"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Statistics","project":"Superalgos","id":"d0a4515a-279d-4c27-8de2-168108861242","savedPayload":{"position":{"x":24670.543493063306,"y":18510.89823169951},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"91953362-8751-4440-a898-21245cd47c15"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Candle","project":"Superalgos","id":"7fc80977-5b37-413e-8107-0a89a16e08b0","savedPayload":{"position":{"x":24588.445883487308,"y":18498.413155411115},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"17fb41f5-61b5-4433-9a10-950ff8216a7e"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Candle","project":"Superalgos","id":"a6888750-1043-420c-9253-633e1399c5e4","savedPayload":{"position":{"x":24510.040268473647,"y":18471.05526509864},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Daily","id":"bbc9467d-28bf-432b-9e49-582d1bcabfb9"}}},{"type":"Output Dataset","name":"Multi-Period-Market Episode Balances","project":"Superalgos","id":"0ad114df-f076-4a86-8c62-4c4a146da73c","savedPayload":{"position":{"x":24437.996657204443,"y":18429.756200904503},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Dataset Definition","name":"Multi-Period-Market","id":"acddff59-b51b-4b45-b58f-71d4077755ee"}}},{"type":"Output Dataset","name":"Multi-Period-Daily Episode Balances","project":"Superalgos","id":"04b51302-957d-4365-ad55-9f89d60e261c","savedPayload":{"position":{"x":24374.76840845468,"y":18375.922352927064},"targetPosition":{"x":24696.86240363471,"y":18061.668541066385},"floatingObject":{"isPinned":false,"isFroLine truncated
@@ -3,8 +3,8 @@
"pageNumber": "13",
"type": "TS LF Trading Bot Warning - Order Size Shrinked",
"definition": {
"text": "The Order Size wahs shrinked so that the Size Placed once the order is filled, does not produce that we go over the Target Size defined for the whole stage.",
"updated": 1611833827822
"text": "The Order Size was shrinked so that the Size Placed once the order is filled, does not produce that we go over the Target Size defined for the whole stage.",
"updated": 1611910725966
},
"paragraphs": [
{
@@ -155,8 +155,7 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
/* Check Events that happens at the Exchange, if needed. */
let allGood = await checkExchangeEvents(tradingEngineStage, tradingSystemOrder, tradingEngineOrder)
if (allGood !== true)
{
if (allGood !== true) {
/*
For some reason we could not check the order at the exchange, so we will not even check if we
need to cancel it, since we could end up with inconsistent information at the accounting level.
@@ -179,7 +178,7 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
]
)
}
// return
return
}
/* Check if we need to cancel the order */
@@ -277,8 +276,7 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
await calculateOrderSize()
/* Check Size: We are not going to create Orders which size is equal or less to zero. */
//if (tradingEngineOrder.orderBaseAsset.size.value <= 0)
{
if (tradingEngineOrder.orderBaseAsset.size.value <= 0) {
const message = 'Order Size Value Zero Or Negative'
let docs = {
@@ -295,11 +293,10 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
docs
]
)
// return
return
}
//if (tradingEngineOrder.orderQuotedAsset.size.value <= 0)
{
if (tradingEngineOrder.orderQuotedAsset.size.value <= 0) {
const message = 'Order Size Value Zero Or Negative'
let docs = {
@@ -316,7 +313,7 @@ exports.newSuperalgosBotModulesTradingOrders = function (processIndex) {
docs
]
)
// return
return
}
/* Place Order at the Exchange, if needed. */
@@ -1,7 +1,7 @@
function newNodesWarnings() {
const MODULE_NAME = 'Nodes Warnings'
const logger = newWebDebugLog()
let thisObject = {
onRecordChange: onRecordChange,
@@ -21,27 +21,84 @@ function newNodesWarnings() {
function onRecordChange(currentRecord) {
if (currentRecord === undefined) { return }
let array = currentRecord.warnings
if (array === undefined) { return }
for (let i = 0; i < array.length; i++) {
let arrayItem = array[i]
if (currentRecord.rateIndex === undefined) {
/*
The user is not pointing to any rate in particular, so we are
going to report all warnings to the nodes involved.
*/
let array = currentRecord.warnings
if (array === undefined) { return }
for (let i = 0; i < array.length; i++) {
let arrayItem = array[i]
let docs = arrayItem[2]
let nodeIdArray = arrayItem[0]
/* We migth receive here and array of node Ids. If we dont, we receive at least one node id*/
if (Array.isArray(nodeIdArray) === true) {
for (let j = 0; j < nodeIdArray.length; j++) {
let nodeId = nodeIdArray[j]
let value = arrayItem[1]
applyValue(nodeId, value, docs)
}
} else {
let nodeId = arrayItem[0]
let value = arrayItem[1]
applyValue(nodeId, value, docs)
}
}
} else {
/*
The user is pointing to a particular rate, so we are
going to report only that warning and we will open the docs
to show the warning's page.
*/
let array = currentRecord.warnings
if (array === undefined) { return }
let arrayItem = array[currentRecord.rateIndex]
let docs = arrayItem[2]
let nodeId
let nodeIdArray = arrayItem[0]
/* We migth receive here and array of node Ids. If we dont, we receive at least one node id*/
if (Array.isArray(nodeIdArray) === true) {
for (let j = 0; j < nodeIdArray.length; j++) {
let nodeId = nodeIdArray[j]
let value = arrayItem[1]
applyValue(nodeId, value)
}
/* For repositioning the design space we will pick the first Id at the Node Id Array */
nodeId = nodeIdArray[0]
} else {
let nodeId = arrayItem[0]
nodeId = arrayItem[0]
let value = arrayItem[1]
applyValue(nodeId, value)
applyValue(nodeId, value, docs)
}
if (UI.projects.superalgos.spaces.docsSpace.sidePanelTab.isOpen === true) {
if (
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project !== docs.project ||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category !== docs.category ||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type !== docs.type ||
UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId !== nodeId
) {
UI.projects.superalgos.spaces.docsSpace.navigateTo(
docs.project,
docs.category,
docs.type,
docs.anchor,
nodeId,
docs.placeholder
)
}
} else {
UI.projects.superalgos.spaces.docsSpace.openSpaceAreaAndNavigateTo(
docs.project,
docs.category,
docs.type,
docs.anchor,
nodeId,
docs.placeholder
)
}
}
}
async function applyValue(nodeId, value) {
async function applyValue(nodeId, value, docs) {
if (UI.projects.superalgos.spaces.chartingSpace.visible !== true) { return }
let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(nodeId)
if (node === undefined) { return }
@@ -50,7 +107,7 @@ function newNodesWarnings() {
if (value === '') {
node.payload.uiObject.resetWarningMessage()
} else {
node.payload.uiObject.setWarningMessage(value, 3)
node.payload.uiObject.setWarningMessage(value, 3, docs)
}
}
}