Sessions References swapped

This commit is contained in:
Luis Fernando Molina committed 2020-09-16 16:45:35 +02:00
1 parent 03f13a8e16
commit 4e7dc72ba6
6 files changed
+92 -90

No files matched your search

+63 -54
View File
@@ -1883,14 +1883,6 @@
"dontShowAtFullscreen": true,
"actionFunction": "uiObject.configEditor.activate"
},
{
"action": "Add UI Object",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "dataStorage",
"label": "Add Data Storage",
"relatedUiObject": "Data Storage",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add UI Object",
"disableIfPropertyIsDefined": true,
@@ -1915,6 +1907,14 @@
"relatedUiObject": "Production Environment",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add UI Object",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "dataStorage",
"label": "Add Data Storage",
"relatedUiObject": "Data Storage",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
@@ -1938,12 +1938,6 @@
"compatibleTypes": "->Network->"
},
"properties": [
{
"name": "dataStorage",
"type": "node",
"childType": "Data Storage",
"autoAdd": true
},
{
"name": "dataMining",
"type": "node",
@@ -1961,6 +1955,12 @@
"type": "node",
"childType": "Production Environment",
"autoAdd": true
},
{
"name": "dataStorage",
"type": "node",
"childType": "Data Storage",
"autoAdd": true
}
],
"propertyNameAtParent": "networkNodes"
@@ -13674,7 +13674,7 @@
"menuItems": [
{
"action": "Add UI Object",
"label": "Add Market Data",
"label": "Add Market Data Products",
"relatedUiObject": "Market Data Products",
"actionFunction": "payload.onMenuItemClick"
},
@@ -13766,17 +13766,19 @@
"menuItems": [
{
"action": "Add UI Object",
"label": "Add Session Reference",
"relatedUiObject": "Session Reference",
"label": "Add Market Trading Products",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "marketTradingProducts",
"relatedUiObject": "Market Trading Products",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add Missing Session References",
"label": "Add Missing Sessions",
"action": "Add Missing Market Trading Products",
"label": "Add Missing Markets",
"askConfirmation": true,
"confirmationLabel": "Confirm to Proceed",
"workDoneLabel": "Done",
"relatedUiObject": "Session Reference",
"relatedUiObject": "Market Trading Products",
"actionFunction": "payload.onMenuItemClick"
},
{
@@ -13805,9 +13807,10 @@
"propertyNameAtParent": "exchangeTradingProducts",
"properties": [
{
"name": "sessionReferences",
"name": "marketTradingProducts",
"type": "array",
"childType": "Session Reference"
"childType": "Market Trading Products",
"autoAdd": false
}
]
},
@@ -13858,10 +13861,23 @@
"menuItems": [
{
"action": "Add UI Object",
"label": "Add Market Trading Data",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "marketTradingProducts",
"relatedUiObject": "Market Trading Products",
"label": "Add Data Product",
"relatedUiObject": "Data Product",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add UI Object",
"label": "Add Trading Mine Products",
"relatedUiObject": "Trading Mine Products",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add All Trading Mine Products",
"label": "Add All Trading Mine Products",
"askConfirmation": true,
"confirmationLabel": "Confirm to Proceed",
"workDoneLabel": "Done",
"relatedUiObject": "Trading Mine Products",
"actionFunction": "payload.onMenuItemClick"
},
{
@@ -13887,15 +13903,21 @@
"compatibleTypes": "->Backtesting Session->Paper Trading Session->Forward Testing Session->Live Trading Session->"
},
"chainAttachesTo": {
"compatibleTypes": "->Exchange Trading Products->"
"compatibleTypes": "->Market Trading Products->"
},
"propertyNameAtParent": "sessionReferences",
"properties": [
{
"name": "marketTradingProducts",
"type": "node",
"childType": "Market Trading Products",
"autoAdd": true
"name": "dataProducts",
"type": "array",
"childType": "Data Product",
"autoAdd": false
},
{
"name": "tradingMineProducts",
"type": "array",
"childType": "Trading Mine Products",
"autoAdd": false
}
]
},
@@ -13967,23 +13989,17 @@
"menuItems": [
{
"action": "Add UI Object",
"label": "Add Trading Mine Products",
"relatedUiObject": "Trading Mine Products",
"label": "Add Session Reference",
"relatedUiObject": "Session Reference",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add All Trading Mine Products",
"label": "Add All Trading Mine Products",
"action": "Add Missing Session References",
"label": "Add Missing Sessions",
"askConfirmation": true,
"confirmationLabel": "Confirm to Proceed",
"workDoneLabel": "Done",
"relatedUiObject": "Trading Mine Products",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Add UI Object",
"label": "Add Data Product",
"relatedUiObject": "Data Product",
"relatedUiObject": "Session Reference",
"actionFunction": "payload.onMenuItemClick"
},
{
@@ -14007,21 +14023,14 @@
"compatibleTypes": "->Market->"
},
"chainAttachesTo": {
"compatibleTypes": "->Session Reference->"
"compatibleTypes": "->Exchange Trading Products->"
},
"propertyNameAtParent": "marketTradingProducts",
"properties": [
{
"name": "dataProducts",
"name": "sessionReferences",
"type": "array",
"childType": "Data Product",
"autoAdd": false
},
{
"name": "tradingMineProducts",
"type": "array",
"childType": "Trading Mine Products",
"autoAdd": false
"childType": "Session Reference"
}
]
},
@@ -14048,7 +14057,7 @@
"compatibleTypes": "->Product Definition->"
},
"chainAttachesTo": {
"compatibleTypes": "->Market Data Products->Data Product Folder->Bot Products->"
"compatibleTypes": "->Market Data Products->Data Product Folder->Bot Products->Session Reference->"
},
"propertyNameAtParent": "dataProducts",
"properties": []
@@ -14141,7 +14150,7 @@
"compatibleTypes": "->Trading Mine->"
},
"chainAttachesTo": {
"compatibleTypes": "->Market Trading Products->"
"compatibleTypes": "->Session Reference->"
},
"propertyNameAtParent": "tradingMineProducts",
"properties": [
@@ -147,8 +147,7 @@ function newChartingSpaceFunctions() {
that are not the one we are interested in, we do the following:
*/
if (mineProduct.payload.parentNode === undefined) { continue }
if (mineProduct.payload.parentNode.payload.parentNode.payload.referenceParent === undefined) { continue }
if (mineProduct.payload.parentNode.payload.parentNode.payload.referenceParent.id !== session.id) { continue }
if (mineProduct.payload.parentNode.payload.referenceParent.id !== session.id) { continue }
/*
At the current version of Superalgos, beta 6, there is only one Trading Mine,
with only one bot, and it has so many data products that we want to put them
@@ -316,41 +316,25 @@ function newCryptoEcosystemFunctions() {
let exchangeTradingProducts = findOrCreateChildWithReference(tradingMinesData, 'Exchange Trading Products', cryptoExchange, functionLibraryUiObjectsFromNodes)
exchangeTradingProducts.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
/*
We need to delete all the session references related to the market we are installing.
We make a copy of the array so that if we need to delete some nodes it does not
affect the loop evaluating the nodes.
*/
let sessionReferencesArray = []
for (let i = 0; i < exchangeTradingProducts.sessionReferences.length; i++) {
sessionReference = exchangeTradingProducts.sessionReferences[i]
sessionReferencesArray.push(sessionReference)
}
for (let i = 0; i < sessionReferencesArray.length; i++) {
sessionReference = sessionReferencesArray[i]
if (sessionReference.marketTradingProducts === undefined) { continue }
if (sessionReference.marketTradingProducts.payload.referenceParent === undefined) { continue }
if (sessionReference.marketTradingProducts.payload.referenceParent.id === node.id) {
functionLibraryNodeDeleter.deleteUIObject(sessionReference, rootNodes)
}
}
let marketTradingProducts = findAndRecreateChildWithReference(exchangeTradingProducts, 'Market Trading Products', market, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
marketTradingProducts.payload.floatingObject.collapseToggle()
/*
Create the new session references.
*/
for (let i = 0; i < sessionsCreatedArray.length; i++) {
let session = sessionsCreatedArray[i]
if (isMissingChildren(exchangeTradingProducts, session, true) === true) {
functionLibraryDataStorageFunctions.createSessionReference(exchangeTradingProducts, session, functionLibraryUiObjectsFromNodes)
if (isMissingChildren(marketTradingProducts, session, true) === true) {
functionLibraryDataStorageFunctions.createSessionReference(marketTradingProducts, session, functionLibraryUiObjectsFromNodes)
}
}
/*
Create everything inside the session references.
*/
for (let j = 0; j < exchangeTradingProducts.sessionReferences.length; j++) {
sessionReference = exchangeTradingProducts.sessionReferences[j]
menuClick(sessionReference.marketTradingProducts, 'Add All Trading Mine Products', true)
menuClickOfNodeArray(sessionReference.marketTradingProducts.tradingMineProducts, 'Add All Data Products', true)
sessionReference.marketTradingProducts.payload.floatingObject.collapseToggle()
for (let j = 0; j < marketTradingProducts.sessionReferences.length; j++) {
sessionReference = marketTradingProducts.sessionReferences[j]
menuClick(sessionReference, 'Add All Trading Mine Products', true)
menuClickOfNodeArray(sessionReference.tradingMineProducts, 'Add All Data Products', true)
sessionReference.payload.floatingObject.collapseToggle()
}
}
}
@@ -5,6 +5,7 @@ function newDataStorageFunctions() {
addAllTradingMineProducts: addAllTradingMineProducts,
addMissingSessionReferences: addMissingSessionReferences,
addMissingMarketDataProducts: addMissingMarketDataProducts,
addMissingMarketTradingProducts: addMissingMarketTradingProducts,
addMissingExchangeTradingProducts: addMissingExchangeTradingProducts,
addMissingExchangeDataProducts: addMissingExchangeDataProducts,
createSessionReference: createSessionReference
@@ -100,6 +101,9 @@ function newDataStorageFunctions() {
function addMissingSession(sessionsArray) {
for (let i = 0; i < sessionsArray.length; i++) {
let session = sessionsArray[i]
/* We will filter out all the sessions that does not belong to the market we are in */
let marketTradingTasks = findNodeInNodeMesh(session, 'Market Trading Tasks', undefined, true, false, true, false)
if (node.payload.referenceParent.id !== marketTradingTasks.payload.referenceParent.id) { continue }
if (isMissingChildren(node, session, true) === true) {
createSessionReference(node, session, functionLibraryUiObjectsFromNodes)
}
@@ -110,16 +114,17 @@ function newDataStorageFunctions() {
function createSessionReference(node, session, functionLibraryUiObjectsFromNodes) {
let sessionReference = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Session Reference')
sessionReference.payload.referenceParent = session
/*
Now I will connect the Session Reference child that is auto created with the market
where the Session was found.
*/
let marketTradingTasks = findNodeInNodeMesh(session, 'Market Trading Tasks', undefined, true, false, true, false)
sessionReference.marketTradingProducts.payload.referenceParent = marketTradingTasks.payload.referenceParent
marketTradingTasks.payload.floatingObject.collapseToggle()
}
function addMissingMarketDataProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingMarketProducts(node, rootNodes, 'Market Data Products', functionLibraryUiObjectsFromNodes)
}
function addMissingMarketTradingProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
addMissingMarketProducts(node, rootNodes, 'Market Trading Products', functionLibraryUiObjectsFromNodes)
}
function addMissingMarketProducts(node, rootNodes, newNodeType, functionLibraryUiObjectsFromNodes) {
if (node.payload.referenceParent === undefined) { return }
if (node.payload.referenceParent.exchangeMarkets === undefined) { return }
let marketsArray = node.payload.referenceParent.exchangeMarkets.markets
@@ -127,7 +132,7 @@ function newDataStorageFunctions() {
for (let i = 0; i < marketsArray.length; i++) {
let market = marketsArray[i]
if (isMissingChildren(node, market, true) === true) {
let marketDataProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Market Data Products')
let marketDataProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, newNodeType)
marketDataProducts.payload.referenceParent = market
}
}
@@ -740,6 +740,11 @@ function newWorkspace() {
functionLibraryDataStorageFunctions.addMissingMarketDataProducts(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
}
break
case 'Add Missing Market Trading Products':
{
functionLibraryDataStorageFunctions.addMissingMarketTradingProducts(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
}
break
case 'Add Missing Exchange Trading Products':
{
functionLibraryDataStorageFunctions.addMissingExchangeTradingProducts(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes)
+1 -1
View File
@@ -163,7 +163,7 @@ function newLayer() {
'Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->' +
'Bot Products->Data Mine Products->Trading Mine Products->' +
'Market Data Products->Exchange Data Products->' +
'Market Trading Products->Session Reference->Exchange Trading Products->' +
'Session Reference->Market Trading Products->Exchange Trading Products->' +
'Data Mines Data->Trading Mines Data->Data Storage->Network Node->' +
'Data Storage->Network Node->' +
'Backtesting Session->Paper Trading Session->Forward Testing Session->Live Trading Session->' +