Charting Details Fixed

This commit is contained in:
Luis Fernando Molina committed 2020-10-10 12:37:04 +02:00
1 parent d5cd77e655
commit f6321a1abc
17 files changed
+116 -63

No files matched your search

+6 -6
View File
@@ -8321,7 +8321,7 @@
"Use Reference Parent"
],
"addLeftIcons": true,
"level": 5,
"level": 4,
"chainAttachesTo": {
"compatibleTypes": "->Task->"
},
@@ -9617,7 +9617,7 @@
}
],
"addLeftIcons": true,
"level": 5,
"level": 4,
"chainAttachesTo": {
"compatibleTypes": "->Calculations Procedure->Data Building Procedure->"
},
@@ -9661,7 +9661,7 @@
}
],
"addLeftIcons": true,
"level": 5,
"level": 4,
"chainAttachesTo": {
"compatibleTypes": "->Product Definition->"
},
@@ -10584,7 +10584,7 @@
}
],
"addLeftIcons": true,
"level": 5,
"level": 4,
"chainAttachesTo": {
"compatibleTypes": "->Initial Targets->"
},
@@ -10620,7 +10620,7 @@
}
],
"addLeftIcons": true,
"level": 5,
"level": 4,
"chainAttachesTo": {
"compatibleTypes": "->Limit Buy Order->Limit Sell Order->"
},
@@ -10654,7 +10654,7 @@
}
],
"addLeftIcons": true,
"level": 5,
"level": 4,
"chainAttachesTo": {
"compatibleTypes": "->Open Stage->"
},
+1 -3
View File
@@ -763,9 +763,7 @@ function newCanvas() {
return
} else {
if (container.isClickeable === false) {
if (event.buttons === 2) {
viewPortBeingDragged = true
}
viewPortBeingDragged = true
}
return
}
+11 -7
View File
@@ -94,7 +94,7 @@ function newCoordinateSystem() {
thisObject.eventHandler = undefined
}
function initialize(minValue, maxValue, pMaxWidth, pMaxHeight) {
function initialize(minValue, maxValue, maxWidth, maxHeight) {
/* Defines the min and max value of rate that we are going to transport to the available screen at the center position. */
thisObject.min.x = minValue.x
thisObject.max.x = maxValue.x
@@ -102,8 +102,8 @@ function newCoordinateSystem() {
thisObject.min.y = minValue.y
thisObject.max.y = maxValue.y
thisObject.maxWidth = pMaxWidth
thisObject.maxHeight = pMaxHeight
thisObject.maxWidth = maxWidth
thisObject.maxHeight = maxHeight
recalculateScale()
}
@@ -122,14 +122,18 @@ function newCoordinateSystem() {
}
function reportYValue(value) {
/* We will try to create a margin on the y axis so that in auto mode the charts dont get into the scales */
const TOP_MARGIN_FACTOR = 1.01
const BOTTOM_MARGIN_FACTOR = 0.99
if (thisObject.autoMinYScale === true) {
if (value < newYMin) {
newYMin = value
if (value * BOTTOM_MARGIN_FACTOR < newYMin) {
newYMin = value * BOTTOM_MARGIN_FACTOR
}
}
if (thisObject.autoMaxYScale === true) {
if (value > newYMax) {
newYMax = value
if (value * TOP_MARGIN_FACTOR> newYMax) {
newYMax = value * TOP_MARGIN_FACTOR
}
}
}
+5 -5
View File
@@ -165,9 +165,9 @@ function newTimeMachine() {
let timeMachineIndex = findChildIndexAtParentNode(thisObject.payload.node)
let dashboardIndex = findChildIndexAtParentNode(thisObject.payload.parentNode)
thisObject.container.frame.position.x = thisObject.container.frame.width * timeMachineIndex * 2
thisObject.container.frame.position.y = thisObject.container.frame.height * dashboardIndex * 2
}
thisObject.container.frame.position.x = thisObject.container.frame.width * timeMachineIndex * 2
thisObject.container.frame.position.y = thisObject.container.frame.height * dashboardIndex * 2
}
}
function onKeyPressed(event) {
@@ -684,7 +684,7 @@ function newTimeMachine() {
for (let i = 0; i < thisObject.timelineCharts.length; i++) {
let timelinechart = thisObject.timelineCharts[i]
if (timelinechart.layersManager !== undefined) {
let layers = timelinechart.layersManager.layers
let layers = timelinechart.layersManager.layers
for (let j = 0; j < layers.length; j++) {
let layer = layers[j]
@@ -829,7 +829,7 @@ function newTimeMachine() {
minValue,
maxValue,
thisObject.container.frame.width,
thisObject.container.frame.height
thisObject.container.frame.height
)
}
}
+1 -1
View File
@@ -167,7 +167,7 @@ function newTimelineChart() {
minValue,
maxValue,
thisObject.container.frame.width,
thisObject.container.frame.height
thisObject.container.frame.heigh
)
}
+7 -5
View File
@@ -7,9 +7,10 @@ function newViewport() {
let ANIMATION_INCREMENT = 0.25
let ANIMATION_STEPS = 5
let MARGIN_AMOUNT = 40
let TOP_MARGIN = 40 + TOP_SPACE_HEIGHT
let BOTTOM_MARGIN = 10 + 2 + COCKPIT_SPACE_HEIGHT
let TOP_MARGIN = TOP_SPACE_HEIGHT
let BOTTOM_MARGIN = COCKPIT_SPACE_HEIGHT + MARGIN_AMOUNT
let LEFT_MARGIN = 0
let RIGHT_MARGIN = 0
let MARGINS = {
@@ -28,6 +29,7 @@ function newViewport() {
zoomTargetLevel: undefined,
zoomLevel: undefined,
mousePosition: undefined,
marginAmount: MARGIN_AMOUNT,
margins: MARGINS,
payload: undefined,
zoomAtCenter: zoomAtCenter,
@@ -47,7 +49,7 @@ function newViewport() {
initialize: initialize,
finalize: finalize
}
let position = {
x: 0,
y: 0
@@ -98,8 +100,8 @@ function newViewport() {
}
function resize() {
TOP_MARGIN = 40 + TOP_SPACE_HEIGHT
BOTTOM_MARGIN = 10 + 2 + browserCanvas.height - COCKPIT_SPACE_POSITION
TOP_MARGIN = TOP_SPACE_HEIGHT + MARGIN_AMOUNT
BOTTOM_MARGIN = browserCanvas.height - COCKPIT_SPACE_POSITION + MARGIN_AMOUNT
LEFT_MARGIN = 0
RIGHT_MARGIN = 0
MARGINS = {
+1 -1
View File
@@ -192,7 +192,7 @@ const MIN_PLOTABLE_DATE = new Date(2015, 0, 1, 0, 0, 0);
const MAX_PLOTABLE_DATE = maxDate;
const TOP_SPACE_HEIGHT = 40
const COCKPIT_SPACE_HEIGHT = 30;
const COCKPIT_SPACE_HEIGHT = 40;
const SIDE_PANEL_WIDTH = 350
let COCKPIT_SPACE_POSITION = browserCanvas.height - COCKPIT_SPACE_HEIGHT
+2 -1
View File
@@ -735,7 +735,6 @@ function newPlotter() {
/* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */
dataPoint = canvas.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
/*
Contributing to Auto-Scale: A point will contribute to the y coordinate only if the x coordinate is plotted in the screen.
It can happen that objects that span through a long period of time could have its begin point inside the visible
@@ -815,6 +814,7 @@ function newPlotter() {
}
dataPoint = canvas.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
imagePosition.x = dataPoint.x
imagePosition.y = dataPoint.y
let imageToDraw = canvas.designSpace.iconCollection.get(imageName)
@@ -858,6 +858,7 @@ function newPlotter() {
}
dataPoint = canvas.chartingSpace.viewport.fitIntoVisibleArea(dataPoint)
dataPoint = thisObject.fitFunction(dataPoint)
textPosition.x = dataPoint.x
textPosition.y = dataPoint.y
+8 -2
View File
@@ -15,7 +15,7 @@ function newSidePanelTab() {
}
const TAB_WIDTH = 25
const TAB_HEIGHT = 60
const TAB_HEIGHT = TOP_SPACE_HEIGHT * 2
const ANIMATION_STEP = 100
let isInitialized = false
@@ -67,7 +67,6 @@ function newSidePanelTab() {
}
}
thisObject.container.frame.position.y = 69 + 69 * thisObject.index
ORIGINAL_PARENT_POSITON = thisObject.container.parentContainer.frame.position.x
setClosed()
}
@@ -118,9 +117,16 @@ function newSidePanelTab() {
function physics() {
if (isInitialized === false) { return }
positionPhysics()
animate()
}
function positionPhysics() {
if (canvas.chartingSpace.viewport !== undefined) {
thisObject.container.frame.position.y = browserCanvas.height / 2 - TAB_HEIGHT / 2 // TOP_SPACE_HEIGHT + canvas.chartingSpace.viewport.marginAmount + TAB_HEIGHT * thisObject.index
}
}
function draw() {
if (isInitialized === false) { return }
borders()
@@ -6,13 +6,12 @@ function transformThisPoint(point, container) {
/* We pass this point through the canvas.chartingSpace.viewport lends, meaning we apply the canvas.chartingSpace.viewport zoom and displacement. */
point = canvas.chartingSpace.viewport.transformThisPoint(point)
return point
}
function unTransformThisPoint(point, container) {
point = canvas.chartingSpace.viewport.unTransformThisPoint(point)
point = container.frame.unframeThisPoint(point)
return point
}
@@ -572,7 +572,6 @@
bandPoint5 = thisObject.fitFunction(bandPoint5);
bandPoint6 = thisObject.fitFunction(bandPoint6);
/* First we are drawing a semi-transparent background */
browserCanvasContext.beginPath();
@@ -592,9 +591,9 @@
}
if (
bandPoint1.x < canvas.chartingSpace.viewport.visibleArea.topLeft.x + 50
bandPoint1.x < canvas.chartingSpace.viewport.visibleArea.topLeft.x + 150
||
bandPoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x - 50
bandPoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x - 150
) {
// we leave this bands without fill.
} else {
@@ -445,9 +445,8 @@
if (
(candle.begin >= leftDate.valueOf() && candle.end <= rightDate.valueOf()) &&
(candle.begin >= coordinateSystem.min.x && candle.end <= coordinateSystem.max.x)
)
{
(candle.begin >= coordinateSystem.min.x && candle.end <= coordinateSystem.max.x)
) {
candles.push(candle);
@@ -479,6 +478,10 @@
if (candles.length > 0) {
/* On screen candles */
let onScreenCandles = []
let mouseCandle
/* Now we calculate all the points. */
for (let i = 0; i < candles.length; i++) {
@@ -514,6 +517,15 @@
candle.candlePoint3 = transformThisPoint(candle.candlePoint3, thisObject.container);
candle.candlePoint4 = transformThisPoint(candle.candlePoint4, thisObject.container);
/* Skip the first candle with zero at open */
if (candle.open === 0) { continue }
if (candle.candlePoint2.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) {
continue
}
addToOnScreenCandles(candle)
candle.stickPoint1 = {
x: candle.begin + timeFrame / 7 * 3.2,
y: candle.max
@@ -591,23 +603,11 @@
candle.stickPoint2 = thisObject.fitFunction(candle.stickPoint2);
candle.stickPoint3 = thisObject.fitFunction(candle.stickPoint3);
candle.stickPoint4 = thisObject.fitFunction(candle.stickPoint4);
}
/* On screen candles */
let onScreenCandles = []
let mouseCandle
for (let i = 0; i < candles.length; i++) {
candle = candles[i];
/* Skip the first candle with zero at open */
if (candle.open === 0) { continue }
if (candle.candlePoint2.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) {
continue
}
function addToOnScreenCandles(candle) {
/* Contributing to Auto-Scale*/
coordinateSystem.reportYValue(candle.max)
@@ -615,7 +615,7 @@
//if (onScreenCandles.length < 15000) {
onScreenCandles.push(candle)
onScreenCandles.push(candle)
//}
if (userPositionDate >= candle.begin && userPositionDate <= candle.end) {
@@ -641,7 +641,7 @@
if (lowResolution === false) {
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)';
browserCanvasContext.fill();
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)';
browserCanvasContext.lineWidth = 1;
browserCanvasContext.setLineDash([0, 0])
@@ -697,7 +697,7 @@
elementsPlotted++
}
browserCanvasContext.closePath();
if (lowResolution === false) {
@@ -716,7 +716,7 @@
browserCanvasContext.lineWidth = 1;
browserCanvasContext.setLineDash([0, 0])
browserCanvasContext.stroke();
}
/* Draw mouse candel and Raise Event. */
@@ -128,7 +128,7 @@
/* Get ready for plotting. */
recalculate();
dimmensionsChangedEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () {
recalculate();
})
@@ -567,7 +567,6 @@
volumePointB2 = transformThisPoint(volumePointB2, thisObject.container);
volumePointB3 = transformThisPoint(volumePointB3, thisObject.container);
volumePointB4 = transformThisPoint(volumePointB4, thisObject.container);
}
calculateSells(coordinateSystem, thisObject.container.frame.height); // We try to see if it fits in the visible area.
@@ -661,7 +660,7 @@
browserCanvasContext.lineWidth = 1;
browserCanvasContext.setLineDash([0, 0])
browserCanvasContext.stroke();
browserCanvasContext.beginPath();
browserCanvasContext.moveTo(volumePointB1.x, volumePointB1.y);
@@ -686,7 +685,7 @@
browserCanvasContext.lineWidth = 1;
browserCanvasContext.setLineDash([0, 0])
browserCanvasContext.stroke();
if (userPositionDate >= volume.begin && userPositionDate <= volume.end) {
let buyInfo = {
-1
View File
@@ -1 +0,0 @@
{"type":"Data Mine","name":"Masters","config":"{\n\"codeName\": \"Masters\"\n}","sensorBots":[{"type":"Sensor Bot","name":"Exchange Raw Data","config":"{\n\"codeName\": \"Exchange-Raw-Data\",\n\"repo\": \"Exchange-Raw-Data-Sensor-Bot\"\n}","processes":[{"type":"Process Definition","name":"Historic-OHLCVs","config":"{\n \"codeName\": \"Historic-OHLCVs\",\n \"description\": \"Retrieves and saves historical maket data\",\n \"startMode\": {\n \"noTime\": {\n \"run\": \"true\"\n },\n \"fixedInterval\": {\n \"run\": \"false\",\n \"interval\": 0\n }\n },\n \"deadWaitTime\": 0,\n \"normalWaitTime\": 60000,\n \"retryWaitTime\": 10000\n}","processOutput":{"type":"Process Output","name":"New Process Output","outputDatasets":[],"outputDatasetFolders":[],"id":"dfe2556e-a765-4e38-9d30-7f91090c0069","savedPayload":{"position":{"x":19694.65896528582,"y":18079.80666168302},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"processDependencies":{"type":"Process Dependencies","name":"New Process Dependencies","statusDependencies":[{"type":"Status Dependency","name":"Exchange Raw Data Historic-OHLCVs","config":"{\n \"mainUtility\": \"Self Reference\"\n}","id":"ea39c98b-18e2-44ce-9f7f-86a8a76a688a","savedPayload":{"position":{"x":20111.534021268813,"y":17814.56375630177},"targetPosition":{"x":19893.316491438505,"y":18150.31980838774},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":1,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Status Report","name":"New Status Report","id":"181c7c34-7243-497a-9ddb-1b0067c6d66e"}}}],"dataDependencies":[],"dataMineDataDependencies":[],"id":"5c7fae5a-6da6-4864-a167-f2f21d578c72","savedPayload":{"position":{"x":19893.316491438505,"y":18150.31980838774},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"statusReport":{"type":"Status Report","name":"New Status Report","id":"181c7c34-7243-497a-9ddb-1b0067c6d66e","savedPayload":{"position":{"x":20031.71582860312,"y":18304.406526432995},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionStartedEvent":{"type":"Execution Started Event","name":"","id":"957e7e3a-b167-40be-93b5-9ba4ceff56e5","savedPayload":{"position":{"x":20075.30856507894,"y":18506.680081128765},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionFinishedEvent":{"type":"Execution Finished Event","name":"New Execution Finished Event","id":"fe40a546-43ee-49df-908a-7e72f598f0cd","savedPayload":{"position":{"x":20019.51506449239,"y":18694.64493952324},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc","savedPayload":{"position":{"x":19674.617425695335,"y":18486.33639924593},"targetPosition":{"x":19278.707614323983,"y":18688.55263969416},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}}],"products":[{"type":"Product Definition","name":"Trades","config":"{\n\"codeName\": \"Trades\"\n}","datasets":[{"type":"Dataset Definition","name":"Trades","config":"{\n\"codeName\": \"Trades\"\n}","id":"fbb7c17e-a909-4fa2-b3c5-eb8ca86297c4","savedPayload":{"position":{"x":19939.732540593195,"y":18584.456194349146},"targetPosition":{"x":19741.31504137297,"y":18616.06022300575},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":1,"distanceToParent":2,"arrangementStyle":0},"uiObject":{}}}],"id":"38dbb942-a15b-450b-a867-02a94030965f","savedPayload":{"position":{"x":19741.31504137297,"y":18616.06022300575},"targetPosition":{"x":19278.707614323983,"y":18688.55263969416},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Product Definition","name":"Candles","config":"{\n\"codeName\": \"Candles\"\n}","datasets":[{"type":"Dataset Definition","name":"One-Min","config":"{\n\"codeName\": \"One-Min\"\n}","id":"1c3696e4-c28e-4744-9100-706d6dce0c3c","savedPayload":{"position":{"x":19935.702085675992,Line truncated
+1 -1
View File
@@ -1 +1 @@
{"type":"Data Mine","name":"Masters","config":"{\n\"codeName\": \"Masters\"\n}","sensorBots":[{"type":"Sensor Bot","name":"Exchange Raw Data","config":"{\n\"codeName\": \"Exchange-Raw-Data\",\n\"repo\": \"Exchange-Raw-Data-Sensor-Bot\"\n}","processes":[{"type":"Process Definition","name":"Historic-OHLCVs","config":"{\n \"codeName\": \"Historic-OHLCVs\",\n \"description\": \"Retrieves and saves historical maket data\",\n \"startMode\": {\n \"noTime\": {\n \"run\": \"true\"\n },\n \"fixedInterval\": {\n \"run\": \"false\",\n \"interval\": 0\n }\n },\n \"deadWaitTime\": 0,\n \"normalWaitTime\": 60000,\n \"retryWaitTime\": 10000\n}","processOutput":{"type":"Process Output","name":"New Process Output","outputDatasets":[],"outputDatasetFolders":[],"id":"dfe2556e-a765-4e38-9d30-7f91090c0069","savedPayload":{"position":{"x":19694.65896528582,"y":18079.80666168302},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"processDependencies":{"type":"Process Dependencies","name":"New Process Dependencies","statusDependencies":[{"type":"Status Dependency","name":"Exchange Raw Data Historic-OHLCVs","config":"{\n \"mainUtility\": \"Self Reference\"\n}","id":"ea39c98b-18e2-44ce-9f7f-86a8a76a688a","savedPayload":{"position":{"x":20111.534021268813,"y":17814.56375630177},"targetPosition":{"x":19893.316491438505,"y":18150.31980838774},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":1,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Status Report","name":"New Status Report","id":"181c7c34-7243-497a-9ddb-1b0067c6d66e"}}}],"dataDependencies":[],"dataMineDataDependencies":[],"id":"5c7fae5a-6da6-4864-a167-f2f21d578c72","savedPayload":{"position":{"x":19893.316491438505,"y":18150.31980838774},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"statusReport":{"type":"Status Report","name":"New Status Report","id":"181c7c34-7243-497a-9ddb-1b0067c6d66e","savedPayload":{"position":{"x":20031.71582860312,"y":18304.406526432995},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionStartedEvent":{"type":"Execution Started Event","name":"","id":"957e7e3a-b167-40be-93b5-9ba4ceff56e5","savedPayload":{"position":{"x":20075.30856507894,"y":18506.680081128765},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionFinishedEvent":{"type":"Execution Finished Event","name":"New Execution Finished Event","id":"fe40a546-43ee-49df-908a-7e72f598f0cd","savedPayload":{"position":{"x":20019.51506449239,"y":18694.64493952324},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc","savedPayload":{"position":{"x":19674.617425695335,"y":18486.33639924593},"targetPosition":{"x":19278.707614323983,"y":18688.55263969416},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}}],"products":[{"type":"Product Definition","name":"Trades","config":"{\n\"codeName\": \"Trades\"\n}","datasets":[{"type":"Dataset Definition","name":"Trades","config":"{\n\"codeName\": \"Trades\"\n}","id":"fbb7c17e-a909-4fa2-b3c5-eb8ca86297c4","savedPayload":{"position":{"x":19939.732540593195,"y":18584.456194349146},"targetPosition":{"x":19741.31504137297,"y":18616.06022300575},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":1,"distanceToParent":2,"arrangementStyle":0},"uiObject":{}}}],"id":"38dbb942-a15b-450b-a867-02a94030965f","savedPayload":{"position":{"x":19741.31504137297,"y":18616.06022300575},"targetPosition":{"x":19278.707614323983,"y":18688.55263969416},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Product Definition","name":"Candles","config":"{\n\"codeName\": \"Candles\"\n}","datasets":[{"type":"Dataset Definition","name":"One-Min","config":"{\n\"codeName\": \"One-Min\"\n}","id":"1c3696e4-c28e-4744-9100-706d6dce0c3c","savedPayload":{"position":{"x":19935.702085675992,Line truncated
{"type":"Data Mine","name":"Masters","config":"{\n\"codeName\": \"Masters\"\n}","sensorBots":[{"type":"Sensor Bot","name":"Exchange Raw Data","config":"{\n\"codeName\": \"Exchange-Raw-Data\",\n\"repo\": \"Exchange-Raw-Data-Sensor-Bot\"\n}","processes":[{"type":"Process Definition","name":"Historic-OHLCVs","config":"{\n \"codeName\": \"Historic-OHLCVs\",\n \"description\": \"Retrieves and saves historical maket data\",\n \"startMode\": {\n \"noTime\": {\n \"run\": \"true\"\n },\n \"fixedInterval\": {\n \"run\": \"false\",\n \"interval\": 0\n }\n },\n \"deadWaitTime\": 0,\n \"normalWaitTime\": 60000,\n \"retryWaitTime\": 10000\n}","processOutput":{"type":"Process Output","name":"New Process Output","outputDatasets":[],"outputDatasetFolders":[],"id":"dfe2556e-a765-4e38-9d30-7f91090c0069","savedPayload":{"position":{"x":19694.65896528582,"y":18079.80666168302},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"processDependencies":{"type":"Process Dependencies","name":"New Process Dependencies","statusDependencies":[{"type":"Status Dependency","name":"Exchange Raw Data Historic-OHLCVs","config":"{\n \"mainUtility\": \"Self Reference\"\n}","id":"ea39c98b-18e2-44ce-9f7f-86a8a76a688a","savedPayload":{"position":{"x":20111.534021268813,"y":17814.56375630177},"targetPosition":{"x":19893.316491438505,"y":18150.31980838774},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":1,"distanceToParent":3,"arrangementStyle":0},"uiObject":{},"referenceParent":{"type":"Status Report","name":"New Status Report","id":"181c7c34-7243-497a-9ddb-1b0067c6d66e"}}}],"dataDependencies":[],"dataMineDataDependencies":[],"id":"5c7fae5a-6da6-4864-a167-f2f21d578c72","savedPayload":{"position":{"x":19893.316491438505,"y":18150.31980838774},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"statusReport":{"type":"Status Report","name":"New Status Report","id":"181c7c34-7243-497a-9ddb-1b0067c6d66e","savedPayload":{"position":{"x":20031.71582860312,"y":18304.406526432995},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionStartedEvent":{"type":"Execution Started Event","name":"","id":"957e7e3a-b167-40be-93b5-9ba4ceff56e5","savedPayload":{"position":{"x":20075.30856507894,"y":18506.680081128765},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"executionFinishedEvent":{"type":"Execution Finished Event","name":"New Execution Finished Event","id":"fe40a546-43ee-49df-908a-7e72f598f0cd","savedPayload":{"position":{"x":20019.51506449239,"y":18694.64493952324},"targetPosition":{"x":19674.617425695335,"y":18486.33639924593},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{}}},"id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc","savedPayload":{"position":{"x":19674.617425695335,"y":18486.33639924593},"targetPosition":{"x":19278.707614323983,"y":18688.55263969416},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}}],"products":[{"type":"Product Definition","name":"Trades","config":"{\n\"codeName\": \"Trades\"\n}","datasets":[{"type":"Dataset Definition","name":"Trades","config":"{\n\"codeName\": \"Trades\"\n}","id":"fbb7c17e-a909-4fa2-b3c5-eb8ca86297c4","savedPayload":{"position":{"x":19939.732540593195,"y":18584.456194349146},"targetPosition":{"x":19741.31504137297,"y":18616.06022300575},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":1,"distanceToParent":2,"arrangementStyle":0},"uiObject":{}}}],"id":"38dbb942-a15b-450b-a867-02a94030965f","savedPayload":{"position":{"x":19741.31504137297,"y":18616.06022300575},"targetPosition":{"x":19278.707614323983,"y":18688.55263969416},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":3,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Product Definition","name":"Candles","config":"{\n\"codeName\": \"Candles\"\n}","datasets":[{"type":"Dataset Definition","name":"One-Min","config":"{\n\"codeName\": \"One-Min\"\n}","id":"1c3696e4-c28e-4744-9100-706d6dce0c3c","savedPayload":{"position":{"x":19935.702085675992,Line truncated
+1 -1
View File
@@ -138,7 +138,7 @@
statusReport = statusDependencies.reportsByMainUtility.get("Self Reference")
if (statusReport === undefined) { // This means the status report does not exist, that could happen for instance at the begining of a month.
logger.write(MODULE_NAME, "[WARN] start -> getContextVariables -> Self Reference -> Status Report does not exist or Self Reference not defined. Retrying Later. ")
logger.write(MODULE_NAME, "[WARN] start -> getContextVariables -> Self Reference -> Status Report does not exist or Self Reference not defined or badly configured. Check that at the Status Dependency you have chosen Self Reference at the config. Retrying Later. ")
callBackFunction(global.DEFAULT_RETRY_RESPONSE)
return
}
+46
View File
@@ -0,0 +1,46 @@
variable.last20Buy = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
variable.last20Sell = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let candle = record.current // This is the primary dependency
let volume = getElement('volumes', candle) // Here I get the volume bar corresponding to the current candle
let totalVolume = volume.buy + volume.sell // Candles Volumes split the volume received from the exchange evenly betwen buy and sell because it does not know how much of it there is.
variable.buyVolume = 0
variable.sellVolume = 0
if (candle.direction === 'Up') {
variable.buyVolume = totalVolume
}
if (candle.direction === 'Down') {
variable.sellVolume = totalVolume
}
variable.last20Buy.splice(0, 1)
variable.last20Buy.push(variable.buyVolume)
let totalBuy = 0
let totalNonZero = 0
for (let i = 0; i < variable.last20Buy.length; i++) {
let value = variable.last20Buy[i]
if (value > 0) {
totalBuy = totalBuy + value
totalNonZero++
}
}
variable.buySMA = totalBuy / totalNonZero
variable.last20Sell.splice(0, 1)
variable.last20Sell.push(variable.sellVolume)
let totalSell = 0
totalNonZero = 0
for (let i = 0; i < variable.last20Sell.length; i++) {
let value = variable.last20Sell[i]
if (value > 0) {
totalSell = totalSell + value
totalNonZero++
}
}
variable.sellSMA = totalSell / totalNonZero