From 2164d63e969417ef3a2c5dbee6b00a2691401b26 Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Tue, 5 Jan 2021 14:26:00 -0600 Subject: [PATCH] Misc small fixes --- flows_nodered_kraken.json | 988 +------------------------------------- 1 file changed, 6 insertions(+), 982 deletions(-) diff --git a/flows_nodered_kraken.json b/flows_nodered_kraken.json index 3c6bdd1..f9353bd 100644 --- a/flows_nodered_kraken.json +++ b/flows_nodered_kraken.json @@ -27,13 +27,6 @@ "disabled": false, "info": "" }, - { - "id": "75185287.024c5c", - "type": "tab", - "label": "LiveDynHF-ETC", - "disabled": true, - "info": "" - }, { "id": "5b601c88.f89c94", "type": "tab", @@ -1264,975 +1257,6 @@ ] ] }, - { - "id": "46878dfa.5580c4", - "type": "inject", - "z": "75185287.024c5c", - "name": "", - "topic": "", - "payload": "{\"pair\":\"XETCZUSD\"}", - "payloadType": "json", - "repeat": "60", - "crontab": "", - "once": true, - "onceDelay": 0.1, - "x": 140, - "y": 420, - "wires": [ - [ - "8aa9f7f4.8c2668" - ] - ] - }, - { - "id": "8aa9f7f4.8c2668", - "type": "switch", - "z": "75185287.024c5c", - "name": "isInitialized?", - "property": "$flowContext('isInitialized')", - "propertyType": "jsonata", - "rules": [ - { - "t": "true" - }, - { - "t": "else" - } - ], - "checkall": "true", - "repair": false, - "outputs": 2, - "x": 390, - "y": 420, - "wires": [ - [ - "69f7851b.bdc39c" - ], - [ - "a99eaee4.37596", - "21e109cf.713d56" - ] - ] - }, - { - "id": "55be5c77.c5aa24", - "type": "change", - "z": "75185287.024c5c", - "name": "", - "rules": [ - { - "t": "set", - "p": "isInitialized", - "pt": "flow", - "to": "true", - "tot": "bool" - }, - { - "t": "set", - "p": "coinBalance", - "pt": "flow", - "to": "$number(payload.XETC)", - "tot": "jsonata" - }, - { - "t": "set", - "p": "maxVolume", - "pt": "flow", - "to": "2000", - "tot": "num" - }, - { - "t": "set", - "p": "minVolume", - "pt": "flow", - "to": "0", - "tot": "num" - }, - { - "t": "set", - "p": "delta", - "pt": "flow", - "to": "0.1", - "tot": "num" - }, - { - "t": "set", - "p": "multiplier", - "pt": "flow", - "to": "50", - "tot": "num" - }, - { - "t": "set", - "p": "maxBuyPrice", - "pt": "flow", - "to": "7.5", - "tot": "num" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1180, - "y": 80, - "wires": [ - [ - "89274697.2db938" - ] - ] - }, - { - "id": "a99eaee4.37596", - "type": "get-account-balance", - "z": "75185287.024c5c", - "kraken": "e64b38bb.529c88", - "name": "", - "x": 600, - "y": 120, - "wires": [ - [ - "df0504ca.1b5e68" - ], - [ - "d35cbfeb.3029", - "aceb2bba.402fa8" - ] - ] - }, - { - "id": "df0504ca.1b5e68", - "type": "switch", - "z": "75185287.024c5c", - "name": "", - "property": "payload.XETC", - "propertyType": "msg", - "rules": [ - { - "t": "nempty" - }, - { - "t": "else" - } - ], - "checkall": "true", - "repair": false, - "outputs": 2, - "x": 770, - "y": 80, - "wires": [ - [ - "55be5c77.c5aa24" - ], - [ - "957f8c8.49e1d7" - ] - ] - }, - { - "id": "957f8c8.49e1d7", - "type": "change", - "z": "75185287.024c5c", - "name": "", - "rules": [ - { - "t": "set", - "p": "payload.XETC", - "pt": "msg", - "to": "0", - "tot": "num" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 940, - "y": 120, - "wires": [ - [ - "55be5c77.c5aa24" - ] - ] - }, - { - "id": "89274697.2db938", - "type": "debug", - "z": "75185287.024c5c", - "name": "Initialized.", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "x": 1370, - "y": 80, - "wires": [] - }, - { - "id": "d35cbfeb.3029", - "type": "delay", - "z": "75185287.024c5c", - "name": "", - "pauseType": "delay", - "timeout": "5", - "timeoutUnits": "seconds", - "rate": "1", - "nbRateUnits": "1", - "rateUnits": "second", - "randomFirst": "1", - "randomLast": "5", - "randomUnits": "seconds", - "drop": false, - "x": 600, - "y": 180, - "wires": [ - [ - "a99eaee4.37596" - ] - ] - }, - { - "id": "aceb2bba.402fa8", - "type": "debug", - "z": "75185287.024c5c", - "name": "Error getting Balance - retrying infinite.", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "true", - "targetType": "full", - "x": 940, - "y": 160, - "wires": [] - }, - { - "id": "8072675b.525b98", - "type": "inject", - "z": "75185287.024c5c", - "name": "", - "topic": "", - "payload": "", - "payloadType": "date", - "repeat": "", - "crontab": "", - "once": false, - "onceDelay": 0.1, - "x": 100, - "y": 80, - "wires": [ - [ - "6a2a4e21.ffc76" - ] - ] - }, - { - "id": "6a2a4e21.ffc76", - "type": "change", - "z": "75185287.024c5c", - "name": "", - "rules": [ - { - "t": "delete", - "p": "isInitialized", - "pt": "flow" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 340, - "y": 80, - "wires": [ - [] - ] - }, - { - "id": "af95f15e.3e857", - "type": "comment", - "z": "75185287.024c5c", - "name": "Force-Uninitialize (Reload settings)", - "info": "", - "x": 160, - "y": 40, - "wires": [] - }, - { - "id": "69f7851b.bdc39c", - "type": "get-ticker-information", - "z": "75185287.024c5c", - "name": "", - "x": 630, - "y": 640, - "wires": [ - [ - "24025058.051ac", - "d302c81.a8b0a38" - ], - [ - "a886187f.3229b8" - ] - ] - }, - { - "id": "a886187f.3229b8", - "type": "debug", - "z": "75185287.024c5c", - "name": "Ticker Retrieval Error", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "x": 890, - "y": 760, - "wires": [] - }, - { - "id": "1d957ceb.c40d73", - "type": "switch", - "z": "75185287.024c5c", - "name": "Action", - "property": "action", - "propertyType": "msg", - "rules": [ - { - "t": "eq", - "v": "sell", - "vt": "str" - }, - { - "t": "eq", - "v": "buy", - "vt": "str" - }, - { - "t": "else" - } - ], - "checkall": "true", - "repair": false, - "outputs": 3, - "x": 1090, - "y": 680, - "wires": [ - [ - "b29e9a85.c0f208", - "8cbd61c3.9ab1" - ], - [ - "cc5f7279.5f84b", - "453909e5.5bb148" - ], - [ - "fec3d33d.0d4ea" - ] - ] - }, - { - "id": "3e2250ef.405d5", - "type": "debug", - "z": "75185287.024c5c", - "name": "gt (sell)", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "true", - "targetType": "full", - "x": 1740, - "y": 520, - "wires": [] - }, - { - "id": "800f6d47.f091b", - "type": "debug", - "z": "75185287.024c5c", - "name": "lt (buy)", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "true", - "targetType": "full", - "x": 1720, - "y": 880, - "wires": [] - }, - { - "id": "7028479c.9a21b8", - "type": "debug", - "z": "75185287.024c5c", - "name": "small diff (nothing)", - "active": false, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "true", - "targetType": "full", - "x": 1800, - "y": 1060, - "wires": [] - }, - { - "id": "b29e9a85.c0f208", - "type": "switch", - "z": "75185287.024c5c", - "name": "MinVolReached?", - "property": "$flowContext('coinBalance') - $flowContext('multiplier') ", - "propertyType": "jsonata", - "rules": [ - { - "t": "gte", - "v": "minVolume", - "vt": "flow" - }, - { - "t": "else" - } - ], - "checkall": "true", - "repair": false, - "outputs": 2, - "x": 1510, - "y": 620, - "wires": [ - [ - "277a2c5d.908d54" - ], - [ - "be56cf39.afb4e" - ] - ] - }, - { - "id": "24a6d9cc.fc2466", - "type": "debug", - "z": "75185287.024c5c", - "name": "Not Selling, min Volume reached.", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "x": 2000, - "y": 640, - "wires": [] - }, - { - "id": "52986989.ee2b38", - "type": "debug", - "z": "75185287.024c5c", - "name": "SELLING!", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "x": 1990, - "y": 560, - "wires": [] - }, - { - "id": "a25291a9.35e33", - "type": "debug", - "z": "75185287.024c5c", - "name": "BUYING!", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "x": 2190, - "y": 720, - "wires": [] - }, - { - "id": "cc5f7279.5f84b", - "type": "switch", - "z": "75185287.024c5c", - "name": "MaxVolReached?", - "property": "$flowContext('coinBalance') + $flowContext('multiplier')", - "propertyType": "jsonata", - "rules": [ - { - "t": "lte", - "v": "maxVolume", - "vt": "flow" - }, - { - "t": "else" - } - ], - "checkall": "true", - "repair": false, - "outputs": 2, - "x": 1510, - "y": 800, - "wires": [ - [ - "7b6cd46f.5195fc" - ], - [ - "b770e41f.d48838" - ] - ] - }, - { - "id": "c3c9ab5b.c535c8", - "type": "debug", - "z": "75185287.024c5c", - "name": "Not buying, max Volume reached.", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "x": 2170, - "y": 840, - "wires": [] - }, - { - "id": "24025058.051ac", - "type": "function", - "z": "75185287.024c5c", - "name": "Determine Action", - "func": "//$number(payload.XETCZUSD.a[0]) - $number($flowContext('lastExecPrice'))\n\nconst delta=flow.get('delta'); // how much price move to take action?\nlet askPrice=msg.payload.XETCZUSD.a[0];\nlet bidPrice=msg.payload.XETCZUSD.b[0];\nlet lastExecPrice=flow.get('lastExecPrice',\"file\");\nif (lastExecPrice === undefined) { \n lastExecPrice=askPrice; \n flow.set('lastExecPrice',lastExecPrice,\"file\");\n}\n\nmsg.lastExecPrice=lastExecPrice;\n\nif (bidPrice>lastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=bidPrice;\n} else if (askPrice{\n msg.flowContext[\"(File)\"+ele]=flow.get(ele,\"file\");\n});\nflow.keys().forEach(ele=>{\n msg.flowContext[\"(Mem)\"+ele]=flow.get(ele);\n});\n\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 1550, - "y": 520, - "wires": [ - [ - "3e2250ef.405d5" - ] - ] - }, - { - "id": "453909e5.5bb148", - "type": "function", - "z": "75185287.024c5c", - "name": "FlowContext2msg", - "func": "msg.flowContext = {};\nflow.keys(\"file\").forEach(ele=>{\n msg.flowContext[\"(File)\"+ele]=flow.get(ele,\"file\");\n});\nflow.keys().forEach(ele=>{\n msg.flowContext[\"(Mem)\"+ele]=flow.get(ele);\n});\n\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 1510, - "y": 880, - "wires": [ - [ - "800f6d47.f091b" - ] - ] - }, - { - "id": "fec3d33d.0d4ea", - "type": "function", - "z": "75185287.024c5c", - "name": "FlowContext2msg", - "func": "msg.flowContext = {};\nflow.keys(\"file\").forEach(ele=>{\n msg.flowContext[\"(File)\"+ele]=flow.get(ele,\"file\");\n});\nflow.keys().forEach(ele=>{\n msg.flowContext[\"(Mem)\"+ele]=flow.get(ele);\n});\n\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 1550, - "y": 1060, - "wires": [ - [ - "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": [] - }, - { - "id": "d733ac19.e8d0b", - "type": "function", - "z": "75185287.024c5c", - "name": "FlowContext2msg", - "func": "msg.flowContext = {};\nflow.keys(\"file\").forEach(ele=>{\n msg.flowContext[\"(File)\"+ele]=flow.get(ele,\"file\");\n});\nflow.keys().forEach(ele=>{\n msg.flowContext[\"(Mem)\"+ele]=flow.get(ele);\n});\n\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 190, - "y": 340, - "wires": [ - [ - "4c0a2364.56ae8c" - ] - ] - }, - { - "id": "4c0a2364.56ae8c", - "type": "debug", - "z": "75185287.024c5c", - "name": "", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "true", - "targetType": "full", - "x": 310, - "y": 280, - "wires": [] - }, - { - "id": "53c12592.9e0d9c", - "type": "inject", - "z": "75185287.024c5c", - "name": "", - "topic": "", - "payload": "", - "payloadType": "date", - "repeat": "", - "crontab": "", - "once": false, - "onceDelay": 0.1, - "x": 100, - "y": 280, - "wires": [ - [ - "d733ac19.e8d0b" - ] - ] - }, { "id": "b270d15c.78ca6", "type": "get-ticker-information", @@ -4938,7 +3962,7 @@ "type": "function", "z": "791ce869.901798", "name": "Determine Action", - "func": "//$number(payload.XMRUSD.a[0]) - $number($flowContext('lastExecPrice'))\n\nconst delta=flow.get('delta'); // how much price move to take action?\nlet pair=flow.get(\"pair\");\nlet askPrice=msg.payload[pair].a[0];\nlet bidPrice=msg.payload[pair].b[0];\nflow.set(\"askPrice\",Number(askPrice));\nflow.set(\"bidPrice\",Number(bidPrice));\n\nlet lastExecPrice=flow.get('lastExecPrice',\"file\");\n\nif (lastExecPrice === undefined) { \n lastExecPrice=askPrice; \n flow.set('lastExecPrice',Number(lastExecPrice),\"file\");\n}\n\nmsg.lastExecPrice=lastExecPrice;\n\nif (bidPrice>lastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=bidPrice;\n} else if (askPricelastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=bidPrice;\n} else if (askPricelastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=bidPrice;\n} else if (askPricelastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=bidPrice;\n} else if (askPrice