diff --git a/flows_nodered_kraken.json b/flows_nodered_kraken.json index f86a775..df9e30e 100644 --- a/flows_nodered_kraken.json +++ b/flows_nodered_kraken.json @@ -3525,8 +3525,8 @@ "t": "set", "p": "coinBalance", "pt": "flow", - "to": "$number(payload.balance)", - "tot": "jsonata" + "to": "payload.balance", + "tot": "msg" } ], "action": "", @@ -3566,11 +3566,11 @@ "type": "switch", "z": "791ce869.901798", "name": "", - "property": "payload.XXMR", + "property": "payload.balance", "propertyType": "msg", "rules": [ { - "t": "nempty" + "t": "nnull" }, { "t": "else" @@ -3586,7 +3586,8 @@ "ff1341d.17ca8c" ], [ - "5da3780b.7006f8" + "5da3780b.7006f8", + "55955668.3c3f18" ] ] }, @@ -3969,7 +3970,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 multiplier = flow.get('multiplier');\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 // when selling I am going with the floor, that is a bit more conservative; \n // buying fast selling slow\n let jumpSize = Math.floor(Math.abs(lastExecPrice-bidPrice)/delta);\n flow.set(\"orderVolume\",jumpSize * multiplier);\n} else if (askPricelastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=bidPrice;\n // when selling I am going with the floor, that is a bit more conservative; \n // buying fast selling slow\n let jumpSize = Math.floor(Math.abs(lastExecPrice-bidPrice)/delta);\n flow.set(\"orderVolume\",jumpSize * multiplier);\n} else if (askPricelastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=bidPrice;\n // when selling I am going with the floor, that is a bit more conservative; \n // buying fast selling slow\n let jumpSize = Math.floor(Math.abs(lastExecPrice-bidPrice)/delta);\n flow.set(\"orderVolume\",jumpSize * multiplier);\n} else if (askPricelastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=bidPrice;\n // when selling I am going with the floor, that is a bit more conservative; \n // buying fast selling slow\n let jumpSize = Math.floor(Math.abs(lastExecPrice-bidPrice)/delta);\n flow.set(\"orderVolume\",jumpSize * multiplier);\n} else if (askPrice