Distance to Parent Implemented
This commit is contained in:
1 parent
15a2d88f02
commit
bf1c81aef3
18 files changed
+197
-39
No files matched your search
@@ -382,11 +382,11 @@ function newTimeMachine () {
|
||||
}
|
||||
|
||||
function physics () {
|
||||
saveFrame(thisObject.payload, thisObject.container.frame)
|
||||
if (thisObject.container.frame.isInViewPort()) {
|
||||
thisObjectPhysics()
|
||||
childrenPhysics()
|
||||
syncWithDesigner()
|
||||
saveFrame(thisObject.payload, thisObject.container.frame)
|
||||
}
|
||||
panelPhysics()
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ function newDashboard () {
|
||||
function setBrowserEvents () {
|
||||
window.onbeforeunload = onBrowserClosed
|
||||
function onBrowserClosed () {
|
||||
canvas.designerSpace.workspace.stopAllRunningTasks()
|
||||
// canvas.designerSpace.workspace.stopAllRunningTasks()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,8 @@ function newNodeCloning () {
|
||||
isPinned: node.payload.floatingObject.isPinned,
|
||||
isFrozen: (node.payload.floatingObject.isFrozen && node.payload.floatingObject.frozenManually),
|
||||
isCollapsed: (node.payload.floatingObject.isCollapsed && node.payload.floatingObject.collapsedManually),
|
||||
tensionLevel: (node.payload.floatingObject.tensionLevel)
|
||||
tensionLevel: (node.payload.floatingObject.tensionLevel),
|
||||
distanceToParent: (node.payload.floatingObject.distanceToParent)
|
||||
},
|
||||
uiObject: {
|
||||
isRunning: node.payload.uiObject.isRunning,
|
||||
|
||||
@@ -148,7 +148,8 @@ function newProtocolNode () {
|
||||
isPinned: node.payload.floatingObject.isPinned,
|
||||
isFrozen: (node.payload.floatingObject.isFrozen && node.payload.floatingObject.frozenManually),
|
||||
isCollapsed: (node.payload.floatingObject.isCollapsed && node.payload.floatingObject.collapsedManually),
|
||||
tensionLevel: (node.payload.floatingObject.tensionLevel)
|
||||
tensionLevel: (node.payload.floatingObject.tensionLevel),
|
||||
distanceToParent: (node.payload.floatingObject.distanceToParent)
|
||||
},
|
||||
uiObject: {
|
||||
isRunning: node.payload.uiObject.isRunning,
|
||||
|
||||
@@ -9,11 +9,15 @@ function newUiObjectsFromNodes () {
|
||||
|
||||
let mapOfReferenceChildren = new Map()
|
||||
let mapOfNodes
|
||||
let tasksToRun
|
||||
let sessionsToRun
|
||||
|
||||
return thisObject
|
||||
|
||||
function recreateWorkspace (node) {
|
||||
function recreateWorkspace (node, replacingCurrentWorkspace) {
|
||||
mapOfNodes = new Map()
|
||||
tasksToRun = []
|
||||
sessionsToRun = []
|
||||
|
||||
/* Create the workspace UI OBject and then continue with the root nodes. */
|
||||
createUiObject(false, 'Workspace', node.name, node, undefined, undefined, 'Workspace')
|
||||
@@ -25,6 +29,33 @@ function newUiObjectsFromNodes () {
|
||||
}
|
||||
|
||||
tryToConnectChildrenWithReferenceParents()
|
||||
|
||||
if (replacingCurrentWorkspace === true) {
|
||||
// We need to wait all tasks that were potentially running to stop
|
||||
setTimeout(runTasks, 70000)
|
||||
// We give a few seconds for the tasks to start
|
||||
setTimeout(runSessions, 80000)
|
||||
} else {
|
||||
runTasks()
|
||||
// We give a few seconds for the tasks to start
|
||||
setTimeout(runSessions, 10000)
|
||||
}
|
||||
}
|
||||
|
||||
function runTasks () {
|
||||
for (let i = 0; i < tasksToRun.length; i++) {
|
||||
let node = tasksToRun[i]
|
||||
node.payload.uiObject.menu.internalClick('Run Task')
|
||||
}
|
||||
tasksToRun = undefined
|
||||
}
|
||||
|
||||
function runSessions () {
|
||||
for (let i = 0; i < sessionsToRun.length; i++) {
|
||||
let node = sessionsToRun[i]
|
||||
node.payload.uiObject.menu.internalClick('Run Session')
|
||||
}
|
||||
sessionsToRun = undefined
|
||||
}
|
||||
|
||||
function tryToConnectChildrenWithReferenceParents () {
|
||||
@@ -362,5 +393,21 @@ function newUiObjectsFromNodes () {
|
||||
canvas.floatingSpace.uiObjectConstructor.createUiObject(userAddingNew, payload)
|
||||
|
||||
mapOfNodes.set(node.id, node)
|
||||
|
||||
/* Check if there are tasks to run */
|
||||
if (userAddingNew === false && uiObjectType === 'Task' && node.savedPayload !== undefined) {
|
||||
if (node.savedPayload.uiObject.isRunning === true) {
|
||||
tasksToRun.push(node)
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if there are sessions to run */
|
||||
if (userAddingNew === false && node.savedPayload !== undefined) {
|
||||
if (uiObjectType === 'Live Trading Session' || uiObjectType === 'Fordward Testing Session' || uiObjectType === 'Backtesting Session' || uiObjectType === 'Paper Trading Session') {
|
||||
if (node.savedPayload.uiObject.isRunning === true) {
|
||||
sessionsToRun.push(node)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ function newWorkspace () {
|
||||
workingAtTask++
|
||||
break
|
||||
case 4:
|
||||
functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode)
|
||||
functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode, true)
|
||||
workingAtTask++
|
||||
break
|
||||
case 5:
|
||||
|
||||
@@ -23,13 +23,13 @@ function newCircularProgressBar () {
|
||||
|
||||
let opacityCounters = []
|
||||
|
||||
let eventSubscriptionHeartbeat
|
||||
let eventSubscriptionIdHeartbeat
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
|
||||
systemEventHandler.stopListening(key, eventSubscriptionHeartbeat)
|
||||
systemEventHandler.stopListening(key, eventSubscriptionIdHeartbeat)
|
||||
|
||||
thisObject.container = undefined
|
||||
thisObject.payload = undefined
|
||||
@@ -52,6 +52,8 @@ function newCircularProgressBar () {
|
||||
}
|
||||
|
||||
function onHeartBeat (message) {
|
||||
if (thisObject.payload === undefined) { return }
|
||||
if (thisObject.payload.uiObject === undefined) { return }
|
||||
opacityCounters[message.event.seconds] = 2000
|
||||
thisObject.payload.uiObject.setValue(message.event.processingDate)
|
||||
}
|
||||
@@ -104,12 +106,12 @@ function newCircularProgressBar () {
|
||||
browserCanvasContext.closePath()
|
||||
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GOLDEN_ORANGE + ', ' + OPACITY * 2 + ')'
|
||||
browserCanvasContext.lineWidth = 6 + opacityCounters[i] / 100
|
||||
browserCanvasContext.lineWidth = 6 + opacityCounters[i] / 100 / 2
|
||||
browserCanvasContext.setLineDash([3, 4])
|
||||
browserCanvasContext.stroke()
|
||||
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK_TURQUOISE + ', ' + OPACITY + ')'
|
||||
browserCanvasContext.lineWidth = 0 + opacityCounters[i] / 100
|
||||
browserCanvasContext.lineWidth = 0 + opacityCounters[i] / 100 / 2
|
||||
browserCanvasContext.setLineDash([3, 4])
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ function newFloatingObject () {
|
||||
targetRadius: 0, // This is the target radius of the floating object with zoom applied. It should be animated until reaching this value.
|
||||
isPinned: false,
|
||||
isFrozen: false,
|
||||
tensionLevel: TENSION_LEVEL.NO_TENSION,
|
||||
tensionLevel: TENSION_LEVEL.LEVEL_90,
|
||||
distanceToParent: DISTANCE_TO_PARENT.SAME,
|
||||
isCollapsed: false,
|
||||
isParentCollapsed: false,
|
||||
frozenManually: false,
|
||||
@@ -30,13 +31,15 @@ function newFloatingObject () {
|
||||
getPinStatus: getPinStatus,
|
||||
getFreezeStatus: getFreezeStatus,
|
||||
getCollapseStatus: getCollapseStatus,
|
||||
getTensionStatus: getTensionStatus,
|
||||
getTensionLevel: getTensionLevel,
|
||||
getDistanceToParent: getDistanceToParent,
|
||||
nearbyFloatingObjects: [],
|
||||
setPosition: setPosition,
|
||||
pinToggle: pinToggle,
|
||||
freezeToggle: freezeToggle,
|
||||
collapseToggle: collapseToggle,
|
||||
tensionToggle: tensionToggle,
|
||||
distanceToParentToggle: distanceToParentToggle,
|
||||
physics: physics,
|
||||
initializeMass: initializeMass,
|
||||
initializeRadius: initializeRadius,
|
||||
@@ -138,10 +141,14 @@ function newFloatingObject () {
|
||||
return thisObject.isCollapsed
|
||||
}
|
||||
|
||||
function getTensionStatus () {
|
||||
function getTensionLevel () {
|
||||
return thisObject.tensionLevel
|
||||
}
|
||||
|
||||
function getDistanceToParent () {
|
||||
return thisObject.distanceToParent
|
||||
}
|
||||
|
||||
function freezeToggle () {
|
||||
if (thisObject.isFrozen !== true) {
|
||||
thisObject.isFrozen = true
|
||||
@@ -186,6 +193,28 @@ function newFloatingObject () {
|
||||
return thisObject.tensionLevel
|
||||
}
|
||||
|
||||
function distanceToParentToggle () {
|
||||
switch (thisObject.distanceToParent) {
|
||||
case DISTANCE_TO_PARENT.NOT_FIXED:
|
||||
thisObject.distanceToParent = DISTANCE_TO_PARENT.QUARTER
|
||||
break
|
||||
case DISTANCE_TO_PARENT.QUARTER:
|
||||
thisObject.distanceToParent = DISTANCE_TO_PARENT.HALF
|
||||
break
|
||||
case DISTANCE_TO_PARENT.HALF:
|
||||
thisObject.distanceToParent = DISTANCE_TO_PARENT.SAME
|
||||
break
|
||||
case DISTANCE_TO_PARENT.SAME:
|
||||
thisObject.distanceToParent = DISTANCE_TO_PARENT.DOUBLE
|
||||
break
|
||||
case DISTANCE_TO_PARENT.DOUBLE:
|
||||
thisObject.distanceToParent = DISTANCE_TO_PARENT.NOT_FIXED
|
||||
break
|
||||
}
|
||||
|
||||
return thisObject.distanceToParent
|
||||
}
|
||||
|
||||
function physics () {
|
||||
collapsePhysics()
|
||||
if (canvas.floatingSpace.isItFar(thisObject.payload)) { return }
|
||||
@@ -229,13 +258,30 @@ function newFloatingObject () {
|
||||
if (parent.payload === undefined) { return }
|
||||
if (parent.payload.position === undefined) { return }
|
||||
|
||||
let distanceToChainParent = Math.sqrt(Math.pow(parent.payload.position.x - thisObject.container.frame.position.x, 2) + Math.pow(parent.payload.position.y - thisObject.container.frame.position.y, 2)) // ... we calculate the distance ...
|
||||
let distanceToParent = Math.sqrt(Math.pow(parent.payload.position.x - thisObject.container.frame.position.x, 2) + Math.pow(parent.payload.position.y - thisObject.container.frame.position.y, 2)) // ... we calculate the distance ...
|
||||
let parentChildren = canvas.designerSpace.workspace.nodeChildren.childrenCount(parent, thisObject.payload.node)
|
||||
let axisCount = parentChildren.childrenCount
|
||||
let axisIndex = parentChildren.childIndex
|
||||
let baseAngle = 0
|
||||
let tensionLevelAngle
|
||||
|
||||
if (parent.payload.distance !== undefined) {
|
||||
switch (thisObject.distanceToParent) {
|
||||
case DISTANCE_TO_PARENT.QUARTER:
|
||||
distanceToParent = parent.payload.distance / 4
|
||||
break
|
||||
case DISTANCE_TO_PARENT.HALF:
|
||||
distanceToParent = parent.payload.distance / 2
|
||||
break
|
||||
case DISTANCE_TO_PARENT.SAME:
|
||||
distanceToParent = parent.payload.distance
|
||||
break
|
||||
case DISTANCE_TO_PARENT.DOUBLE:
|
||||
distanceToParent = parent.payload.distance * 2
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
switch (thisObject.tensionLevel) {
|
||||
case TENSION_LEVEL.LEVEL_360:
|
||||
tensionLevelAngle = 360
|
||||
@@ -277,11 +323,13 @@ function newFloatingObject () {
|
||||
thisObject.payload.angle = thisObject.payload.angle - 360
|
||||
}
|
||||
|
||||
if (distanceToChainParent > 2000) { return } // this is introduced to avoid edges cases when importing workspaces.
|
||||
thisObject.payload.distance = distanceToParent
|
||||
|
||||
if (distanceToParent > 2000) { return } // this is introduced to avoid edges cases when importing workspaces.
|
||||
|
||||
newPosition = {
|
||||
x: parent.payload.position.x + distanceToChainParent * Math.cos(toRadians(thisObject.payload.angle)),
|
||||
y: parent.payload.position.y + distanceToChainParent * Math.sin(toRadians(thisObject.payload.angle))
|
||||
x: parent.payload.position.x + distanceToParent * Math.cos(toRadians(thisObject.payload.angle)),
|
||||
y: parent.payload.position.y + distanceToParent * Math.sin(toRadians(thisObject.payload.angle))
|
||||
}
|
||||
if (isNaN(newPosition.x) === false) {
|
||||
thisObject.container.frame.position.x = newPosition.x
|
||||
|
||||
@@ -94,9 +94,16 @@ function newUiObject () {
|
||||
let currentValue = 0
|
||||
let rightDragging = false
|
||||
|
||||
let eventSubscriptionIdHeartbeat
|
||||
let eventSubscriptionIdOnStopped
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
|
||||
systemEventHandler.stopListening(key, eventSubscriptionIdHeartbeat, 'UiObject')
|
||||
systemEventHandler.stopListening(key, eventSubscriptionIdOnStopped, 'UiObject')
|
||||
|
||||
thisObject.container.eventHandler.stopListening(selfFocusEventSubscriptionId)
|
||||
thisObject.container.eventHandler.stopListening(selfNotFocuskEventSubscriptionId)
|
||||
thisObject.container.eventHandler.stopListening(selfDisplaceEventSubscriptionId)
|
||||
@@ -589,11 +596,19 @@ function newUiObject () {
|
||||
thisObject.circularProgressBar.fitFunction = thisObject.fitFunction
|
||||
thisObject.circularProgressBar.container = thisObject.container
|
||||
|
||||
/* We will wait to the event that the execution was terminated in order to call back the menu item */
|
||||
/* We will wait to hear the first onHeartBeat in order to confirm the execution was really started */
|
||||
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
|
||||
systemEventHandler.listenToEvent(key, 'Running', undefined, key, undefined, onRunning)
|
||||
systemEventHandler.listenToEvent(key, 'Heartbeat', undefined, 'UiObject', onResponse, onHeartBeat)
|
||||
|
||||
function onResponse (message) {
|
||||
eventSubscriptionIdHeartbeat = message.eventSubscriptionId
|
||||
}
|
||||
|
||||
function onHeartBeat () {
|
||||
if (thisObject.payload === undefined) { return }
|
||||
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
|
||||
systemEventHandler.stopListening(key, eventSubscriptionIdHeartbeat, 'UiObject')
|
||||
|
||||
function onRunning () {
|
||||
if (callBackFunction !== undefined) {
|
||||
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE)
|
||||
}
|
||||
@@ -621,9 +636,14 @@ function newUiObject () {
|
||||
function stop (callBackFunction, event) {
|
||||
/* We will wait to the event that the execution was terminated in order to call back the menu item */
|
||||
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
|
||||
systemEventHandler.listenToEvent(key, 'Stopped', undefined, key, undefined, onStopped)
|
||||
systemEventHandler.listenToEvent(key, 'Stopped', undefined, 'UiObject', onResponse, onStopped)
|
||||
|
||||
function onResponse (message) {
|
||||
eventSubscriptionIdOnStopped = message.eventSubscriptionId
|
||||
}
|
||||
|
||||
function onStopped () {
|
||||
if (thisObject.payload === undefined) { return }
|
||||
if (callBackFunction !== undefined) {
|
||||
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, event)
|
||||
}
|
||||
|
||||
@@ -57,12 +57,18 @@ function newUiObjectConstructor () {
|
||||
if (payload.node.savedPayload.floatingObject.isCollapsed === true) {
|
||||
floatingObject.collapseToggle()
|
||||
}
|
||||
floatingObject.tensionLevel = payload.node.savedPayload.floatingObject.tensionLevel
|
||||
if (payload.node.savedPayload.floatingObject.tensionLevel !== undefined) {
|
||||
floatingObject.tensionLevel = payload.node.savedPayload.floatingObject.tensionLevel
|
||||
}
|
||||
if (payload.node.savedPayload.floatingObject.distanceToParent !== undefined) {
|
||||
floatingObject.distanceToParent = payload.node.savedPayload.floatingObject.distanceToParent
|
||||
}
|
||||
}
|
||||
|
||||
/* For brand new objects being created directly by the user, we will make them inherit some properties from their parents. */
|
||||
if (userAddingNew === true) {
|
||||
floatingObject.tensionLevel = payload.parentNode.payload.floatingObject.tensionLevel
|
||||
floatingObject.distanceToParent = payload.parentNode.payload.floatingObject.distanceToParent
|
||||
}
|
||||
|
||||
let uiObject = newUiObject()
|
||||
@@ -136,9 +142,9 @@ function newUiObjectConstructor () {
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Tense / Untense',
|
||||
action: 'Change Tension Level',
|
||||
actionFunction: floatingObject.tensionToggle,
|
||||
actionStatus: floatingObject.getTensionStatus,
|
||||
actionStatus: floatingObject.getTensionLevel,
|
||||
currentStatus: true,
|
||||
label: undefined,
|
||||
visible: true,
|
||||
@@ -149,6 +155,21 @@ function newUiObjectConstructor () {
|
||||
ring: 1
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'change Distance to Paarent',
|
||||
actionFunction: floatingObject.distanceToParentToggle,
|
||||
actionStatus: floatingObject.getDistanceToParent,
|
||||
currentStatus: true,
|
||||
label: undefined,
|
||||
visible: true,
|
||||
icons: ['headphones', 'competition', 'analysis-1', 'stage-open-postion-rate', 'stop'],
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
ring: 1
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Freeze / Unfreeze',
|
||||
|
||||
@@ -59,6 +59,14 @@ const TENSION_LEVEL = {
|
||||
LEVEL_45: 4
|
||||
}
|
||||
|
||||
const DISTANCE_TO_PARENT = {
|
||||
NOT_FIXED: 0,
|
||||
QUARTER: 1,
|
||||
HALF: 2,
|
||||
SAME: 3,
|
||||
DOUBLE: 4
|
||||
}
|
||||
|
||||
/* User Interface Panels */
|
||||
|
||||
UI_PANEL = {
|
||||
|
||||
@@ -3448,7 +3448,7 @@
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"level": 1,
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Strategy->"
|
||||
},
|
||||
@@ -3540,7 +3540,7 @@
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"level": 1,
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Manage Stage->Initial Definition->"
|
||||
},
|
||||
@@ -3627,7 +3627,7 @@
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"level": 1,
|
||||
"chainedToSameType": true,
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Stop->Take Profit->Initial Stop->Initial Take Profit->Phase->"
|
||||
@@ -3719,7 +3719,7 @@
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 3,
|
||||
"level": 1,
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Manage Stage->Initial Definition->"
|
||||
},
|
||||
@@ -3883,7 +3883,7 @@
|
||||
}
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"level": 1,
|
||||
"chainAttachesTo": {
|
||||
"compatibleTypes": "->Strategy->"
|
||||
},
|
||||
|
||||
@@ -199,7 +199,6 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileSt
|
||||
let processingDate = new Date(since)
|
||||
processingDate = processingDate.getUTCFullYear() + '-' + utilities.pad(processingDate.getUTCMonth() + 1, 2) + '-' + utilities.pad(processingDate.getUTCDate(), 2);
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getTrades -> Fetching Trades @ " + processingDate + "-> exchange = " + bot.exchange + " -> symbol = " + symbol + " -> since = " + since + " -> limit = " + limit ) }
|
||||
//console.log("Charly -> " + MODULE_NAME + " -> start -> getTrades -> Fetching Trades from " + bot.exchange + " " + symbol + " @ " + processingDate + " collecting " + allTrades.length + " records trades so far.")
|
||||
bot.processHeartBeat("Fetching " + allTrades.length.toFixed(0) + " trades from " + bot.exchange + " " + symbol + " @ " + processingDate) // tell the world we are alive and doing well
|
||||
|
||||
if (fetchType === "by Id") {
|
||||
@@ -238,6 +237,9 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileSt
|
||||
lastTradeKey = tradeKey
|
||||
}
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> getTrades -> Fetching Trades @ " + processingDate + "-> exchange = " + bot.exchange + " -> symbol = " + symbol + " -> since = " + since + " -> limit = " + limit) }
|
||||
bot.processHeartBeat("Fetching " + allTrades.length.toFixed(0) + " trades from " + bot.exchange + " " + symbol + " @ " + processingDate) // tell the world we are alive and doing well
|
||||
|
||||
} else {
|
||||
break
|
||||
}
|
||||
@@ -288,14 +290,14 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileSt
|
||||
lastId = record[4]
|
||||
}
|
||||
|
||||
let processingDate = new Date(trade.timestamp)
|
||||
processingDate = processingDate.getUTCFullYear() + '-' + utilities.pad(processingDate.getUTCMonth() + 1, 2) + '-' + utilities.pad(processingDate.getUTCDate(), 2);
|
||||
|
||||
/* Reporting we are doing well */
|
||||
heartBeatCounter--
|
||||
if (heartBeatCounter <= 0) {
|
||||
heartBeatCounter = 1000
|
||||
let processingDate = new Date(trade.timestamp)
|
||||
processingDate = processingDate.getUTCFullYear() + '-' + utilities.pad(processingDate.getUTCMonth() + 1, 2) + '-' + utilities.pad(processingDate.getUTCDate(), 2);
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> saveTrades -> Saving Trades @ " + processingDate + " -> i = " + i + " -> total = " + allTrades.length) }
|
||||
//console.log("Charly -> " + MODULE_NAME + " -> start -> saveTrades -> Saving Trades from " + bot.exchange + " " + symbol + " @ " + processingDate)
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> saveTrades -> Saving Trades @ " + processingDate + " -> i = " + i + " -> total = " + allTrades.length) }
|
||||
bot.processHeartBeat("Saving " + i.toFixed(0) + " trades from " + bot.exchange + " " + symbol + " @ " + processingDate) // tell the world we are alive and doing well
|
||||
}
|
||||
|
||||
@@ -330,6 +332,10 @@ exports.newUserBot = function newUserBot(bot, logger, COMMONS, UTILITIES, fileSt
|
||||
createMissingEmptyFiles(currentRecordMinute, currentTimeMinute)
|
||||
}
|
||||
}
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> saveTrades -> Saving Trades @ " + processingDate + " -> i = " + i + " -> total = " + allTrades.length) }
|
||||
bot.processHeartBeat("Saving " + i.toFixed(0) + " trades from " + bot.exchange + " " + symbol + " @ " + processingDate) // tell the world we are alive and doing well
|
||||
|
||||
return
|
||||
}
|
||||
previousRecordMinute = currentRecordMinute
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"type":"Workspace","name":"New Tension Level","rootNodes":[{"type":"Network","name":"Superalgos","networkNodes":[{"type":"Network Node","name":"My Computer","dataStorage":{"type":"Data Storage","name":"New Data Storage","sessionIndependentData":{"type":"Session Independent Data","name":"New Session Independent Data","singleMarketData":[{"type":"Single Market Data","name":"Poloniex BTC/USDT","dataProducts":[{"type":"Data Product","name":"Candles","id":"55e735a5-60c9-4e2d-a582-a6c6eddf3502","savedPayload":{"position":{"x":20411.876309482992,"y":24072.552323772936},"targetPosition":{"x":22132.22295470948,"y":27728.70529460941},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Candles","id":"36ae2d5d-6734-4526-b2f8-31c89a0c4fc1"}}},{"type":"Data Product","name":"Volumes","id":"ffaf5a8e-12d6-4040-922d-57845eb3377c","savedPayload":{"position":{"x":21576.750162194072,"y":24897.940068643937},"targetPosition":{"x":22132.22295470948,"y":27728.70529460941},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Volumes","id":"b2d5ba69-67ac-490f-9e74-28239b35a92e"}}},{"type":"Data Product","name":"Candle-Stairs","id":"e1c46e1f-09d1-46a2-b738-e761b4e04cd9","savedPayload":{"position":{"x":22164.192575141195,"y":25096.697726539976},"targetPosition":{"x":22132.22295470948,"y":27728.70529460941},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Candle-Stairs","id":"642474e9-da61-4168-97dc-7f7869bebc02"}}},{"type":"Data Product","name":"Volume-Stairs","id":"eefaf182-ffe4-457e-a7fa-f43dfabdc086","savedPayload":{"position":{"x":22284.363972425384,"y":25711.81834982707},"targetPosition":{"x":22132.22295470948,"y":27728.70529460941},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Volume-Stairs","id":"846e9572-c4d6-4c7e-942e-c82402c5ecea"}}},{"type":"Data Product","name":"Bollinger Bands","id":"3576cfd0-1774-4094-b8a0-66e182fc4c41","savedPayload":{"position":{"x":22968.55103697409,"y":28375.729219407665},"targetPosition":{"x":22132.22295470948,"y":27728.70529460941},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Bollinger Bands","id":"29088877-8d63-4217-8d34-8742afc262f4"}}},{"type":"Data Product","name":"Percentage Bandwidth","id":"4dfde44c-0bbf-4204-91de-ce99ecba4cf2","savedPayload":{"position":{"x":22350.09846955143,"y":28730.262872271254},"targetPosition":{"x":22132.22295470948,"y":27728.70529460941},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Percentage Bandwidth","id":"3b7885a0-cd72-4a3f-a38b-3dc8c47bd068"}}},{"type":"Data Product","name":"Bollinger Channels Objects","id":"6986bcb1-119c-48c9-a00b-d046e9e07951","savedPayload":{"position":{"x":19144.214049771195,"y":27912.629819702946},"targetPosition":{"x":22132.22295470948,"y":27728.70529460941},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Bollinger Channels Objects","id":"1f111f72-624f-4166-9f99-ab8d785d5267"}}},{"type":"Data Product","name":"Bollinger Sub-Channels Objects","id":"85098ab8-a125-49f1-b24d-416c2090c7a0","savedPayload":{"position":{"x":18615.447470194533,"y":27165.9917332436},"targetPosition":{"x":22132.22295470948,"y":27728.70529460941},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Bollinger Sub-Channels Objects","id":"080c87fc-4546-4482-ab11-180a33f6d9ab"}}}],"id":"49a747b4-2eb7-41d6-b0e2-493f43ceed44","savedPayload":{"position":{"x":22132.22295470948,"y":27728.70529460941},"targetPosition":{"x":20178.49770620469,"y":27037.544811321794},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Market","name":"BTC/USDT","id":"d4098b73-7e25-434e-8fd9-342393cbb400"}}},{"type":"Single Market Data","name":"Kraken ETH/BTC","dataProducts":[{"type":"Data Product","name":"Candles","id":"fce50098-d674-4006-94ad-cce46f3d59a4","savedPayload":{"position":{"x":22188.207505020688,"y":27958.48275803743},"targetPosition":{"x":20614.630309702367,"y":27883.52403758208},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Candles","id":"36ae2d5d-6734-4526-b2f8-31c89a0c4fc1"}}},{"type":"Data Product","name":"Volumes","id":"601b3615-7045-4e8f-Line truncated
|
||||
{"type":"Workspace","name":"After Distance To Parent","rootNodes":[{"type":"Network","name":"Superalgos","networkNodes":[{"type":"Network Node","name":"My Computer","dataStorage":{"type":"Data Storage","name":"New Data Storage","sessionIndependentData":{"type":"Session Independent Data","name":"New Session Independent Data","singleMarketData":[{"type":"Single Market Data","name":"Poloniex BTC/USDT","dataProducts":[{"type":"Data Product","name":"Candles","id":"55e735a5-60c9-4e2d-a582-a6c6eddf3502","savedPayload":{"position":{"x":20976.068798244127,"y":29155.79461371483},"targetPosition":{"x":21374.211338469173,"y":29786.258061361692},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1,"distanceToParent":3},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Candles","id":"36ae2d5d-6734-4526-b2f8-31c89a0c4fc1"}}},{"type":"Data Product","name":"Volumes","id":"ffaf5a8e-12d6-4040-922d-57845eb3377c","savedPayload":{"position":{"x":21474.470550468162,"y":29047.373948956396},"targetPosition":{"x":21374.211338469173,"y":29786.258061361692},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1,"distanceToParent":3},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Volumes","id":"b2d5ba69-67ac-490f-9e74-28239b35a92e"}}},{"type":"Data Product","name":"Candle-Stairs","id":"e1c46e1f-09d1-46a2-b738-e761b4e04cd9","savedPayload":{"position":{"x":21925.959903140847,"y":29284.6853721746},"targetPosition":{"x":21374.211338469173,"y":29786.258061361692},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1,"distanceToParent":3},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Candle-Stairs","id":"642474e9-da61-4168-97dc-7f7869bebc02"}}},{"type":"Data Product","name":"Volume-Stairs","id":"eefaf182-ffe4-457e-a7fa-f43dfabdc086","savedPayload":{"position":{"x":22119.2799704014,"y":29756.688231022967},"targetPosition":{"x":21374.211338469173,"y":29786.258061361692},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1,"distanceToParent":3},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Volume-Stairs","id":"846e9572-c4d6-4c7e-942e-c82402c5ecea"}}},{"type":"Data Product","name":"Bollinger Bands","id":"3576cfd0-1774-4094-b8a0-66e182fc4c41","savedPayload":{"position":{"x":21963.974144265383,"y":30242.527142118877},"targetPosition":{"x":21374.211338469173,"y":29786.258061361692},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1,"distanceToParent":3},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Bollinger Bands","id":"29088877-8d63-4217-8d34-8742afc262f4"}}},{"type":"Data Product","name":"Percentage Bandwidth","id":"4dfde44c-0bbf-4204-91de-ce99ecba4cf2","savedPayload":{"position":{"x":21532.71174681383,"y":30514.872679462507},"targetPosition":{"x":21374.211338469173,"y":29786.258061361692},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1,"distanceToParent":3},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Percentage Bandwidth","id":"3b7885a0-cd72-4a3f-a38b-3dc8c47bd068"}}},{"type":"Data Product","name":"Bollinger Channels Objects","id":"6986bcb1-119c-48c9-a00b-d046e9e07951","savedPayload":{"position":{"x":21027.285246761992,"y":30446.29133934728},"targetPosition":{"x":21374.211338469173,"y":29786.258061361692},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1,"distanceToParent":3},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Bollinger Channels Objects","id":"1f111f72-624f-4166-9f99-ab8d785d5267"}}},{"type":"Data Product","name":"Bollinger Sub-Channels Objects","id":"85098ab8-a125-49f1-b24d-416c2090c7a0","savedPayload":{"position":{"x":20684.189320673973,"y":30068.873093009806},"targetPosition":{"x":21374.211338469173,"y":29786.258061361692},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1,"distanceToParent":3},"uiObject":{},"referenceParent":{"type":"Product Definition","name":"Bollinger Sub-Channels Objects","id":"080c87fc-4546-4482-ab11-180a33f6d9ab"}}}],"id":"49a747b4-2eb7-41d6-b0e2-493f43ceed44","savedPayload":{"position":{"x":21374.211338469173,"y":29786.258061361692},"targetPosition":{"x":20663.96236545284,"y":29559.216132447964},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":true,"tensionLevel":1,"distanceToParent":3},"uiObject":{},"referenceParent":{"type":"Market","name":"BTC/USDT","id":"d4098b73-7e25-434e-8fd9-342393cbb400"}}},{"type":"Single Market Data","name":"Kraken ETH/BTC","dataProducts":[{"type":"Data Product","name":"Candles","id":"fce50098-d674-4006-94ad-cce46f3d59a4","savedPayload":{"position":{"x":21750.45194442635,"y":30257.460586954287},"targetPosition":{"x":21005.6413430549,"y":30221.980885147164},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":trLine truncated
|
||||
@@ -49,6 +49,10 @@ function runTask(message) {
|
||||
return
|
||||
}
|
||||
|
||||
if (tasks.get(message.event.taskId) !== undefined) {
|
||||
//console.log('[WARN] Task Manager -> server -> runTask -> Task Already Running -> taskId = ' + message.event.taskId)
|
||||
return
|
||||
}
|
||||
//console.log('[INFO] Task Manager -> server -> runTask -> Task Name = ' + message.event.taskName)
|
||||
//console.log('[INFO] Task Manager -> server -> runTask -> Task Id = ' + message.event.taskId)
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
return
|
||||
|
||||
function runSession(message) {
|
||||
if (bot.SESSION_STATUS === 'Idle' || bot.SESSION_STATUS === 'Running') { return } // This happens when the UI is reloaded, the session was running and tries to run it again.
|
||||
|
||||
/* We are going to run the Definition comming at the event. */
|
||||
bot.TRADING_SYSTEM = JSON.parse(message.event.tradingSystem)
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
|
||||
processExecutionEvents = PROCESS_EXECUTION_EVENTS.newProcessExecutionEvents(bot, logger)
|
||||
|
||||
processExecutionEvents.initialize(undefined, undefined, onInizialized);
|
||||
processExecutionEvents.initialize(onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
|
||||
@@ -356,7 +356,7 @@
|
||||
|
||||
statusDependencies = STATUS_DEPENDENCIES.newStatusDependencies(bot, logger, STATUS_REPORT, UTILITIES);
|
||||
|
||||
statusDependencies.initialize(undefined, undefined, onInizialized);
|
||||
statusDependencies.initialize(onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
|
||||
|
||||
@@ -40,9 +40,8 @@ process.on('unhandledRejection', (reason, p) => {
|
||||
})
|
||||
|
||||
process.on('exit', function (code) {
|
||||
|
||||
|
||||
/* We send an event signaling that the Task is being terminated. */
|
||||
|
||||
let key = global.TASK_NODE.name + '-' + global.TASK_NODE.type + '-' + global.TASK_NODE.id
|
||||
|
||||
global.SYSTEM_EVENT_HANDLER.raiseEvent(key, 'Stopped') // Meaning Task Stopped
|
||||
|
||||
Reference in new issue
Block a user