Created
March 14, 2022 07:22
-
-
Save makerstorage/26913ec5f8c696df0c029a8ab0a57319 to your computer and use it in GitHub Desktop.
Node-red Simple arbitraj example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": "e3a35ffd88d77596", | |
| "type": "tab", | |
| "label": "Arbitraj", | |
| "disabled": false, | |
| "info": "", | |
| "env": [] | |
| }, | |
| { | |
| "id": "eddf4d5c9c03cf0a", | |
| "type": "inject", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "props": [ | |
| { | |
| "p": "payload" | |
| }, | |
| { | |
| "p": "topic", | |
| "vt": "str" | |
| } | |
| ], | |
| "repeat": "", | |
| "crontab": "", | |
| "once": false, | |
| "onceDelay": 0.1, | |
| "topic": "", | |
| "payload": "BTCUSDT", | |
| "payloadType": "str", | |
| "x": 120, | |
| "y": 100, | |
| "wires": [ | |
| [ | |
| "9351ab703b4a09c6", | |
| "b5561411015cfa53", | |
| "2fc9d6d2f48533d8" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "e76ffd82304bd66f", | |
| "type": "http request", | |
| "z": "e3a35ffd88d77596", | |
| "name": "btcTurk ticker", | |
| "method": "GET", | |
| "ret": "obj", | |
| "paytoqs": "ignore", | |
| "url": "https://api.btcturk.com/api/v2/orderbook?pairSymbol={{{query}}}", | |
| "tls": "", | |
| "persist": false, | |
| "proxy": "", | |
| "authType": "", | |
| "senderr": false, | |
| "x": 520, | |
| "y": 100, | |
| "wires": [ | |
| [ | |
| "b6c7f16be4f76079", | |
| "52748a10db5a42bc" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "b6c7f16be4f76079", | |
| "type": "debug", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "active": false, | |
| "tosidebar": true, | |
| "console": false, | |
| "tostatus": false, | |
| "complete": "payload.data.asks[0][0]", | |
| "targetType": "msg", | |
| "statusVal": "", | |
| "statusType": "auto", | |
| "x": 760, | |
| "y": 40, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "9351ab703b4a09c6", | |
| "type": "change", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "rules": [ | |
| { | |
| "t": "set", | |
| "p": "query", | |
| "pt": "msg", | |
| "to": "payload", | |
| "tot": "msg" | |
| } | |
| ], | |
| "action": "", | |
| "property": "", | |
| "from": "", | |
| "to": "", | |
| "reg": false, | |
| "x": 300, | |
| "y": 100, | |
| "wires": [ | |
| [ | |
| "e76ffd82304bd66f" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "f72e7370ce97717a", | |
| "type": "comment", | |
| "z": "e3a35ffd88d77596", | |
| "name": "arbitraj", | |
| "info": "", | |
| "x": 100, | |
| "y": 60, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "dc8f5790889b6895", | |
| "type": "http request", | |
| "z": "e3a35ffd88d77596", | |
| "name": "binance ticker", | |
| "method": "GET", | |
| "ret": "obj", | |
| "paytoqs": "ignore", | |
| "url": "https://api.binance.com/api/v3/depth?symbol={{{query}}}", | |
| "tls": "", | |
| "persist": false, | |
| "proxy": "", | |
| "authType": "", | |
| "senderr": false, | |
| "x": 520, | |
| "y": 180, | |
| "wires": [ | |
| [ | |
| "340eb4773623fc81", | |
| "462a142796fd5110" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "340eb4773623fc81", | |
| "type": "debug", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "active": true, | |
| "tosidebar": true, | |
| "console": false, | |
| "tostatus": false, | |
| "complete": "payload.bids[0][0]", | |
| "targetType": "msg", | |
| "statusVal": "", | |
| "statusType": "auto", | |
| "x": 760, | |
| "y": 160, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "b5561411015cfa53", | |
| "type": "change", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "rules": [ | |
| { | |
| "t": "set", | |
| "p": "query", | |
| "pt": "msg", | |
| "to": "payload", | |
| "tot": "msg" | |
| } | |
| ], | |
| "action": "", | |
| "property": "", | |
| "from": "", | |
| "to": "", | |
| "reg": false, | |
| "x": 300, | |
| "y": 180, | |
| "wires": [ | |
| [ | |
| "dc8f5790889b6895" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "1c659fc3a1cc8f3c", | |
| "type": "function", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "func": "\nvar btcTurk = parseFloat(flow.get(\"btcTurk\"));\nvar binance = parseFloat(flow.get(\"binance\"));\n\n\nvar fark = Math.abs(btcTurk-binance);\n\nmsg.payload = fark; \n\n\nreturn msg;", | |
| "outputs": 1, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 540, | |
| "y": 280, | |
| "wires": [ | |
| [ | |
| "69d7dbf1cb9fcd44" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "52748a10db5a42bc", | |
| "type": "change", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "rules": [ | |
| { | |
| "t": "set", | |
| "p": "btcTurk", | |
| "pt": "flow", | |
| "to": "payload.data.asks[0][0]", | |
| "tot": "msg" | |
| } | |
| ], | |
| "action": "", | |
| "property": "", | |
| "from": "", | |
| "to": "", | |
| "reg": false, | |
| "x": 760, | |
| "y": 80, | |
| "wires": [ | |
| [] | |
| ] | |
| }, | |
| { | |
| "id": "462a142796fd5110", | |
| "type": "change", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "rules": [ | |
| { | |
| "t": "set", | |
| "p": "binance", | |
| "pt": "flow", | |
| "to": "payload.asks[0][0]", | |
| "tot": "msg" | |
| } | |
| ], | |
| "action": "", | |
| "property": "", | |
| "from": "", | |
| "to": "", | |
| "reg": false, | |
| "x": 740, | |
| "y": 200, | |
| "wires": [ | |
| [] | |
| ] | |
| }, | |
| { | |
| "id": "69d7dbf1cb9fcd44", | |
| "type": "debug", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "active": false, | |
| "tosidebar": true, | |
| "console": false, | |
| "tostatus": false, | |
| "complete": "false", | |
| "statusVal": "", | |
| "statusType": "auto", | |
| "x": 750, | |
| "y": 280, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "2fc9d6d2f48533d8", | |
| "type": "delay", | |
| "z": "e3a35ffd88d77596", | |
| "name": "", | |
| "pauseType": "delay", | |
| "timeout": "2", | |
| "timeoutUnits": "seconds", | |
| "rate": "1", | |
| "nbRateUnits": "1", | |
| "rateUnits": "second", | |
| "randomFirst": "1", | |
| "randomLast": "5", | |
| "randomUnits": "seconds", | |
| "drop": false, | |
| "allowrate": false, | |
| "outputs": 1, | |
| "x": 310, | |
| "y": 280, | |
| "wires": [ | |
| [ | |
| "1c659fc3a1cc8f3c" | |
| ] | |
| ] | |
| } | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment