diff --git a/flows_nodered_kraken.json b/flows_nodered_kraken.json index 41a4f0b..f90e71f 100644 --- a/flows_nodered_kraken.json +++ b/flows_nodered_kraken.json @@ -41,6 +41,13 @@ "disabled": true, "info": "" }, + { + "id": "28401549.718faa", + "type": "tab", + "label": "OLD_LiveDynHF-NG-ETC", + "disabled": true, + "info": "" + }, { "id": "791ce869.901798", "type": "tab", @@ -49,7 +56,7 @@ "info": "" }, { - "id": "28401549.718faa", + "id": "9d5ee7b4.680b68", "type": "tab", "label": "LiveDynHF-NG-ETC", "disabled": false, @@ -3962,7 +3969,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=Number(msg.payload[pair].a[0]);\nlet bidPrice=Number(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=jumpPrice=bidPrice;\n} else if (askPricelastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=jumpPrice=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": 1510, + "y": 500, + "wires": [ + [ + "8374a5e.dd27158" + ] + ] + }, + { + "id": "c9ba5205.88dd", + "type": "function", + "z": "9d5ee7b4.680b68", + "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": 940, + "wires": [ + [ + "136a83d.4f24f7c" + ] + ] + }, + { + "id": "2de87b96.c112f4", + "type": "function", + "z": "9d5ee7b4.680b68", + "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": 1040, + "wires": [ + [ + "ab118944.75cdb8" + ] + ] + }, + { + "id": "d1958e6b.be162", + "type": "catch", + "z": "9d5ee7b4.680b68", + "name": "", + "scope": null, + "uncaught": false, + "x": 220, + "y": 980, + "wires": [ + [ + "4ab5af6e.45938" + ] + ] + }, + { + "id": "4ab5af6e.45938", + "type": "debug", + "z": "9d5ee7b4.680b68", + "name": "ERROR!!!", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "x": 470, + "y": 980, + "wires": [] + }, + { + "id": "1f388909.129287", + "type": "switch", + "z": "9d5ee7b4.680b68", + "name": "Max-Price?", + "property": "price", + "propertyType": "msg", + "rules": [ + { + "t": "lte", + "v": "maxBuyPrice", + "vt": "flow" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 1750, + "y": 760, + "wires": [ + [ + "feffd99e.9c4998" + ], + [ + "80b6f5aa.f73b18" + ] + ] + }, + { + "id": "80b6f5aa.f73b18", + "type": "debug", + "z": "9d5ee7b4.680b68", + "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": "88c1202f.1565b", + "type": "function", + "z": "9d5ee7b4.680b68", + "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": [ + [ + "5095f8b2.73bc58" + ] + ] + }, + { + "id": "5095f8b2.73bc58", + "type": "debug", + "z": "9d5ee7b4.680b68", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "x": 310, + "y": 280, + "wires": [] + }, + { + "id": "4fd99ba.4d5c964", + "type": "inject", + "z": "9d5ee7b4.680b68", + "name": "", + "topic": "", + "payload": "", + "payloadType": "date", + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "x": 100, + "y": 280, + "wires": [ + [ + "88c1202f.1565b" + ] + ] + }, + { + "id": "fae4335d.1e0c9", + "type": "debug", + "z": "9d5ee7b4.680b68", + "name": "", + "active": false, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "x": 900, + "y": 440, + "wires": [] + }, + { + "id": "5f9cf343.aab02c", + "type": "debug", + "z": "9d5ee7b4.680b68", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "x": 770, + "y": 40, + "wires": [] + }, + { + "id": "6cebf48.658d20c", + "type": "change", + "z": "9d5ee7b4.680b68", + "name": "", + "rules": [ + { + "t": "set", + "p": "pair", + "pt": "flow", + "to": "payload.pair", + "tot": "msg" + }, + { + "t": "set", + "p": "currency", + "pt": "flow", + "to": "payload.currency", + "tot": "msg" + }, + { + "t": "set", + "p": "maxVolume", + "pt": "flow", + "to": "payload.maxVolume", + "tot": "msg" + }, + { + "t": "set", + "p": "minVolume", + "pt": "flow", + "to": "payload.minVolume", + "tot": "msg" + }, + { + "t": "set", + "p": "multiplier", + "pt": "flow", + "to": "payload.multiplier", + "tot": "msg" + }, + { + "t": "set", + "p": "maxBuyPrice", + "pt": "flow", + "to": "payload.maxBuyPrice", + "tot": "msg" + }, + { + "t": "set", + "p": "delta", + "pt": "flow", + "to": "payload.delta", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 200, + "y": 500, + "wires": [ + [ + "e1ac406a.aa733" + ] + ] + }, + { + "id": "34c1cd9d.422812", + "type": "function", + "z": "9d5ee7b4.680b68", + "name": "Recompute CoinBalance (sell)", + "func": "let coinBalance = flow.get('coinBalance');\nlet delta = flow.get('delta');\nlet multiplier = Number(flow.get('multiplier'));\nlet sellPrice = flow.get(\"bidPrice\");\n\ncoinBalance -= multiplier;\n\nflow.set('coinBalance',coinBalance);\nflow.set('lastExecPrice',sellPrice,\"file\");\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 2770, + "y": 560, + "wires": [ + [] + ] + }, + { + "id": "1514778.cfca489", + "type": "function", + "z": "9d5ee7b4.680b68", + "name": "Recompute CoinBalance (buy)", + "func": "let coinBalance = flow.get('coinBalance');\nlet delta = flow.get('delta');\nlet multiplier = Number(flow.get('multiplier'));\nlet buyPrice = flow.get(\"askPrice\"); \n\ncoinBalance += multiplier;\n\nflow.set('coinBalance',coinBalance);\nflow.set('lastExecPrice',buyPrice,\"file\");\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 2770, + "y": 720, + "wires": [ + [] + ] + }, + { + "id": "b872c91c.0c3fa8", + "type": "add-standard-order", + "z": "9d5ee7b4.680b68", + "kraken": "e64b38bb.529c88", + "name": "Send Buy Order ", + "x": 2460, + "y": 720, + "wires": [ + [ + "777fb372.39187c", + "1514778.cfca489" + ], + [ + "67c1ceeb.b4bb" + ] + ] + }, + { + "id": "476c2bfd.588624", + "type": "function", + "z": "9d5ee7b4.680b68", + "name": "dynamic Currency To fix Key", + "func": "let currency=flow.get('currency');\n\nif (msg.payload[currency]!==undefined) {\n msg.payload.balance=msg.payload[currency];\n}\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 820, + "y": 80, + "wires": [ + [ + "23264922.5c11c6", + "ce6ea663.120788" + ] + ] + }, + { + "id": "ce6ea663.120788", + "type": "debug", + "z": "9d5ee7b4.680b68", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "x": 1060, + "y": 40, + "wires": [] } ] \ No newline at end of file