use-upbit-api
The use-upbit-api custom hook for Upbit API (Korea crypto exchange). In the previous, Upbit API's Websocket usage in React is difficult for developer who is unfamiliar with websocket in React, but this React Custom Hook solve the problem. Let's use this awesome custom hooks!
npm →
Git Repository →
View Demo →
Install
npm install --save use-upbit-api
Hooks
REST API
useFetchMarketCode
WEBSOCKET API
useWsTicker
useWsOrderbook
useWsTrade
useFetchMarketCode
useFetchMarketCode hook is used to fetch market codes from upbit api
const {isLoading, marketCodes} = useFetchMarketCode(
(options = {throttle_time: 400, debug: false}),
);
useWsTicker
useWsTicker is a custom hook that connects to a WebSocket API and retrieves real-time ticker data for a given market code.
const {socket, isConnected, socketData} = useWsTicker(
targetMarketCode,
(options = {throttle_time: 400, debug: false}),
);
useWsOrderbook
useWsOrderbook is a custom hook that connects to a WebSocket API and retrieves real-time order book data for a given market code.
const {socket, isConnected, socketData} = useWsOrderbook(
targetMarketCode,
(options = {throttle_time: 400, debug: false}),
);
useWsTrade
useWsTrade is a custom hook that connects to a WebSocket API
and retrieves real-time trade data for a given market code.
const {socket, isConnected, socketData} = useWsTrade(
targetMarketCode,
(options = {throttle_time: 400, max_length_queue: 100, debug: false}),
);
Contributing
If you want to contribute to use-upbit-api
, please contact me rkdalsgur032@unist.ac.kr
License
Licensed under the MIT License, Copyright © 2022-present MinHyeok Kang.