node-red-contrib-korbit
v1.0.1
Published
Node-RED node for korbit
Downloads
4
Maintainers
Readme
node-red-contrib-korbit
Node-RED node for korbit
Install
To install the stable version use the Menu - Manage palette - Install
option and search for node-red-contrib-korbit, or run the following
command in your Node-RED user directory, typically ~/.node-red
npm install node-red-contrib-oauth2
npm install node-red-contrib-korbit
Wrapper korbit API
- https://apidocs.korbit.co.kr/
- For authentication, use the oauth2 modules(node-red-contrib-oauth2) downloaded from the palette.
Sample parameters
msg.accessToken = context.global.access_token;
return msg;
Sample Result
{"ada":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977020},"aergo":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977023},"algo":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977026},"bat":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977030},"bch":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977033},"bcha":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977036},"bnb":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977039},"bsv":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977042},"btc":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977045},"dai":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977051},"dot":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977057},"eos":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977063},"etc":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977066},"eth":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977069},"fet":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977072},"fil":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977075},"krw":{"available":"100000","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"1.00","avg_price_updated_at":1617848643590},"link":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977084},"ltc":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977090},"med":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977093},"mkr":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977096},"omg":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977099},"qtum":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977105},"trx":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977116},"uni":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977119},"usdc":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977122},"wbtc":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977125},"xlm":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977128},"xrp":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977134},"xtz":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977137},"yfi":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977139},"zil":{"available":"0","trade_in_use":"0","withdrawal_in_use":"0","avg_price":"0","avg_price_updated_at":1617847977145}}
Sample flows
[{"id":"5ac37a35.e65bd4","type":"oauth2","z":"56254b54.9f4f14","name":"korbit oauth2","container":"payload","access_token_url":"https://api.korbit.co.kr/v1/oauth2/access_token","grant_type":"client_credentials","username":"","password":"","client_id":"","client_secret":"","scope":"","headers":{},"x":270,"y":320,"wires":[["ad002852.29d788"]]},{"id":"2296f90.632c908","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":380,"wires":[["6051d37.b957c2c"]]},{"id":"6051d37.b957c2c","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":380,"wires":[["8ea35ccf.2a6a6"]]},{"id":"8ea35ccf.2a6a6","type":"korbit","z":"56254b54.9f4f14","name":"user/balances","api":"user/balances","currency_pair":"","x":440,"y":380,"wires":[["312312eb.fcb73e"]]},{"id":"7ad57f3f.29482","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":320,"wires":[["5ac37a35.e65bd4"]]},{"id":"c5c92f7b.51177","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":320,"wires":[]},{"id":"ad002852.29d788","type":"function","z":"56254b54.9f4f14","name":"","func":"context.global.access_token = msg.payload.oauth2Response.body.access_token;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":320,"wires":[["c5c92f7b.51177"]]},{"id":"5fb1314.eaa48d","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":420,"wires":[["7538e972.06ea58"]]},{"id":"7538e972.06ea58","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":420,"wires":[["41de3641.45f428"]]},{"id":"41de3641.45f428","type":"korbit","z":"56254b54.9f4f14","name":"user/accounts","api":"user/accounts","currency_pair":"","x":440,"y":420,"wires":[["a368457f.7d22f8"]]},{"id":"312312eb.fcb73e","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":380,"wires":[]},{"id":"a368457f.7d22f8","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":420,"wires":[]},{"id":"e462bbd0.d2e9c8","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":460,"wires":[["2b6f7649.1ca33a"]]},{"id":"2b6f7649.1ca33a","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\nmsg.currency_pair = 'all';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":460,"wires":[["b3ceeef9.d2bae"]]},{"id":"b3ceeef9.d2bae","type":"korbit","z":"56254b54.9f4f14","name":"user/volume","api":"user/volume","currency_pair":"","x":430,"y":460,"wires":[["70fc37d1.4ac9f8"]]},{"id":"70fc37d1.4ac9f8","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":460,"wires":[]},{"id":"b2b04992.0c1488","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":500,"wires":[["4adfc45e.1569ac"]]},{"id":"4adfc45e.1569ac","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\nmsg.currency_pair = 'btc_krw';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":500,"wires":[["134e75d7.2fb9fa"]]},{"id":"134e75d7.2fb9fa","type":"korbit","z":"56254b54.9f4f14","name":"user/orders/open","api":"user/orders/open","currency_pair":"btc_krw","x":450,"y":500,"wires":[["1c9e2b1.af35fd5"]]},{"id":"1c9e2b1.af35fd5","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":500,"wires":[]},{"id":"ef6e9cae.48455","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":540,"wires":[["b41e39b.445bec8"]]},{"id":"b41e39b.445bec8","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\nmsg.currency_pair = 'btc_krw';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":540,"wires":[["e349ae0e.e9fca"]]},{"id":"e349ae0e.e9fca","type":"korbit","z":"56254b54.9f4f14","name":"user/orders","api":"user/orders","currency_pair":"btc_krw","x":430,"y":540,"wires":[["35d6cbbc.880d54"]]},{"id":"35d6cbbc.880d54","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":540,"wires":[]},{"id":"7c15c72f.f4e908","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":580,"wires":[["34dc12be.d685ae"]]},{"id":"34dc12be.d685ae","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\nmsg.currency_pair = 'btc_krw';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":580,"wires":[["4f6f820f.fd785c"]]},{"id":"4f6f820f.fd785c","type":"korbit","z":"56254b54.9f4f14","name":"user/transactions","api":"user/transactions","currency_pair":"btc_krw","x":450,"y":580,"wires":[["67ac0fc.8c603f"]]},{"id":"67ac0fc.8c603f","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":580,"wires":[]},{"id":"9883edd.a14c11","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":620,"wires":[["9114d459.6860c8"]]},{"id":"9114d459.6860c8","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\nmsg.params = {};\n// 입출금 내역을 확인하고자 하는 거래 통화. KRW, BTC, ETH, ETC, XRP 등을 지원한다\nmsg.params.currency = 'KRW'; \n//입출금의 종류로, 입금(deposit) 또는 출금(withdrawal)으로 파라미터를 설정할 수 있다. 기본값은 입출금(all)로, 입금 및 출금 내역을 모두 조회할 수 있다.\nmsg.params.type = 'all';\n// 전체 데이터 중 offset(기본값 0)번째부터 데이터를 가져오도록 지정할 수 있다.\nmsg.params.offset = '0';\n// 전체 데이터 중 limit(기본값 40)개만 가져오도록 지정할 수 있다. 최대값은 40이다\nmsg.params.limit = '40';\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":620,"wires":[["1dff170b.a964a9"]]},{"id":"1dff170b.a964a9","type":"korbit","z":"56254b54.9f4f14","name":"user/transfers","api":"user/transfers","currency_pair":"","x":440,"y":620,"wires":[["e5b9e4d2.bf09f8"]]},{"id":"e5b9e4d2.bf09f8","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":620,"wires":[]},{"id":"78d84717.023b88","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":660,"wires":[["e10bdb1f.3ee538"]]},{"id":"e10bdb1f.3ee538","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\nmsg.params = {};\n// 입출금 내역을 확인하고자 하는 거래 통화. KRW, BTC, ETH, ETC, XRP 등을 지원한다\nmsg.params.currency = 'ETH'; \n// 암호화폐 입금내역 혹은 출금요청의 고유일련번호. 이 파라미터를 지정하지 않으면 현재 진행 중인 아직 완료되지 않은 출금요청을 가져온다.\nmsg.params.id = 'all';\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":660,"wires":[["eefc6cee.707bf"]]},{"id":"eefc6cee.707bf","type":"korbit","z":"56254b54.9f4f14","name":"user/coins/status","api":"user/coins/status","currency_pair":"","x":450,"y":660,"wires":[["a283355b.468798"]]},{"id":"a283355b.468798","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":660,"wires":[]},{"id":"976c58fa.acf5e8","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":720,"wires":[["7fdc4f0.dccbfb"]]},{"id":"7fdc4f0.dccbfb","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\nmsg.params = {};\n// 요청할 통화쌍.\nmsg.params.currency_pair = 'btc_krw'; \n// 주문 형태. \"limit\" : 지정가 주문, \"market\" : 시장가 주문\nmsg.params.type = 'market';\n// 가격. 지정가 주문(type=limit)인 경우에만 유효하다\nmsg.params.price = '';\n// 매수하고자 하는 코인의 수량. 시장가 주문(type=market)일 경우 coin_amount와 fiat_amount중 하나만 설정해야 하며\n// (둘 다 설정할 경우 HTTP Status Code 400 반환), coin_amount를 설정하는 경우 지정한 수량만큼 시장가로 매수한다.\nmsg.params.coin_amount = ''\n// 코인을 구매하는데 사용하고자 하는 금액을 지정. 원화 Market 일 경우 원화, \n// 다른 통화 Market일 경우 해당 Market의 통화로 금액을 지정한다. \n// 예를들어, currency_pair가 'eth_krw;인 경우 100만원 만큼의 ETH 를 구매하고 싶다면 fiat_amount에 1000000을 지정한다. \n// 시장가 주문(type=market)일 때만 유효한 파라미터이며, \n// coin_amount와 같이 사용할 수 없다.(둘 다 설정할 경우 HTTP Status Code 400 반환)\nmsg.params.fiat_amount = ''\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":720,"wires":[["85e8ee2b.6c8bf"]]},{"id":"85e8ee2b.6c8bf","type":"korbit","z":"56254b54.9f4f14","name":"user/orders/buy","api":"user/orders/buy","currency_pair":"btc_krw","x":440,"y":720,"wires":[["73ed30b.5032ed"]]},{"id":"73ed30b.5032ed","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":720,"wires":[]},{"id":"beef0a5b.3e5e18","type":"inject","z":"56254b54.9f4f14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":760,"wires":[["7caafaae.58fca4"]]},{"id":"7caafaae.58fca4","type":"function","z":"56254b54.9f4f14","name":"","func":"msg.accessToken = context.global.access_token;\nmsg.params = {};\n// 요청할 통화쌍.\nmsg.params.currency_pair = 'btc_krw'; \n// 주문 형태. \"limit\" : 지정가 주문, \"market\" : 시장가 주문\nmsg.params.type = 'market';\n// 주문 가격. 지정가 주문(type=limit)인 경우에만 유효하다\nmsg.params.price = '';\n// 매도하고자 하는 코인의 수량. \nmsg.params.coin_amount = ''\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":760,"wires":[["76438968.95edb8"]]},{"id":"76438968.95edb8","type":"korbit","z":"56254b54.9f4f14","name":"user/orders/sell","api":"user/orders/sell","currency_pair":"btc_krw","x":440,"y":760,"wires":[["ef0d27cb.d99598"]]},{"id":"ef0d27cb.d99598","type":"debug","z":"56254b54.9f4f14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":760,"wires":[]}]