From 5a3f0f9bd5a2f4d3dd8b9a7c29555e5a494a2d9f Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Tue, 7 Jan 2020 19:20:08 -0600 Subject: [PATCH] Added the weekly Ethereum Trade and added price queries. --- flows_nodered_kraken.json | 707 ++++++++++++++++++++++++--------- flows_nodered_kraken_cred.json | 4 + 2 files changed, 529 insertions(+), 182 deletions(-) diff --git a/flows_nodered_kraken.json b/flows_nodered_kraken.json index 488e853..d55bed6 100644 --- a/flows_nodered_kraken.json +++ b/flows_nodered_kraken.json @@ -2,7 +2,14 @@ { "id": "6d543cb4.ed3084", "type": "tab", - "label": "Kraken Trading", + "label": "Dynamic HF Trading", + "disabled": false, + "info": "" + }, + { + "id": "5d834238.9ad88c", + "type": "tab", + "label": "Weekly Ethereum buy", "disabled": false, "info": "" }, @@ -13,6 +20,13 @@ "disabled": false, "info": "" }, + { + "id": "e67f589a.f8d378", + "type": "tab", + "label": "Misc", + "disabled": false, + "info": "" + }, { "id": "af98615f.cf9ce", "type": "subflow", @@ -66,135 +80,10 @@ "mode": "RWC" }, { - "id": "b8c92875.131c58", - "type": "get-server-time", - "z": "6d543cb4.ed3084", - "name": "", - "x": 310, - "y": 240, - "wires": [ - [ - "63e56415.01466c" - ], - [ - "1637654a.83336b" - ] - ] - }, - { - "id": "d11eed52.456ac", - "type": "inject", - "z": "6d543cb4.ed3084", - "name": "", - "topic": "", - "payload": "", - "payloadType": "date", - "repeat": "", - "crontab": "", - "once": false, - "onceDelay": 0.1, - "x": 120, - "y": 240, - "wires": [ - [ - "b8c92875.131c58" - ] - ] - }, - { - "id": "63e56415.01466c", - "type": "debug", - "z": "6d543cb4.ed3084", - "name": "", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "false", - "x": 550, - "y": 220, - "wires": [] - }, - { - "id": "1637654a.83336b", - "type": "debug", - "z": "6d543cb4.ed3084", - "name": "", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "false", - "x": 560, - "y": 320, - "wires": [] - }, - { - "id": "978bdbc5.1c3508", - "type": "get-account-balance", - "z": "6d543cb4.ed3084", - "kraken": "42702610.230028", - "name": "", - "x": 340, - "y": 480, - "wires": [ - [ - "5fd28dbd.7d1504" - ], - [ - "8d9b208b.f68a7" - ] - ] - }, - { - "id": "5fd28dbd.7d1504", - "type": "debug", - "z": "6d543cb4.ed3084", - "name": "Kraken-Balance", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "x": 600, - "y": 460, - "wires": [] - }, - { - "id": "8d9b208b.f68a7", - "type": "debug", - "z": "6d543cb4.ed3084", - "name": "Kraken Balance ERROR", - "active": true, - "tosidebar": true, - "console": true, - "tostatus": false, - "complete": "payload", - "targetType": "msg", - "x": 630, - "y": 540, - "wires": [] - }, - { - "id": "586b4d14.eca6f4", - "type": "inject", - "z": "6d543cb4.ed3084", - "name": "", - "topic": "", - "payload": "", - "payloadType": "date", - "repeat": "18000", - "crontab": "", - "once": false, - "onceDelay": 0.1, - "x": 130, - "y": 480, - "wires": [ - [ - "978bdbc5.1c3508" - ] - ] + "id": "e64b38bb.529c88", + "type": "kraken-credentials", + "z": "", + "name": "DFLT" }, { "id": "a669c08c.d0185", @@ -204,8 +93,8 @@ "sqlquery": "msg.topic", "sql": "", "name": "", - "x": 890, - "y": 720, + "x": 1010, + "y": 120, "wires": [ [] ] @@ -218,8 +107,8 @@ "func": "msg.topic=\"Insert into KrakenQuotes (Symbol,Data) values ('XETCZUSD','\" + JSON.stringify(msg.payload.XETCZUSD) + \"');\"\nreturn msg;", "outputs": 1, "noerr": 0, - "x": 600, - "y": 760, + "x": 720, + "y": 160, "wires": [ [ "853572da.0b0bf", @@ -238,8 +127,8 @@ "tostatus": false, "complete": "true", "targetType": "full", - "x": 830, - "y": 780, + "x": 950, + "y": 180, "wires": [] }, { @@ -247,8 +136,8 @@ "type": "get-ticker-information", "z": "6d543cb4.ed3084", "name": "", - "x": 350, - "y": 1040, + "x": 470, + "y": 440, "wires": [ [ "8f27b1c3.3277e", @@ -272,8 +161,8 @@ "crontab": "", "once": false, "onceDelay": 0.1, - "x": 160, - "y": 1040, + "x": 280, + "y": 440, "wires": [ [ "b6c88df3.41573" @@ -290,8 +179,8 @@ "console": false, "tostatus": false, "complete": "false", - "x": 590, - "y": 880, + "x": 710, + "y": 280, "wires": [] }, { @@ -305,8 +194,8 @@ "tostatus": false, "complete": "payload", "targetType": "msg", - "x": 510, - "y": 1100, + "x": 630, + "y": 500, "wires": [] }, { @@ -327,8 +216,8 @@ "checkall": "true", "repair": false, "outputs": 2, - "x": 560, - "y": 1020, + "x": 680, + "y": 420, "wires": [ [ "b14715f9.da01b8" @@ -407,8 +296,8 @@ "from": "", "to": "", "reg": false, - "x": 840, - "y": 960, + "x": 960, + "y": 360, "wires": [ [] ] @@ -438,8 +327,8 @@ "checkall": "true", "repair": false, "outputs": 3, - "x": 1050, - "y": 1100, + "x": 1170, + "y": 500, "wires": [ [ "8fc8be9f.e3552", @@ -465,8 +354,8 @@ "tostatus": false, "complete": "true", "targetType": "full", - "x": 1400, - "y": 1020, + "x": 1520, + "y": 420, "wires": [] }, { @@ -480,8 +369,8 @@ "tostatus": false, "complete": "true", "targetType": "full", - "x": 1400, - "y": 1100, + "x": 1520, + "y": 500, "wires": [] }, { @@ -495,8 +384,8 @@ "tostatus": false, "complete": "payload", "targetType": "msg", - "x": 1370, - "y": 1240, + "x": 1490, + "y": 640, "wires": [] }, { @@ -510,8 +399,8 @@ "tostatus": false, "complete": "{\"le\":$flowContext('lastExecPrice'),\"cp\":payload.XETCZUSD.a[0] }", "targetType": "jsonata", - "x": 760, - "y": 1180, + "x": 880, + "y": 580, "wires": [] }, { @@ -526,8 +415,8 @@ "crontab": "", "once": false, "onceDelay": 0.1, - "x": 660, - "y": 940, + "x": 780, + "y": 340, "wires": [ [ "b14715f9.da01b8" @@ -554,8 +443,8 @@ "checkall": "true", "repair": false, "outputs": 2, - "x": 1500, - "y": 1060, + "x": 1620, + "y": 460, "wires": [ [ "db4dcb29.89cd38", @@ -578,8 +467,8 @@ "tostatus": false, "complete": "payload", "targetType": "msg", - "x": 1800, - "y": 1100, + "x": 1920, + "y": 500, "wires": [] }, { @@ -593,8 +482,8 @@ "tostatus": false, "complete": "payload", "targetType": "msg", - "x": 1730, - "y": 1020, + "x": 1850, + "y": 420, "wires": [] }, { @@ -608,8 +497,8 @@ "tostatus": false, "complete": "payload", "targetType": "msg", - "x": 1710, - "y": 1180, + "x": 1830, + "y": 580, "wires": [] }, { @@ -632,8 +521,8 @@ "checkall": "true", "repair": false, "outputs": 2, - "x": 1500, - "y": 1200, + "x": 1620, + "y": 600, "wires": [ [ "9ff35104.7db0d", @@ -656,8 +545,8 @@ "tostatus": false, "complete": "payload", "targetType": "msg", - "x": 1790, - "y": 1260, + "x": 1910, + "y": 660, "wires": [] }, { @@ -668,8 +557,8 @@ "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');\n\nmsg.lastExecPrice=lastExecPrice;\n\nif (bidPrice>lastExecPrice+delta) {\n msg.action=\"sell\";\n msg.price=bidPrice;\n} else if (askPrice Volume : \", volume2Buy );\n\nmsg.payload={\n\tpair : 'XETHZUSD',\n\ttype : 'buy',\n\tordertype : 'limit',\n\tprice : askPrice,\n\tvolume : volume2Buy\n};\n\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 690, + "y": 240, + "wires": [ + [ + "aa87fc3a.968ee", + "9ffc04e0.96e1d8" + ] + ] + }, + { + "id": "aa87fc3a.968ee", + "type": "add-standard-order", + "z": "5d834238.9ad88c", + "kraken": "e64b38bb.529c88", + "name": "", + "x": 900, + "y": 240, + "wires": [ + [ + "847e754.3bc3b88" + ], + [ + "e7a0fa8a.d9c008" + ] + ] + }, + { + "id": "847e754.3bc3b88", + "type": "debug", + "z": "5d834238.9ad88c", + "name": "Order Execution Success", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "true", + "targetType": "full", + "x": 1140, + "y": 220, + "wires": [] + }, + { + "id": "e7a0fa8a.d9c008", + "type": "debug", + "z": "5d834238.9ad88c", + "name": "Order Execution Error", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "true", + "targetType": "full", + "x": 1140, + "y": 260, + "wires": [] + }, + { + "id": "9ffc04e0.96e1d8", + "type": "debug", + "z": "5d834238.9ad88c", + "name": "Computed Order", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 920, + "y": 140, + "wires": [] + }, + { + "id": "8272f674.8a7c98", + "type": "get-server-time", + "z": "e67f589a.f8d378", + "name": "", + "x": 330, + "y": 120, + "wires": [ + [ + "288d7d82.889772" + ], + [ + "49ef2217.4037bc" + ] + ] + }, + { + "id": "6a276dbb.1b4804", + "type": "inject", + "z": "e67f589a.f8d378", + "name": "", + "topic": "", + "payload": "", + "payloadType": "date", + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "x": 140, + "y": 120, + "wires": [ + [ + "8272f674.8a7c98" + ] + ] + }, + { + "id": "288d7d82.889772", + "type": "debug", + "z": "e67f589a.f8d378", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "x": 570, + "y": 100, + "wires": [] + }, + { + "id": "49ef2217.4037bc", + "type": "debug", + "z": "e67f589a.f8d378", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "x": 580, + "y": 200, + "wires": [] + }, + { + "id": "d23ac766.df15d8", + "type": "get-account-balance", + "z": "e67f589a.f8d378", + "kraken": "42702610.230028", + "name": "", + "x": 360, + "y": 360, + "wires": [ + [ + "e69da0fa.a973" + ], + [ + "4139462.65bf8b8" + ] + ] + }, + { + "id": "e69da0fa.a973", + "type": "debug", + "z": "e67f589a.f8d378", + "name": "Kraken-Balance", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 620, + "y": 340, + "wires": [] + }, + { + "id": "4139462.65bf8b8", + "type": "debug", + "z": "e67f589a.f8d378", + "name": "Kraken Balance ERROR", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 650, + "y": 420, + "wires": [] + }, + { + "id": "105e61e6.8fea0e", + "type": "inject", + "z": "e67f589a.f8d378", + "name": "", + "topic": "", + "payload": "", + "payloadType": "date", + "repeat": "86400", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "x": 150, + "y": 360, + "wires": [ + [ + "d23ac766.df15d8" + ] + ] } ] \ No newline at end of file diff --git a/flows_nodered_kraken_cred.json b/flows_nodered_kraken_cred.json index cb8ac01..05b4a8e 100644 --- a/flows_nodered_kraken_cred.json +++ b/flows_nodered_kraken_cred.json @@ -2,5 +2,9 @@ "42702610.230028": { "apiKey": "SOOOJ7OhVCOpJE4DAWz8v5B25UpdYya9buF8DFAkHzmUab5E9i0PlEPh", "apiSecret": "UytAbgU8ty3n5a+JhaoIlcfh8zM4OBGY6PCC+Cfg2NI4waVzM52BBp9qmmyczrTDQpeha8q3nHeE/p7wNWKiVA==" + }, + "e64b38bb.529c88": { + "apiKey": "SOOOJ7OhVCOpJE4DAWz8v5B25UpdYya9buF8DFAkHzmUab5E9i0PlEPh", + "apiSecret": "UytAbgU8ty3n5a+JhaoIlcfh8zM4OBGY6PCC+Cfg2NI4waVzM52BBp9qmmyczrTDQpeha8q3nHeE/p7wNWKiVA==" } } \ No newline at end of file