Added Personal Data, Exchange Account, Asset and Key basic structure
This commit is contained in:
1 parent
b85dae5896
commit
474f7fa4f6
11 files changed
+638
-13
No files matched your search
@@ -196,6 +196,18 @@ function newStrategyPart () {
|
||||
let compatibleType
|
||||
let compatibleSubType
|
||||
switch (thisObject.payload.node.type) {
|
||||
case 'Exchange Account':
|
||||
compatibleType = '->' + 'Personal Data'
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Exchange Account Asset':
|
||||
compatibleType = '->' + 'Exchange Account'
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Exchange Account Key':
|
||||
compatibleType = '->' + 'Exchange Account'
|
||||
compatibleSubType = undefined
|
||||
break
|
||||
case 'Parameters':
|
||||
compatibleType = '->' + 'Trading System'
|
||||
compatibleSubType = undefined
|
||||
|
||||
@@ -153,6 +153,189 @@ function newStrategyPartConstructor () {
|
||||
function getMenuItemsInitialValues (strategyPart, floatingObject, payload) {
|
||||
let menuItemsInitialValues = []
|
||||
switch (payload.node.type) {
|
||||
case 'Personal Data': {
|
||||
floatingObject.isPinned = true
|
||||
floatingObject.positionLocked = true
|
||||
addLeftIcons(menuItemsInitialValues, floatingObject)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Personal Data',
|
||||
askConfirmation: true,
|
||||
confirmationLabel: 'Confirm to Delete',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Delete Personal Data',
|
||||
visible: false,
|
||||
iconPathOn: 'trash',
|
||||
iconPathOff: 'trash',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -30
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Exchange Account',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Exchange Account',
|
||||
visible: false,
|
||||
iconPathOn: 'approve',
|
||||
iconPathOff: 'approve',
|
||||
relatedStrategyPart: 'Exchange Account',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: +0
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Download',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Download',
|
||||
visible: false,
|
||||
iconPathOn: 'upload',
|
||||
iconPathOff: 'upload',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 30
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
addLeftIcons(menuItemsInitialValues, floatingObject)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Exchange Account',
|
||||
askConfirmation: true,
|
||||
confirmationLabel: 'Confirm to Delete',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Delete This Account',
|
||||
visible: false,
|
||||
iconPathOn: 'trash',
|
||||
iconPathOff: 'trash',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -60
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Exchange Account Asset',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Asset',
|
||||
visible: false,
|
||||
iconPathOn: 'paper-plane',
|
||||
iconPathOff: 'paper-plane',
|
||||
relatedStrategyPart: 'Exchange Account Asset',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Add Exchange Account Key',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Add Key',
|
||||
visible: false,
|
||||
iconPathOn: 'login',
|
||||
iconPathOff: 'login',
|
||||
relatedStrategyPart: 'Exchange Account Key',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Download',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Download',
|
||||
visible: false,
|
||||
iconPathOn: 'upload',
|
||||
iconPathOff: 'upload',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 60
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
addLeftIcons(menuItemsInitialValues, floatingObject)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Exchange Account Asset',
|
||||
askConfirmation: true,
|
||||
confirmationLabel: 'Confirm to Delete',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Delete This Asset',
|
||||
visible: false,
|
||||
iconPathOn: 'trash',
|
||||
iconPathOff: 'trash',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Download',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Download',
|
||||
visible: false,
|
||||
iconPathOn: 'upload',
|
||||
iconPathOff: 'upload',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
addLeftIcons(menuItemsInitialValues, floatingObject)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Delete Exchange Account Key',
|
||||
askConfirmation: true,
|
||||
confirmationLabel: 'Confirm to Delete',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Delete This Key',
|
||||
visible: false,
|
||||
iconPathOn: 'trash',
|
||||
iconPathOff: 'trash',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: -20
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Download',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'Download',
|
||||
visible: false,
|
||||
iconPathOn: 'upload',
|
||||
iconPathOff: 'upload',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
angle: 20
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'Workspace': {
|
||||
floatingObject.isPinned = true
|
||||
floatingObject.positionLocked = true
|
||||
@@ -238,9 +421,9 @@ function newStrategyPartConstructor () {
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'New Strategy',
|
||||
action: 'Add Strategy',
|
||||
actionFunction: payload.onMenuItemClick,
|
||||
label: 'New Strategy',
|
||||
label: 'Add Strategy',
|
||||
visible: false,
|
||||
iconPathOn: 'quality',
|
||||
iconPathOff: 'quality',
|
||||
@@ -1464,6 +1647,22 @@ function newStrategyPartConstructor () {
|
||||
level_0()
|
||||
break
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
level_1()
|
||||
break
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
level_3()
|
||||
break
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
level_3()
|
||||
break
|
||||
}
|
||||
case 'Personal Data': {
|
||||
level_0()
|
||||
break
|
||||
}
|
||||
case 'Trading System': {
|
||||
level_0()
|
||||
break
|
||||
|
||||
@@ -48,6 +48,18 @@ function newStrategyPartTitle () {
|
||||
thisObject.payload = payload
|
||||
|
||||
switch (payload.node.type) {
|
||||
case 'Personal Data': {
|
||||
break
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
break
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
break
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
break
|
||||
}
|
||||
case 'Workspace': {
|
||||
thisObject.allwaysVisible = true
|
||||
break
|
||||
|
||||
@@ -39,6 +39,10 @@ function newStrategySpace () {
|
||||
|
||||
function buildIconByPartTypeMap () {
|
||||
const relationshipArray = [
|
||||
['Personal Data', 'security'],
|
||||
['Exchange Account', 'approve'],
|
||||
['Exchange Account Asset', 'paper-plane'],
|
||||
['Exchange Account Key', 'login'],
|
||||
['Workspace', 'design-tool'],
|
||||
['Trading System', 'analysis'],
|
||||
['Parameters', 'settings'],
|
||||
|
||||
@@ -8,14 +8,45 @@ function newAttachDetach () {
|
||||
|
||||
function detachNode (node, rootNodes) {
|
||||
switch (node.type) {
|
||||
case 'Trading System': {
|
||||
case 'Personal Data': {
|
||||
return
|
||||
}
|
||||
case 'Parameters': {
|
||||
node.payload.parentNode.parameters = undefined
|
||||
case 'Exchange Account': {
|
||||
let payload = node.payload
|
||||
for (let i = 0; i < payload.parentNode.exchangeAccounts.length; i++) {
|
||||
let strategy = payload.parentNode.exchangeAccounts[i]
|
||||
if (strategy.id === node.id) {
|
||||
payload.parentNode.exchangeAccounts.splice(i, 1)
|
||||
}
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
return
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
let payload = node.payload
|
||||
for (let i = 0; i < payload.parentNode.assets.length; i++) {
|
||||
let asset = payload.parentNode.assets[i]
|
||||
if (asset.id === node.id) {
|
||||
payload.parentNode.assets.splice(i, 1)
|
||||
}
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
return
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
let payload = node.payload
|
||||
for (let i = 0; i < payload.parentNode.keys.length; i++) {
|
||||
let key = payload.parentNode.keys[i]
|
||||
if (key.id === node.id) {
|
||||
payload.parentNode.keys.splice(i, 1)
|
||||
}
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
return
|
||||
}
|
||||
case 'Trading System': {
|
||||
return
|
||||
}
|
||||
case 'Base Asset': {
|
||||
node.payload.parentNode.baseAsset = undefined
|
||||
completeDetachment(node, rootNodes)
|
||||
@@ -28,10 +59,10 @@ function newAttachDetach () {
|
||||
if (strategy.id === node.id) {
|
||||
payload.parentNode.strategies.splice(i, 1)
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
return
|
||||
}
|
||||
break
|
||||
case 'Trigger Stage': {
|
||||
node.payload.parentNode.triggerStage = undefined
|
||||
completeDetachment(node, rootNodes)
|
||||
@@ -126,8 +157,8 @@ function newAttachDetach () {
|
||||
}
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
return
|
||||
}
|
||||
break
|
||||
case 'Situation': {
|
||||
let payload = node.payload
|
||||
for (let i = 0; i < payload.parentNode.situations.length; i++) {
|
||||
@@ -137,8 +168,8 @@ function newAttachDetach () {
|
||||
}
|
||||
}
|
||||
completeDetachment(node, rootNodes)
|
||||
return
|
||||
}
|
||||
break
|
||||
case 'Phase': {
|
||||
let payload = node.payload
|
||||
for (let i = 0; i < payload.parentNode.phases.length; i++) {
|
||||
@@ -158,12 +189,34 @@ function newAttachDetach () {
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function attachNode (node, attachToNode, rootNodes) {
|
||||
switch (node.type) {
|
||||
case 'Exchange Account': {
|
||||
node.payload.parentNode = attachToNode
|
||||
node.payload.chainParent = attachToNode
|
||||
node.payload.parentNode.exchangeAccounts.push(node)
|
||||
completeAttachment(node, rootNodes)
|
||||
}
|
||||
break
|
||||
case 'Exchange Account Asset': {
|
||||
node.payload.parentNode = attachToNode
|
||||
node.payload.chainParent = attachToNode
|
||||
node.payload.parentNode.assets.push(node)
|
||||
completeAttachment(node, rootNodes)
|
||||
}
|
||||
break
|
||||
case 'Exchange Account Key': {
|
||||
node.payload.parentNode = attachToNode
|
||||
node.payload.chainParent = attachToNode
|
||||
node.payload.parentNode.keys.push(node)
|
||||
completeAttachment(node, rootNodes)
|
||||
}
|
||||
break
|
||||
case 'Parameters': {
|
||||
node.payload.parentNode = attachToNode
|
||||
node.payload.chainParent = attachToNode
|
||||
|
||||
@@ -8,6 +8,18 @@ function newNodeChildren () {
|
||||
function childrenCount (parentNode, childNode) {
|
||||
switch (parentNode.type) {
|
||||
|
||||
case 'Personal Data': {
|
||||
return countChildrenPersonalData(parentNode, childNode)
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
return countChildrenExchangeAccount(parentNode, childNode)
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
return countChildrenExchangeAccountAsset(parentNode, childNode)
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
return countChildrenExchangeAccountKey(parentNode, childNode)
|
||||
}
|
||||
case 'Trading System': {
|
||||
return countChildrenTradingSystem(parentNode, childNode)
|
||||
}
|
||||
@@ -86,6 +98,62 @@ function newNodeChildren () {
|
||||
}
|
||||
}
|
||||
|
||||
function countChildrenPersonalData (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
|
||||
for (let i = 0; i < parentNode.exchangeAccounts.length; i++) {
|
||||
let child = parentNode.exchangeAccounts[i]
|
||||
response.childrenCount++
|
||||
if (child.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenExchangeAccount (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
|
||||
for (let i = 0; i < parentNode.assets.length; i++) {
|
||||
let child = parentNode.assets[i]
|
||||
response.childrenCount++
|
||||
if (child.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < parentNode.keys.length; i++) {
|
||||
let child = parentNode.keys[i]
|
||||
response.childrenCount++
|
||||
if (child.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenExchangeAccountAsset (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenExchangeAccountKey (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenTradingSystem (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
function newNodeDeleter () {
|
||||
thisObject = {
|
||||
deletePersonalData: deletePersonalData,
|
||||
deleteExchangeAccount: deleteExchangeAccount,
|
||||
deleteExchangeAccountAsset: deleteExchangeAccountAsset,
|
||||
deleteExchangeAccountKey: deleteExchangeAccountKey,
|
||||
deleteWorkspace: deleteWorkspace,
|
||||
deleteTradingSystem: deleteTradingSystem,
|
||||
deleteParameters: deleteParameters,
|
||||
@@ -34,6 +38,22 @@ function newNodeDeleter () {
|
||||
let rootNode = node.rootNodes[0]
|
||||
switch (rootNode.type) {
|
||||
|
||||
case 'Personal Data': {
|
||||
deletePersonalData(rootNode, rootNodes, true)
|
||||
break
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
deleteExchangeAccount(rootNode, rootNodes, true)
|
||||
break
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
deleteExchangeAccountAsset(rootNode, rootNodes, true)
|
||||
break
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
deleteExchangeAccountKey(rootNode, rootNodes, true)
|
||||
break
|
||||
}
|
||||
case 'Trading System': {
|
||||
deleteTradingSystem(rootNode, rootNodes, true)
|
||||
break
|
||||
@@ -126,6 +146,69 @@ function newNodeDeleter () {
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deletePersonalData (node, rootNodes) {
|
||||
while (node.exchangeAccounts.length > 0) {
|
||||
deleteStrategy(node.exchangeAccounts[0], rootNodes)
|
||||
}
|
||||
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteExchangeAccount (node, rootNodes) {
|
||||
let payload = node.payload
|
||||
if (payload.parentNode !== undefined) {
|
||||
for (let j = 0; j < payload.parentNode.exchangeAccounts.length; j++) {
|
||||
let exchangeAccount = payload.parentNode.exchangeAccounts[j]
|
||||
if (exchangeAccount.id === node.id) {
|
||||
payload.parentNode.exchangeAccounts.splice(j, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
while (node.assets.length > 0) {
|
||||
deleteExchangeAccountAsset(node.assets[0], rootNodes)
|
||||
}
|
||||
while (node.keys.length > 0) {
|
||||
deleteExchangeAccountKey(node.keys[0], rootNodes)
|
||||
}
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteExchangeAccountAsset (node, rootNodes) {
|
||||
let payload = node.payload
|
||||
if (payload.parentNode !== undefined) {
|
||||
for (let j = 0; j < payload.parentNode.assets.length; j++) {
|
||||
let asset = payload.parentNode.assets[j]
|
||||
if (asset.id === node.id) {
|
||||
payload.parentNode.assets.splice(j, 1)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
completeDeletion(node, rootNodes)
|
||||
}
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteExchangeAccountKey (node, rootNodes) {
|
||||
let payload = node.payload
|
||||
if (payload.parentNode !== undefined) {
|
||||
for (let j = 0; j < payload.parentNode.keys.length; j++) {
|
||||
let key = payload.parentNode.keys[j]
|
||||
if (key.id === node.id) {
|
||||
payload.parentNode.keys.splice(j, 1)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
completeDeletion(node, rootNodes)
|
||||
}
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteTradingSystem (node, rootNodes, forced) {
|
||||
if (forced !== true) {
|
||||
/* Can not delete if it is the last one */
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
function newPartsFromNodes () {
|
||||
thisObject = {
|
||||
createPartFromNode: createPartFromNode,
|
||||
newStrategy: newStrategy,
|
||||
addExchangeAccount: addExchangeAccount,
|
||||
addExchangeAccountAsset: addExchangeAccountAsset,
|
||||
addExchangeAccountKey: addExchangeAccountKey,
|
||||
addStrategy: addStrategy,
|
||||
addParameters: addParameters,
|
||||
addMissingParameters: addMissingParameters,
|
||||
addMissingStages: addMissingStages,
|
||||
@@ -268,10 +271,67 @@ function newPartsFromNodes () {
|
||||
createPart('Workspace', workspace.name, workspace, parentNode, chainParent, 'Workspace')
|
||||
return
|
||||
}
|
||||
case 'Personal Data': {
|
||||
createPart('Personal Data', node.name, node, parentNode, chainParent, 'Personal Data')
|
||||
for (let m = 0; m < node.exchangeAccounts.length; m++) {
|
||||
let exchangeAccount = node.exchangeAccounts[m]
|
||||
createPartFromNode(exchangeAccount, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
createPart('Exchange Account', node.name, node, parentNode, chainParent, 'Exchange Account')
|
||||
for (let m = 0; m < node.assets.length; m++) {
|
||||
let asset = node.assets[m]
|
||||
createPartFromNode(asset, node, node)
|
||||
}
|
||||
for (let m = 0; m < node.keys.length; m++) {
|
||||
let key = node.keys[m]
|
||||
createPartFromNode(key, node, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
createPart('Exchange Account Asset', node.name, node, parentNode, chainParent, 'Exchange Account Asset')
|
||||
return
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
createPart('Exchange Account Key', node.name, node, parentNode, chainParent, 'Exchange Account Key')
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function newStrategy (parentNode) {
|
||||
function addExchangeAccount (parentNode) {
|
||||
let personalData = parentNode
|
||||
let exchangeAccount = {
|
||||
name: 'New Account',
|
||||
assets: [],
|
||||
keys: []
|
||||
}
|
||||
personalData.exchangeAccounts.push(exchangeAccount)
|
||||
createPart('Exchange Account', exchangeAccount.name, exchangeAccount, personalData, personalData, 'Exchange Account')
|
||||
}
|
||||
|
||||
function addExchangeAccountAsset (parentNode) {
|
||||
let exchangeAccount = parentNode
|
||||
let asset = {
|
||||
name: 'New Asset'
|
||||
}
|
||||
exchangeAccount.assets.push(asset)
|
||||
createPart('Exchange Account Asset', asset.name, asset, exchangeAccount, exchangeAccount, 'Account Asset')
|
||||
}
|
||||
|
||||
function addExchangeAccountKey (parentNode) {
|
||||
let exchangeAccount = parentNode
|
||||
let key = {
|
||||
name: 'New Key'
|
||||
}
|
||||
exchangeAccount.keys.push(key)
|
||||
createPart('Exchange Account Key', key.name, key, exchangeAccount, exchangeAccount, 'Account Key')
|
||||
}
|
||||
|
||||
function addStrategy (parentNode) {
|
||||
let strategyParent = parentNode
|
||||
let strategy = {
|
||||
name: 'New Strategy',
|
||||
|
||||
@@ -276,6 +276,55 @@ function newProtocolNode () {
|
||||
}
|
||||
return tradingSystem
|
||||
}
|
||||
case 'Personal Data': {
|
||||
let personalData = {
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
exchangeAccounts: []
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.exchangeAccounts.length; m++) {
|
||||
let exchangeAccount = getProtocolNode(node.exchangeAccounts[m])
|
||||
personalData.exchangeAccounts.push(exchangeAccount)
|
||||
}
|
||||
return personalData
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
let exchangeAccount = {
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
assets: [],
|
||||
keys: []
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.assets.length; m++) {
|
||||
let asset = getProtocolNode(node.assets[m])
|
||||
exchangeAccount.assets.push(asset)
|
||||
}
|
||||
for (let m = 0; m < node.keys.length; m++) {
|
||||
let key = getProtocolNode(node.keys[m])
|
||||
exchangeAccount.keys.push(key)
|
||||
}
|
||||
return exchangeAccount
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
let asset = {
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name
|
||||
}
|
||||
return asset
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
let key = {
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name
|
||||
}
|
||||
return key
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,6 +326,64 @@ function newStringifyNode () {
|
||||
}
|
||||
return tradingSystem
|
||||
}
|
||||
case 'Personal Data': {
|
||||
let personalData = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
exchangeAccounts: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.exchangeAccounts.length; m++) {
|
||||
let exchangeAccount = prepareForStringify(node.exchangeAccounts[m])
|
||||
personalData.exchangeAccounts.push(exchangeAccount)
|
||||
}
|
||||
return personalData
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
let exchangeAccount = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
assets: [],
|
||||
keys: [],
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.assets.length; m++) {
|
||||
let asset = prepareForStringify(node.assets[m])
|
||||
exchangeAccount.assets.push(asset)
|
||||
}
|
||||
|
||||
for (let m = 0; m < node.keys.length; m++) {
|
||||
let key = prepareForStringify(node.keys[m])
|
||||
exchangeAccount.keys.push(key)
|
||||
}
|
||||
return exchangeAccount
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
let asset = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return asset
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
let key = {
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
subType: node.subType,
|
||||
name: node.name,
|
||||
savedPayload: getSavedPayload(node)
|
||||
}
|
||||
return key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -187,9 +187,9 @@ function newWorkspace () {
|
||||
|
||||
break
|
||||
|
||||
case 'New Strategy':
|
||||
case 'Add Strategy':
|
||||
{
|
||||
functionLibraryPartsFromNodes.newStrategy(payload.node)
|
||||
functionLibraryPartsFromNodes.addStrategy(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Parameters':
|
||||
@@ -262,6 +262,21 @@ function newWorkspace () {
|
||||
functionLibraryPartsFromNodes.addCode(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Exchange Account':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addExchangeAccount(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Exchange Account Asset':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addExchangeAccountAsset(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Add Exchange Account Key':
|
||||
{
|
||||
functionLibraryPartsFromNodes.addExchangeAccountKey(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Delete Trading System': {
|
||||
functionLibraryNodeDeleter.deleteTradingSystem(payload.node, workspaceNode.rootNodes)
|
||||
break
|
||||
@@ -342,6 +357,18 @@ function newWorkspace () {
|
||||
functionLibraryNodeDeleter.deleteCode(payload.node, workspaceNode.rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Delete Exchange Account': {
|
||||
functionLibraryNodeDeleter.deleteExchangeAccount(payload.node, workspaceNode.rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Delete Exchange Account Asset': {
|
||||
functionLibraryNodeDeleter.deleteExchangeAccountAsset(payload.node, workspaceNode.rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Delete Exchange Account Key': {
|
||||
functionLibraryNodeDeleter.deleteExchangeAccountKey(payload.node, workspaceNode.rootNodes)
|
||||
break
|
||||
}
|
||||
default:
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user