some fixes on the autotrading side

This commit is contained in:
Joe Tretter
2020-01-08 21:47:16 -06:00
parent d948005541
commit ac2bc957bf

View File

@@ -1318,7 +1318,7 @@
"p": "minVolume", "p": "minVolume",
"pt": "flow", "pt": "flow",
"to": "0", "to": "0",
"tot": "str" "tot": "num"
}, },
{ {
"t": "set", "t": "set",
@@ -1331,8 +1331,8 @@
"t": "set", "t": "set",
"p": "multiplier", "p": "multiplier",
"pt": "flow", "pt": "flow",
"to": "8", "to": "1",
"tot": "str" "tot": "num"
} }
], ],
"action": "", "action": "",
@@ -1464,14 +1464,14 @@
"id": "aceb2bba.402fa8", "id": "aceb2bba.402fa8",
"type": "debug", "type": "debug",
"z": "75185287.024c5c", "z": "75185287.024c5c",
"name": "Error getting Balance", "name": "Error getting Balance - retrying infinite.",
"active": true, "active": true,
"tosidebar": true, "tosidebar": true,
"console": true, "console": true,
"tostatus": false, "tostatus": false,
"complete": "true", "complete": "true",
"targetType": "full", "targetType": "full",
"x": 890, "x": 940,
"y": 160, "y": 160,
"wires": [] "wires": []
}, },
@@ -1522,9 +1522,9 @@
"id": "af95f15e.3e857", "id": "af95f15e.3e857",
"type": "comment", "type": "comment",
"z": "75185287.024c5c", "z": "75185287.024c5c",
"name": "Force-Uninitialize.", "name": "Force-Uninitialize (Reload settings)",
"info": "", "info": "",
"x": 110, "x": 160,
"y": 40, "y": 40,
"wires": [] "wires": []
}, },
@@ -1651,11 +1651,11 @@
"type": "switch", "type": "switch",
"z": "75185287.024c5c", "z": "75185287.024c5c",
"name": "MinReached?", "name": "MinReached?",
"property": "currVolume", "property": " $flowContext('multiplier') - $flowContext('coinBalance') ",
"propertyType": "flow", "propertyType": "jsonata",
"rules": [ "rules": [
{ {
"t": "gt", "t": "gte",
"v": "minVolume", "v": "minVolume",
"vt": "flow" "vt": "flow"
}, },
@@ -1727,11 +1727,11 @@
"type": "switch", "type": "switch",
"z": "75185287.024c5c", "z": "75185287.024c5c",
"name": "MaxReached?", "name": "MaxReached?",
"property": "currVolume", "property": "$flowContext('coinBalance') + $flowContext('multiplier')",
"propertyType": "flow", "propertyType": "jsonata",
"rules": [ "rules": [
{ {
"t": "lt", "t": "lte",
"v": "maxVolume", "v": "maxVolume",
"vt": "flow" "vt": "flow"
}, },
@@ -1789,14 +1789,13 @@
"type": "function", "type": "function",
"z": "75185287.024c5c", "z": "75185287.024c5c",
"name": "BuyAction", "name": "BuyAction",
"func": "let coinBalance = flow.get('coinBalance');\nlet delta = flow.get('delta');\n\nlet buyPrice = Number(msg.payload.XETCZUSD.a[0]);\n\ncoinBalance += 1;\n\nflow.set('coinBalance',coinBalance);\nflow.set('lastExecPrice',buyPrice);\n\nmsg.payload={\n\tpair : 'XETCZUSD',\n\ttype : 'buy',\n\tordertype : 'market',\n\tvolume : Number(flow.get('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": 1740,
"y": 740, "y": 740,
"wires": [ "wires": [
[ [
"b13db4ef.65a078",
"a25291a9.35e33", "a25291a9.35e33",
"ab124111.85da6" "ab124111.85da6"
] ]
@@ -1839,49 +1838,18 @@
"type": "function", "type": "function",
"z": "75185287.024c5c", "z": "75185287.024c5c",
"name": "SellAction", "name": "SellAction",
"func": "let coinBalance = flow.get('coinBalance');\nlet delta = flow.get('delta');\n\nlet sellPrice = Number(msg.payload.XETCZUSD.b[0]);\n\ncoinBalance -= 1;\n\nflow.set('coinBalance',coinBalance);\nflow.set('lastExecPrice',sellPrice);\n\nmsg.payload={\n\tpair : 'XETCZUSD',\n\ttype : 'sell',\n\tordertype : 'market',\n\tvolume : Number(flow.get('multiplier'))\n};\n\nreturn msg;", "func": "let coinBalance = flow.get('coinBalance');\nlet delta = flow.get('delta');\nlet multiplier = Number(flow.get('multiplier'));\n\nlet sellPrice = Number(msg.payload.XETCZUSD.b[0]);\n\ncoinBalance -= multiplier;\n\nflow.set('coinBalance',coinBalance);\nflow.set('lastExecPrice',sellPrice);\n\nmsg.payload={\n\tpair : 'XETCZUSD',\n\ttype : 'sell',\n\tordertype : 'market',\n\tvolume : multiplier\n};\n\nreturn msg;",
"outputs": 1, "outputs": 1,
"noerr": 0, "noerr": 0,
"x": 1760, "x": 1760,
"y": 560, "y": 560,
"wires": [ "wires": [
[ [
"39e6c932.e87666",
"52986989.ee2b38", "52986989.ee2b38",
"ab124111.85da6" "ab124111.85da6"
] ]
] ]
}, },
{
"id": "39e6c932.e87666",
"type": "debug",
"z": "75185287.024c5c",
"name": "DUMMY SELL",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 1960,
"y": 560,
"wires": []
},
{
"id": "b13db4ef.65a078",
"type": "debug",
"z": "75185287.024c5c",
"name": "DUMMY BUY",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 1990,
"y": 740,
"wires": []
},
{ {
"id": "f637b849.b81cd8", "id": "f637b849.b81cd8",
"type": "sqlite", "type": "sqlite",
@@ -1952,7 +1920,6 @@
"id": "ab124111.85da6", "id": "ab124111.85da6",
"type": "add-standard-order", "type": "add-standard-order",
"z": "75185287.024c5c", "z": "75185287.024c5c",
"d": true,
"kraken": "e64b38bb.529c88", "kraken": "e64b38bb.529c88",
"name": "", "name": "",
"x": 2410, "x": 2410,
@@ -2010,5 +1977,50 @@
"x": 640, "x": 640,
"y": 220, "y": 220,
"wires": [] "wires": []
},
{
"id": "bfbcb0ec.f032c",
"type": "debug",
"z": "75185287.024c5c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "$flowContext('coinBalance') / $flowContext('multiplier')",
"targetType": "jsonata",
"x": 300,
"y": 200,
"wires": []
},
{
"id": "8b60b992.9a6258",
"type": "inject",
"z": "75185287.024c5c",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 110,
"y": 200,
"wires": [
[
"bfbcb0ec.f032c"
]
]
},
{
"id": "72e50f95.f5f68",
"type": "comment",
"z": "75185287.024c5c",
"name": "Get current \"standardized balance\"",
"info": "",
"x": 160,
"y": 140,
"wires": []
} }
] ]