Consider maximum buy price
This commit is contained in:
@@ -1333,6 +1333,13 @@
|
|||||||
"pt": "flow",
|
"pt": "flow",
|
||||||
"to": "10",
|
"to": "10",
|
||||||
"tot": "num"
|
"tot": "num"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"t": "set",
|
||||||
|
"p": "maxBuyPrice",
|
||||||
|
"pt": "flow",
|
||||||
|
"to": "6",
|
||||||
|
"tot": "num"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"action": "",
|
"action": "",
|
||||||
@@ -1627,7 +1634,7 @@
|
|||||||
"tostatus": false,
|
"tostatus": false,
|
||||||
"complete": "true",
|
"complete": "true",
|
||||||
"targetType": "full",
|
"targetType": "full",
|
||||||
"x": 1760,
|
"x": 1720,
|
||||||
"y": 880,
|
"y": 880,
|
||||||
"wires": []
|
"wires": []
|
||||||
},
|
},
|
||||||
@@ -1650,7 +1657,7 @@
|
|||||||
"id": "b29e9a85.c0f208",
|
"id": "b29e9a85.c0f208",
|
||||||
"type": "switch",
|
"type": "switch",
|
||||||
"z": "75185287.024c5c",
|
"z": "75185287.024c5c",
|
||||||
"name": "MinReached?",
|
"name": "MinVolReached?",
|
||||||
"property": "$flowContext('coinBalance') - $flowContext('multiplier') ",
|
"property": "$flowContext('coinBalance') - $flowContext('multiplier') ",
|
||||||
"propertyType": "jsonata",
|
"propertyType": "jsonata",
|
||||||
"rules": [
|
"rules": [
|
||||||
@@ -1666,8 +1673,8 @@
|
|||||||
"checkall": "true",
|
"checkall": "true",
|
||||||
"repair": false,
|
"repair": false,
|
||||||
"outputs": 2,
|
"outputs": 2,
|
||||||
"x": 1540,
|
"x": 1510,
|
||||||
"y": 640,
|
"y": 620,
|
||||||
"wires": [
|
"wires": [
|
||||||
[
|
[
|
||||||
"277a2c5d.908d54"
|
"277a2c5d.908d54"
|
||||||
@@ -1703,7 +1710,7 @@
|
|||||||
"tostatus": false,
|
"tostatus": false,
|
||||||
"complete": "payload",
|
"complete": "payload",
|
||||||
"targetType": "msg",
|
"targetType": "msg",
|
||||||
"x": 2010,
|
"x": 1990,
|
||||||
"y": 560,
|
"y": 560,
|
||||||
"wires": []
|
"wires": []
|
||||||
},
|
},
|
||||||
@@ -1718,15 +1725,15 @@
|
|||||||
"tostatus": false,
|
"tostatus": false,
|
||||||
"complete": "payload",
|
"complete": "payload",
|
||||||
"targetType": "msg",
|
"targetType": "msg",
|
||||||
"x": 2010,
|
"x": 2190,
|
||||||
"y": 760,
|
"y": 720,
|
||||||
"wires": []
|
"wires": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "cc5f7279.5f84b",
|
"id": "cc5f7279.5f84b",
|
||||||
"type": "switch",
|
"type": "switch",
|
||||||
"z": "75185287.024c5c",
|
"z": "75185287.024c5c",
|
||||||
"name": "MaxReached?",
|
"name": "MaxVolReached?",
|
||||||
"property": "$flowContext('coinBalance') + $flowContext('multiplier')",
|
"property": "$flowContext('coinBalance') + $flowContext('multiplier')",
|
||||||
"propertyType": "jsonata",
|
"propertyType": "jsonata",
|
||||||
"rules": [
|
"rules": [
|
||||||
@@ -1742,11 +1749,11 @@
|
|||||||
"checkall": "true",
|
"checkall": "true",
|
||||||
"repair": false,
|
"repair": false,
|
||||||
"outputs": 2,
|
"outputs": 2,
|
||||||
"x": 1540,
|
"x": 1510,
|
||||||
"y": 800,
|
"y": 800,
|
||||||
"wires": [
|
"wires": [
|
||||||
[
|
[
|
||||||
"6e38bc3.4922b44"
|
"7b6cd46f.5195fc"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"b770e41f.d48838"
|
"b770e41f.d48838"
|
||||||
@@ -1764,8 +1771,8 @@
|
|||||||
"tostatus": false,
|
"tostatus": false,
|
||||||
"complete": "payload",
|
"complete": "payload",
|
||||||
"targetType": "msg",
|
"targetType": "msg",
|
||||||
"x": 2030,
|
"x": 2170,
|
||||||
"y": 820,
|
"y": 840,
|
||||||
"wires": []
|
"wires": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1792,8 +1799,8 @@
|
|||||||
"func": "let coinBalance = flow.get('coinBalance');\nlet delta = flow.get('delta');\nlet multiplier = Number(flow.get('multiplier'));\nlet buyPrice = Number(msg.payload.XETCZUSD.a[0]);\n\ncoinBalance += multiplier;\n\nflow.set('coinBalance',coinBalance);\nflow.set('lastExecPrice',buyPrice);\n\nmsg.payload={\n\tpair : 'XETCZUSD',\n\ttype : 'buy',\n\tordertype : 'market',\n\tvolume : multiplier\n};\n\nreturn msg;",
|
"func": "let coinBalance = flow.get('coinBalance');\nlet delta = flow.get('delta');\nlet multiplier = Number(flow.get('multiplier'));\nlet buyPrice = Number(msg.payload.XETCZUSD.a[0]);\n\ncoinBalance += multiplier;\n\nflow.set('coinBalance',coinBalance);\nflow.set('lastExecPrice',buyPrice);\n\nmsg.payload={\n\tpair : 'XETCZUSD',\n\ttype : 'buy',\n\tordertype : 'market',\n\tvolume : multiplier\n};\n\nreturn msg;",
|
||||||
"outputs": 1,
|
"outputs": 1,
|
||||||
"noerr": 0,
|
"noerr": 0,
|
||||||
"x": 1740,
|
"x": 1940,
|
||||||
"y": 760,
|
"y": 720,
|
||||||
"wires": [
|
"wires": [
|
||||||
[
|
[
|
||||||
"a25291a9.35e33",
|
"a25291a9.35e33",
|
||||||
@@ -1825,8 +1832,8 @@
|
|||||||
"func": "let buyPrice = Number(msg.payload.XETCZUSD.a[0]);\n\nflow.set('lastExecPrice',buyPrice);\n\nreturn msg;",
|
"func": "let buyPrice = Number(msg.payload.XETCZUSD.a[0]);\n\nflow.set('lastExecPrice',buyPrice);\n\nreturn msg;",
|
||||||
"outputs": 1,
|
"outputs": 1,
|
||||||
"noerr": 0,
|
"noerr": 0,
|
||||||
"x": 1750,
|
"x": 1890,
|
||||||
"y": 820,
|
"y": 840,
|
||||||
"wires": [
|
"wires": [
|
||||||
[
|
[
|
||||||
"c3c9ab5b.c535c8"
|
"c3c9ab5b.c535c8"
|
||||||
@@ -2047,7 +2054,7 @@
|
|||||||
"func": "msg.flowContext = {};\nflow.keys().forEach(ele=>{\n msg.flowContext[ele]=flow.get(ele);\n});\nreturn msg;",
|
"func": "msg.flowContext = {};\nflow.keys().forEach(ele=>{\n msg.flowContext[ele]=flow.get(ele);\n});\nreturn msg;",
|
||||||
"outputs": 1,
|
"outputs": 1,
|
||||||
"noerr": 0,
|
"noerr": 0,
|
||||||
"x": 1550,
|
"x": 1510,
|
||||||
"y": 880,
|
"y": 880,
|
||||||
"wires": [
|
"wires": [
|
||||||
[
|
[
|
||||||
@@ -2070,5 +2077,81 @@
|
|||||||
"7028479c.9a21b8"
|
"7028479c.9a21b8"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "94f8bbad.d99128",
|
||||||
|
"type": "catch",
|
||||||
|
"z": "75185287.024c5c",
|
||||||
|
"name": "",
|
||||||
|
"scope": null,
|
||||||
|
"uncaught": false,
|
||||||
|
"x": 220,
|
||||||
|
"y": 980,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"d9b37b29.d69da8"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "d9b37b29.d69da8",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "75185287.024c5c",
|
||||||
|
"name": "ERROR!!!",
|
||||||
|
"active": true,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": false,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "true",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 470,
|
||||||
|
"y": 980,
|
||||||
|
"wires": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "7b6cd46f.5195fc",
|
||||||
|
"type": "switch",
|
||||||
|
"z": "75185287.024c5c",
|
||||||
|
"name": "Max-Price?",
|
||||||
|
"property": "$number(payload.XETCZUSD.a[0])",
|
||||||
|
"propertyType": "jsonata",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"t": "lte",
|
||||||
|
"v": "maxBuyPrice",
|
||||||
|
"vt": "flow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"t": "else"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"checkall": "true",
|
||||||
|
"repair": false,
|
||||||
|
"outputs": 2,
|
||||||
|
"x": 1750,
|
||||||
|
"y": 760,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"6e38bc3.4922b44"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"27f3e6cf.40475a"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "27f3e6cf.40475a",
|
||||||
|
"type": "debug",
|
||||||
|
"z": "75185287.024c5c",
|
||||||
|
"name": "Not Buying, max buy price exceeded.",
|
||||||
|
"active": true,
|
||||||
|
"tosidebar": true,
|
||||||
|
"console": true,
|
||||||
|
"tostatus": false,
|
||||||
|
"complete": "true",
|
||||||
|
"targetType": "full",
|
||||||
|
"x": 2040,
|
||||||
|
"y": 780,
|
||||||
|
"wires": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user