Warnings Improved
This commit is contained in:
1 parent
31dd974a6d
commit
6a0bc7b6c2
5 files changed
+49
-27
No files matched your search
@@ -8,16 +8,15 @@ function newNodesErrors() {
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
let hiriarchyMap
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize() {
|
||||
hiriarchyMap = undefined
|
||||
|
||||
}
|
||||
|
||||
function initialize(pRootNode) {
|
||||
let rootNode = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
|
||||
hiriarchyMap = UI.projects.superalgos.utilities.hierarchy.getHiriarchyMap(rootNode)
|
||||
|
||||
}
|
||||
|
||||
function onRecordChange(currentRecord) {
|
||||
@@ -32,16 +31,16 @@ function newNodesErrors() {
|
||||
}
|
||||
}
|
||||
|
||||
function applyValue(nodeId, value) {
|
||||
async function applyValue(nodeId, value) {
|
||||
if (UI.projects.superalgos.spaces.chartingSpace.visible !== true) { return }
|
||||
let node = hiriarchyMap.get(nodeId)
|
||||
let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(nodeId)
|
||||
if (node === undefined) { return }
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
if (value === '') {
|
||||
node.payload.uiObject.resetErrorMessage()
|
||||
} else {
|
||||
node.payload.uiObject.setErrorMessage(value, 10)
|
||||
node.payload.uiObject.setErrorMessage(value, 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,15 @@ function newNodesInfos() {
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
let hiriarchyMap
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize() {
|
||||
hiriarchyMap = undefined
|
||||
|
||||
}
|
||||
|
||||
function initialize(pRootNode) {
|
||||
let rootNode = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
|
||||
hiriarchyMap = UI.projects.superalgos.utilities.hierarchy.getHiriarchyMap(rootNode)
|
||||
|
||||
}
|
||||
|
||||
function onRecordChange(currentRecord) {
|
||||
@@ -32,16 +31,16 @@ function newNodesInfos() {
|
||||
}
|
||||
}
|
||||
|
||||
function applyValue(nodeId, value) {
|
||||
async function applyValue(nodeId, value) {
|
||||
if (UI.projects.superalgos.spaces.chartingSpace.visible !== true) { return }
|
||||
let node = hiriarchyMap.get(nodeId)
|
||||
let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(nodeId)
|
||||
if (node === undefined) { return }
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
if (value === '') {
|
||||
node.payload.uiObject.resetInfoMessage()
|
||||
} else {
|
||||
node.payload.uiObject.setInfoMessage(value, 10)
|
||||
node.payload.uiObject.setInfoMessage(value, 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,15 @@ function newNodesWarnings() {
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
let hiriarchyMap
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize() {
|
||||
hiriarchyMap = undefined
|
||||
|
||||
}
|
||||
|
||||
function initialize(pRootNode) {
|
||||
let rootNode = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
|
||||
hiriarchyMap = UI.projects.superalgos.utilities.hierarchy.getHiriarchyMap(rootNode)
|
||||
function initialize() {
|
||||
|
||||
}
|
||||
|
||||
function onRecordChange(currentRecord) {
|
||||
@@ -32,16 +31,16 @@ function newNodesWarnings() {
|
||||
}
|
||||
}
|
||||
|
||||
function applyValue(nodeId, value) {
|
||||
async function applyValue(nodeId, value) {
|
||||
if (UI.projects.superalgos.spaces.chartingSpace.visible !== true) { return }
|
||||
let node = hiriarchyMap.get(nodeId)
|
||||
let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(nodeId)
|
||||
if (node === undefined) { return }
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
if (value === '') {
|
||||
node.payload.uiObject.resetWarningMessage()
|
||||
} else {
|
||||
node.payload.uiObject.setWarningMessage(value, 10)
|
||||
node.payload.uiObject.setWarningMessage(value, 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2095,7 +2095,7 @@ function newUiObject() {
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK_TURQUOISE + ', ' + OPACITY + ')'
|
||||
browserCanvasContext.lineWidth = 5
|
||||
browserCanvasContext.setLineDash([0 + infoRingAnimation, 10 - infoRingAnimation])
|
||||
browserCanvasContext.setLineDash([2 + infoRingAnimation, 14 - infoRingAnimation])
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
@@ -2111,7 +2111,7 @@ function newUiObject() {
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')'
|
||||
browserCanvasContext.lineWidth = 5
|
||||
browserCanvasContext.setLineDash([0 + warningRingAnimation, 10 - warningRingAnimation])
|
||||
browserCanvasContext.setLineDash([2 + warningRingAnimation, 14 - warningRingAnimation])
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
@@ -2127,7 +2127,7 @@ function newUiObject() {
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', ' + OPACITY + ')'
|
||||
browserCanvasContext.lineWidth = 5
|
||||
browserCanvasContext.setLineDash([0 + errorRingAnimation, 10 - errorRingAnimation])
|
||||
browserCanvasContext.setLineDash([2 + errorRingAnimation, 14 - errorRingAnimation])
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,26 @@ exports.newOrdersSimulations = function newOrdersSimulations(bot, logger) {
|
||||
switch (tradingSystemOrder.type) {
|
||||
case 'Market Sell Order': {
|
||||
tradingEngineOrder.orderStatistics.actualRate.value = tradingEngineOrder.rate.value - slippageAmount
|
||||
tradingEngineOrder.orderStatistics.actualRate.value = global.PRECISE(tradingEngineOrder.orderStatistics.actualRate.value, 10)
|
||||
|
||||
tradingSystem.warnings.push(
|
||||
[
|
||||
sessionParameters.slippage.id,
|
||||
'Slippage (' + slippageAmount + ') substracted from Order Rate (' + tradingEngineOrder.rate.value + ') to get the Actual Rate (' +tradingEngineOrder.orderStatistics.actualRate.value + ')'
|
||||
]
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Market Buy Order': {
|
||||
tradingEngineOrder.orderStatistics.actualRate.value = tradingEngineOrder.rate.value + slippageAmount
|
||||
tradingEngineOrder.orderStatistics.actualRate.value = global.PRECISE(tradingEngineOrder.orderStatistics.actualRate.value, 10)
|
||||
|
||||
tradingSystem.warnings.push(
|
||||
[
|
||||
sessionParameters.slippage.id,
|
||||
'Slippage (' + slippageAmount + ') added to Order Rate (' + tradingEngineOrder.rate.value + ') to get the Actual Rate (' +tradingEngineOrder.orderStatistics.actualRate.value + ')'
|
||||
]
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -101,7 +117,16 @@ exports.newOrdersSimulations = function newOrdersSimulations(bot, logger) {
|
||||
if (tradingSystemOrder.simulatedExchangeEvents.simulatedActualRate.formula !== undefined) {
|
||||
/* Calculate this only once for this order */
|
||||
if (tradingEngineOrder.orderStatistics.actualRate.value === tradingEngineOrder.orderStatistics.actualRate.config.initialValue) {
|
||||
tradingEngineOrder.orderStatistics.actualRate.value = tradingSystem.formulas.get(tradingSystemOrder.simulatedExchangeEvents.simulatedActualRate.formula.id)
|
||||
let newValue = tradingSystem.formulas.get(tradingSystemOrder.simulatedExchangeEvents.simulatedActualRate.formula.id)
|
||||
newValue = global.PRECISE(newValue, 10)
|
||||
|
||||
tradingSystem.warnings.push(
|
||||
[
|
||||
tradingSystemOrder.simulatedExchangeEvents.simulatedActualRate.formula.id,
|
||||
'Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') replaced by this Formula value (' + newValue + ')'
|
||||
]
|
||||
)
|
||||
tradingEngineOrder.orderStatistics.actualRate.value = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +151,7 @@ exports.newOrdersSimulations = function newOrdersSimulations(bot, logger) {
|
||||
tradingSystem.warnings.push(
|
||||
[
|
||||
tradingSystemOrder.id,
|
||||
'Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') too hight. Changed to candle.max (' + tradingEngine.current.episode.candle.max.value + ')'
|
||||
'Actual Rate (' + tradingEngineOrder.orderStatistics.actualRate.value + ') too high. Changed to candle.max (' + tradingEngine.current.episode.candle.max.value + ')'
|
||||
]
|
||||
)
|
||||
tradingEngineOrder.orderStatistics.actualRate.value = tradingEngine.current.episode.candle.max.value
|
||||
|
||||
Reference in new issue
Block a user