On Focus library implemented
This commit is contained in:
1 parent
3ec14cb02d
commit
16169abdff
3 files changed
+739
-60
No files matched your search
@@ -0,0 +1,653 @@
|
||||
function newOnFocus () {
|
||||
thisObject = {
|
||||
getNodeThatIsOnFocus: getNodeThatIsOnFocus
|
||||
}
|
||||
return thisObject
|
||||
|
||||
function getNodeThatIsOnFocus (node) {
|
||||
if (node === undefined) { return }
|
||||
switch (node.type) {
|
||||
case 'Code':
|
||||
{
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Condition':
|
||||
{
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.code)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Situation': {
|
||||
let child
|
||||
for (let m = 0; m < node.conditions.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.conditions[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Formula':
|
||||
{
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Next Phase Event':
|
||||
{
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.situations[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Phase': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.formula)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.nextPhaseEvent)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Stop': {
|
||||
let child
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.phases[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Take Profit': {
|
||||
let child
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.phases[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Take Position Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.situations[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trigger On Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.situations[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trigger Off Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.situations[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Initial Definition': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.stopLoss)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.takeProfit)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.positionSize)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.positionRate)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Open Execution': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Close Execution': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Position Size': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.formula)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Position Rate': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.formula)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trigger Stage': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.triggerOn)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.triggerOff)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.takePosition)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Open Stage': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.initialDefinition)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.openExecution)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Manage Stage': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.stopLoss)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.takeProfit)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Close Stage': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.closeExecution)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Strategy': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.triggerStage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.openStage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.manageStage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.closeStage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Base Asset': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Time Range': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Time Period': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Slippage': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Fee Structure': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Parameters': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.baseAsset)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.timeRange)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.timePeriod)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.slippage)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.feeStructure)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trading System': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
for (let m = 0; m < node.strategies.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.strategies[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Personal Data': {
|
||||
let child
|
||||
for (let m = 0; m < node.exchangeAccounts.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.exchangeAccounts[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Exchange Account': {
|
||||
let child
|
||||
for (let m = 0; m < node.assets.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.assets[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.keys.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.keys[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Exchange Account Asset': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Exchange Account Key': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Layer Manager': {
|
||||
let child
|
||||
for (let m = 0; m < node.layers.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.layers[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Layer': {
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Task Manager': {
|
||||
let child
|
||||
for (let m = 0; m < node.tasks.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.tasks[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Task': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.bot)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Sensor': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.processes[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Indicator': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.processes[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Trading Engine': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.processes[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Process': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.session)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Backtesting Session': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.layerManager)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Live Trading Session': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.layerManager)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Fordward Testing Session': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.layerManager)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Paper Trading Session': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.parameters)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.layerManager)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'Network Node': {
|
||||
let child
|
||||
for (let m = 0; m < node.taskManagers.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.taskManagers[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Network': {
|
||||
let child
|
||||
for (let m = 0; m < node.networkNodes.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.networkNodes[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
case 'Definition': {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node.tradingSystem)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.personalData)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.network)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
function newShortcutKeys () {
|
||||
thisObject = {
|
||||
getShortcutKey: getShortcutKey
|
||||
getNodeByShortcutKey: getNodeByShortcutKey
|
||||
}
|
||||
return thisObject
|
||||
|
||||
function getShortcutKey (node, searchingKey) {
|
||||
function getNodeByShortcutKey (node, searchingKey) {
|
||||
if (node === undefined) { return }
|
||||
switch (node.type) {
|
||||
case 'Code':
|
||||
@@ -18,7 +18,7 @@ function newShortcutKeys () {
|
||||
case 'Condition':
|
||||
{
|
||||
let child
|
||||
child = getShortcutKey(node.code, searchingKey)
|
||||
child = getNodeByShortcutKey(node.code, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -31,7 +31,7 @@ function newShortcutKeys () {
|
||||
case 'Situation': {
|
||||
let child
|
||||
for (let m = 0; m < node.conditions.length; m++) {
|
||||
child = getShortcutKey(node.conditions[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.conditions[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -54,7 +54,7 @@ function newShortcutKeys () {
|
||||
{
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getShortcutKey(node.situations[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.situations[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -67,11 +67,11 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Phase': {
|
||||
let child
|
||||
child = getShortcutKey(node.formula, searchingKey)
|
||||
child = getNodeByShortcutKey(node.formula, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.nextPhaseEvent, searchingKey)
|
||||
child = getNodeByShortcutKey(node.nextPhaseEvent, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -84,7 +84,7 @@ function newShortcutKeys () {
|
||||
case 'Stop': {
|
||||
let child
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
child = getShortcutKey(node.phases[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.phases[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -98,7 +98,7 @@ function newShortcutKeys () {
|
||||
case 'Take Profit': {
|
||||
let child
|
||||
for (let m = 0; m < node.phases.length; m++) {
|
||||
child = getShortcutKey(node.phases[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.phases[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -112,7 +112,7 @@ function newShortcutKeys () {
|
||||
case 'Take Position Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getShortcutKey(node.situations[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.situations[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -126,7 +126,7 @@ function newShortcutKeys () {
|
||||
case 'Trigger On Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getShortcutKey(node.situations[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.situations[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -140,7 +140,7 @@ function newShortcutKeys () {
|
||||
case 'Trigger Off Event': {
|
||||
let child
|
||||
for (let m = 0; m < node.situations.length; m++) {
|
||||
child = getShortcutKey(node.situations[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.situations[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -153,19 +153,19 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Initial Definition': {
|
||||
let child
|
||||
child = getShortcutKey(node.stopLoss, searchingKey)
|
||||
child = getNodeByShortcutKey(node.stopLoss, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.takeProfit, searchingKey)
|
||||
child = getNodeByShortcutKey(node.takeProfit, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.positionSize, searchingKey)
|
||||
child = getNodeByShortcutKey(node.positionSize, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.positionRate, searchingKey)
|
||||
child = getNodeByShortcutKey(node.positionRate, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -191,7 +191,7 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Position Size': {
|
||||
let child
|
||||
child = getShortcutKey(node.formula, searchingKey)
|
||||
child = getNodeByShortcutKey(node.formula, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -203,7 +203,7 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Position Rate': {
|
||||
let child
|
||||
child = getShortcutKey(node.formula, searchingKey)
|
||||
child = getNodeByShortcutKey(node.formula, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -215,15 +215,15 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Trigger Stage': {
|
||||
let child
|
||||
child = getShortcutKey(node.triggerOn, searchingKey)
|
||||
child = getNodeByShortcutKey(node.triggerOn, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.triggerOff, searchingKey)
|
||||
child = getNodeByShortcutKey(node.triggerOff, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.takePosition, searchingKey)
|
||||
child = getNodeByShortcutKey(node.takePosition, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -235,11 +235,11 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Open Stage': {
|
||||
let child
|
||||
child = getShortcutKey(node.initialDefinition, searchingKey)
|
||||
child = getNodeByShortcutKey(node.initialDefinition, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.openExecution, searchingKey)
|
||||
child = getNodeByShortcutKey(node.openExecution, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -251,11 +251,11 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Manage Stage': {
|
||||
let child
|
||||
child = getShortcutKey(node.stopLoss, searchingKey)
|
||||
child = getNodeByShortcutKey(node.stopLoss, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.takeProfit, searchingKey)
|
||||
child = getNodeByShortcutKey(node.takeProfit, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -267,7 +267,7 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Close Stage': {
|
||||
let child
|
||||
child = getShortcutKey(node.closeExecution, searchingKey)
|
||||
child = getNodeByShortcutKey(node.closeExecution, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -279,19 +279,19 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Strategy': {
|
||||
let child
|
||||
child = getShortcutKey(node.triggerStage, searchingKey)
|
||||
child = getNodeByShortcutKey(node.triggerStage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.openStage, searchingKey)
|
||||
child = getNodeByShortcutKey(node.openStage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.manageStage, searchingKey)
|
||||
child = getNodeByShortcutKey(node.manageStage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.closeStage, searchingKey)
|
||||
child = getNodeByShortcutKey(node.closeStage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -338,23 +338,23 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Parameters': {
|
||||
let child
|
||||
child = getShortcutKey(node.baseAsset, searchingKey)
|
||||
child = getNodeByShortcutKey(node.baseAsset, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.timeRange, searchingKey)
|
||||
child = getNodeByShortcutKey(node.timeRange, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.timePeriod, searchingKey)
|
||||
child = getNodeByShortcutKey(node.timePeriod, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.slippage, searchingKey)
|
||||
child = getNodeByShortcutKey(node.slippage, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.feeStructure, searchingKey)
|
||||
child = getNodeByShortcutKey(node.feeStructure, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -366,12 +366,12 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Trading System': {
|
||||
let child
|
||||
child = getShortcutKey(node.parameters, searchingKey)
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
for (let m = 0; m < node.strategies.length; m++) {
|
||||
child = getShortcutKey(node.strategies[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.strategies[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -385,7 +385,7 @@ function newShortcutKeys () {
|
||||
case 'Personal Data': {
|
||||
let child
|
||||
for (let m = 0; m < node.exchangeAccounts.length; m++) {
|
||||
child = getShortcutKey(node.exchangeAccounts[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.exchangeAccounts[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -399,13 +399,13 @@ function newShortcutKeys () {
|
||||
case 'Exchange Account': {
|
||||
let child
|
||||
for (let m = 0; m < node.assets.length; m++) {
|
||||
child = getShortcutKey(node.assets[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.assets[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
for (let m = 0; m < node.keys.length; m++) {
|
||||
child = getShortcutKey(node.keys[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.keys[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -433,7 +433,7 @@ function newShortcutKeys () {
|
||||
case 'Layer Manager': {
|
||||
let child
|
||||
for (let m = 0; m < node.layers.length; m++) {
|
||||
child = getShortcutKey(node.layers[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.layers[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -454,7 +454,7 @@ function newShortcutKeys () {
|
||||
case 'Task Manager': {
|
||||
let child
|
||||
for (let m = 0; m < node.tasks.length; m++) {
|
||||
child = getShortcutKey(node.tasks[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.tasks[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -467,7 +467,7 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Task': {
|
||||
let child
|
||||
child = getShortcutKey(node.bot, searchingKey)
|
||||
child = getNodeByShortcutKey(node.bot, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -480,7 +480,7 @@ function newShortcutKeys () {
|
||||
case 'Sensor': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getShortcutKey(node.processes[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.processes[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -494,7 +494,7 @@ function newShortcutKeys () {
|
||||
case 'Indicator': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getShortcutKey(node.processes[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.processes[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -508,7 +508,7 @@ function newShortcutKeys () {
|
||||
case 'Trading Engine': {
|
||||
let child
|
||||
for (let m = 0; m < node.processes.length; m++) {
|
||||
child = getShortcutKey(node.processes[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.processes[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -521,7 +521,7 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Process': {
|
||||
let child
|
||||
child = getShortcutKey(node.session, searchingKey)
|
||||
child = getNodeByShortcutKey(node.session, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -534,11 +534,11 @@ function newShortcutKeys () {
|
||||
|
||||
case 'Backtesting Session': {
|
||||
let child
|
||||
child = getShortcutKey(node.parameters, searchingKey)
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.layerManager, searchingKey)
|
||||
child = getNodeByShortcutKey(node.layerManager, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -551,11 +551,11 @@ function newShortcutKeys () {
|
||||
|
||||
case 'Live Trading Session': {
|
||||
let child
|
||||
child = getShortcutKey(node.parameters, searchingKey)
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.layerManager, searchingKey)
|
||||
child = getNodeByShortcutKey(node.layerManager, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -568,11 +568,11 @@ function newShortcutKeys () {
|
||||
|
||||
case 'Fordward Testing Session': {
|
||||
let child
|
||||
child = getShortcutKey(node.parameters, searchingKey)
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.layerManager, searchingKey)
|
||||
child = getNodeByShortcutKey(node.layerManager, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -585,11 +585,11 @@ function newShortcutKeys () {
|
||||
|
||||
case 'Paper Trading Session': {
|
||||
let child
|
||||
child = getShortcutKey(node.parameters, searchingKey)
|
||||
child = getNodeByShortcutKey(node.parameters, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.layerManager, searchingKey)
|
||||
child = getNodeByShortcutKey(node.layerManager, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -603,7 +603,7 @@ function newShortcutKeys () {
|
||||
case 'Network Node': {
|
||||
let child
|
||||
for (let m = 0; m < node.taskManagers.length; m++) {
|
||||
child = getShortcutKey(node.taskManagers[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.taskManagers[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -617,7 +617,7 @@ function newShortcutKeys () {
|
||||
case 'Network': {
|
||||
let child
|
||||
for (let m = 0; m < node.networkNodes.length; m++) {
|
||||
child = getShortcutKey(node.networkNodes[m], searchingKey)
|
||||
child = getNodeByShortcutKey(node.networkNodes[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
@@ -630,15 +630,15 @@ function newShortcutKeys () {
|
||||
}
|
||||
case 'Definition': {
|
||||
let child
|
||||
child = getShortcutKey(node.tradingSystem, searchingKey)
|
||||
child = getNodeByShortcutKey(node.tradingSystem, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.personalData, searchingKey)
|
||||
child = getNodeByShortcutKey(node.personalData, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getShortcutKey(node.network, searchingKey)
|
||||
child = getNodeByShortcutKey(node.network, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ function newWorkspace () {
|
||||
container: undefined,
|
||||
enabled: false,
|
||||
nodeChildren: undefined,
|
||||
getNodeByShortcutKey: getNodeByShortcutKey,
|
||||
getAllTradingEngines: getAllTradingEngines,
|
||||
stopAllRunningTasks: stopAllRunningTasks,
|
||||
onMenuItemClick: onMenuItemClick,
|
||||
@@ -49,6 +50,9 @@ function newWorkspace () {
|
||||
let functionLibraryWorkspaceNodes = newStringifyNode()
|
||||
let functionLibraryTaskFunctions = newTaskFunctions()
|
||||
let functionLibrarySessionFunctions = newSessionFunctions()
|
||||
let functionLibraryShortcutKeys = newShortcutKeys()
|
||||
let functionLibraryOnFocus = newOnFocus()
|
||||
|
||||
thisObject.nodeChildren = newNodeChildren()
|
||||
|
||||
return thisObject
|
||||
@@ -188,6 +192,28 @@ function newWorkspace () {
|
||||
return tradingEngines
|
||||
}
|
||||
|
||||
function getNodeByShortcutKey (searchingKey) {
|
||||
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
|
||||
let rootNode = thisObject.workspaceNode.rootNodes[i]
|
||||
if (rootNode.type === 'Definition') {
|
||||
let definition = rootNode
|
||||
let node = functionLibraryShortcutKeys.getNodeByShortcutKey(searchingKey)
|
||||
if (node !== undefined) { return node }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getNodeThatIsOnFocus () {
|
||||
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
|
||||
let rootNode = thisObject.workspaceNode.rootNodes[i]
|
||||
if (rootNode.type === 'Definition') {
|
||||
let definition = rootNode
|
||||
let node = functionLibraryOnFocus.getNodeThatIsOnFocus()
|
||||
if (node !== undefined) { return node }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function spawn (nodeText, point) {
|
||||
try {
|
||||
point = canvas.floatingSpace.container.frame.unframeThisPoint(point)
|
||||
|
||||
Reference in new issue
Block a user