From 1d222c51718f3903da6b215506ecd0359f58a6ae Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Sun, 5 Jan 2020 19:16:13 -0600 Subject: [PATCH] Create project --- .gitignore | 1 + README.md | 7 + flows_nodered_kraken.json | 396 +++++++++++++++++++++++++++++++++ flows_nodered_kraken_cred.json | 6 + package.json | 12 + 5 files changed, 422 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 flows_nodered_kraken.json create mode 100644 flows_nodered_kraken_cred.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c9c01a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.backup \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..00a7a3d --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +KrakenTrading +============= + +### About + +This is your project's README.md file. It helps users understand what your +project does, how to use it and anything else they may need to know. \ No newline at end of file diff --git a/flows_nodered_kraken.json b/flows_nodered_kraken.json new file mode 100644 index 0000000..7ea545b --- /dev/null +++ b/flows_nodered_kraken.json @@ -0,0 +1,396 @@ +[ + { + "id": "6d543cb4.ed3084", + "type": "tab", + "label": "Kraken Trading", + "disabled": false, + "info": "" + }, + { + "id": "42702610.230028", + "type": "kraken-credentials", + "z": "", + "name": "DFLT" + }, + { + "id": "c0dcbde0.3085", + "type": "sqlitedb", + "z": "", + "db": "KrakenTradingDB.sqlite3", + "mode": "RW" + }, + { + "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": 560, + "y": 240, + "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": "715c2949.e70048", + "type": "get-ticker-information", + "z": "6d543cb4.ed3084", + "name": "", + "x": 370, + "y": 680, + "wires": [ + [ + "3362bc86.263034", + "49e9037c.b0234c" + ], + [ + "c776c3e9.448ed" + ] + ] + }, + { + "id": "926454.4996abb", + "type": "inject", + "z": "6d543cb4.ed3084", + "name": "", + "topic": "", + "payload": "{\"pair\":\"XETHZUSD\"}", + "payloadType": "json", + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "x": 140, + "y": 680, + "wires": [ + [ + "715c2949.e70048" + ] + ] + }, + { + "id": "3362bc86.263034", + "type": "debug", + "z": "6d543cb4.ed3084", + "name": "Kraken TickerData", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 600, + "y": 640, + "wires": [] + }, + { + "id": "c776c3e9.448ed", + "type": "debug", + "z": "6d543cb4.ed3084", + "name": "Kraken TickerData ERROR", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 630, + "y": 740, + "wires": [] + }, + { + "id": "49e9037c.b0234c", + "type": "function", + "z": "6d543cb4.ed3084", + "name": "compute order", + "func": "let askPrice = msg.payload.XETHZUSD.a[0];\nlet volume2Buy = 50/askPrice; // How much Etheream to buy for 50 USD?\nnode.log(\"Ask Price \", 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": 620, + "y": 700, + "wires": [ + [ + "c4999094.47952", + "ca762b6c.7d98f8" + ] + ] + }, + { + "id": "c4999094.47952", + "type": "add-standard-order", + "z": "6d543cb4.ed3084", + "kraken": "42702610.230028", + "name": "", + "x": 840, + "y": 700, + "wires": [ + [ + "5baa6fae.59cb2" + ], + [ + "27f87d72.6fa302" + ] + ] + }, + { + "id": "5baa6fae.59cb2", + "type": "debug", + "z": "6d543cb4.ed3084", + "name": "Kraken OrderFeedback Success", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 1100, + "y": 680, + "wires": [] + }, + { + "id": "27f87d72.6fa302", + "type": "debug", + "z": "6d543cb4.ed3084", + "name": "Kraken OrderFeedback ERROR", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 1110, + "y": 720, + "wires": [] + }, + { + "id": "ca762b6c.7d98f8", + "type": "debug", + "z": "6d543cb4.ed3084", + "name": "Kraken - OrderInfos", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 900, + "y": 620, + "wires": [] + }, + { + "id": "ee195c7.d088ba", + "type": "get-ticker-information", + "z": "6d543cb4.ed3084", + "name": "", + "x": 330, + "y": 880, + "wires": [ + [ + "4f94e60f.4d3838" + ], + [ + "f163b077.931ff" + ] + ] + }, + { + "id": "eeb36454.5abdf8", + "type": "inject", + "z": "6d543cb4.ed3084", + "name": "", + "topic": "", + "payload": "{\"pair\":\"XETCZUSD\"}", + "payloadType": "json", + "repeat": "60", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "x": 140, + "y": 880, + "wires": [ + [ + "ee195c7.d088ba" + ] + ] + }, + { + "id": "a669c08c.d0185", + "type": "sqlite", + "z": "6d543cb4.ed3084", + "mydb": "c0dcbde0.3085", + "sqlquery": "msg.topic", + "sql": "", + "name": "", + "x": 830, + "y": 820, + "wires": [ + [] + ] + }, + { + "id": "4f94e60f.4d3838", + "type": "function", + "z": "6d543cb4.ed3084", + "name": "Build Insert Statement", + "func": "msg.topic=\"Insert into KrakenQuotes (Symbol,Data) values ('XETCZUSD','\" + JSON.stringify(msg.payload.XETCZUSD) + \"');\"\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 540, + "y": 860, + "wires": [ + [ + "853572da.0b0bf", + "a669c08c.d0185" + ] + ] + }, + { + "id": "853572da.0b0bf", + "type": "debug", + "z": "6d543cb4.ed3084", + "name": "", + "active": false, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "x": 770, + "y": 880, + "wires": [] + }, + { + "id": "f163b077.931ff", + "type": "debug", + "z": "6d543cb4.ed3084", + "name": "Error getting Kraken Quote", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "true", + "targetType": "full", + "x": 570, + "y": 920, + "wires": [] + } +] \ No newline at end of file diff --git a/flows_nodered_kraken_cred.json b/flows_nodered_kraken_cred.json new file mode 100644 index 0000000..cb8ac01 --- /dev/null +++ b/flows_nodered_kraken_cred.json @@ -0,0 +1,6 @@ +{ + "42702610.230028": { + "apiKey": "SOOOJ7OhVCOpJE4DAWz8v5B25UpdYya9buF8DFAkHzmUab5E9i0PlEPh", + "apiSecret": "UytAbgU8ty3n5a+JhaoIlcfh8zM4OBGY6PCC+Cfg2NI4waVzM52BBp9qmmyczrTDQpeha8q3nHeE/p7wNWKiVA==" + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..d3b1669 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "KrakenTrading", + "description": "A Node-RED Project", + "version": "0.0.1", + "dependencies": {}, + "node-red": { + "settings": { + "flowFile": "flows_nodered_kraken.json", + "credentialsFile": "flows_nodered_kraken_cred.json" + } + } +} \ No newline at end of file