### Install pyupbit Python Library Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/_build/html/quickstart.html This snippet shows how to install the pyupbit library using pip, the Python package installer. It's the first step to use the library for interacting with the Upbit exchange API. ```Python pip install pyupbit ``` -------------------------------- ### Get Current Price of Cryptocurrency using pyupbit Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/_build/html/quickstart.html This Python snippet demonstrates how to retrieve the current market price for a specific cryptocurrency pair (e.g., KRW-BTC) using the pyupbit.get_current_price function. It imports the pyupbit library and prints the fetched price. ```Python import pyupbit price = pyupbit.get_current_price("KRW-BTC") print(price) ``` -------------------------------- ### Retrieve List of Available Tickers using pyupbit Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/_build/html/quickstart.html This Python snippet shows how to fetch a list of all available tickers (trading pairs) from the Upbit exchange using the pyupbit.get_tickers function. It imports the pyupbit library and prints both the list of tickers and its data type. ```Python import pyupbit tickers = pyupbit.get_tickers() print(tickers) print(type(tickers)) ``` -------------------------------- ### Integrate Pyupbit WebSocketClient with Multiprocessing Queue Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Presents an advanced example of using Pyupbit's `WebSocketClient` in conjunction with Python's `multiprocessing` module. This setup allows users to manually create a separate process for the WebSocket client and manage data flow using a `multiprocessing.Queue`, providing greater control over concurrent operations. ```python import multiprocessing as mp import pyupbit if __name__ == "__main__": queue = mp.Queue() proc = mp.Process( target=pyupbit.WebSocketClient, args=('ticker', ["KRW-BTC"], queue), daemon=True ) proc.start() while True: data = queue.get() print(data) ``` -------------------------------- ### Install pyupbit and pyjwt Python Libraries Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Instructions to install the pyupbit library and its dependency, pyjwt, using pip. These libraries are essential for interacting with the Upbit API in Python. ```Shell pip install pyupbit ``` ```Shell pip install pyjwt ``` -------------------------------- ### Receive Real-time Data with Pyupbit WebSocketManager Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Illustrates how to use Pyupbit's `WebSocketManager` to subscribe to real-time market data like tickers, order books, or transactions. It shows initialization, data retrieval via `get()`, and termination, emphasizing the necessity of the `__name__` guard for multiprocessing. ```python from pyupbit import WebSocketManager if __name__ == "__main__": wm = WebSocketManager("ticker", ["KRW-BTC"]) for i in range(10): data = wm.get() print(data) wm.terminate() ``` -------------------------------- ### Fetch Daily OHLCV Data with Custom Base Time (pyupbit) Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Shows how to retrieve daily OHLCV data with a custom base time using `get_daily_ohlcv_from_base()`. This function allows shifting the daily candle calculation start time, for example, to align with specific trading hours. ```Python print(pyupbit.get_daily_ohlcv_from_base("KRW-BTC", base=12)) ``` ```Python print(pyupbit.get_daily_ohlcv_from_base("KRW-BTC", base=13)) ``` -------------------------------- ### Python Project Dependencies (requirements.txt) Source: https://github.com/sharebook-kr/pyupbit/blob/master/requirements.txt Lists the required Python packages and their versions for the project, typically found in a 'requirements.txt' file. These dependencies are necessary for the project to run correctly and can be installed using pip. ```text certifi==2020.12.5 cffi==1.14.5 chardet==4.0.0 cryptography==3.4.6 DateTime==4.3 idna==2.10 jwt==1.2.0 numpy pandas pycparser==2.20 python-dateutil==2.8.1 pytz==2021.1 requests==2.25.1 six==1.15.0 urllib3==1.26.3 websockets zope.interface==5.2.0 ``` -------------------------------- ### Get All Accounts Balance using pyupbit Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/_build/html/exchange.html This Python snippet demonstrates how to retrieve all account balances from Upbit using the pyupbit library. It requires an access key and a secret key for authentication, which should be replaced with your actual API credentials. ```Python import pyupbit access = "access key" secret = "secret key" upbit = pyupbit.Upbit(access, secret) balance = upbit.get_balances() print(balance) ``` -------------------------------- ### Retrieve Market Tickers using PyUpbit Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/quotation.rst Demonstrates how to fetch lists of available market tickers from Upbit using the `pyupbit.get_tickers()` function. Examples include retrieving all tickers, and filtering by specific markets like KRW, BTC, and USDT. ```python # 시세 종목 조회 import pyupbit # 업비트의 모든 티커목록 조회 tickers = pyupbit.get_tickers() print(tickers) print(len(tickers)) # 원화 시장의 티커목록 조회 krw_tickers = pyupbit.get_tickers("KRW") print(krw_tickers) print(len(krw_tickers)) # BTC 시장의 티커목록 조회 btc_tickers = pyupbit.get_tickers("BTC") print(btc_tickers) print(len(btc_tickers)) # USDT 시장의 티코목록 조회 usdt_tickers = pyupbit.get_tickers("USDT") print(usdt_tickers) print(len(usdt_tickers)) ``` -------------------------------- ### Retrieve Minute Candles using PyUpbit Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/quotation.rst Illustrates how to fetch minute-based OHLCV (Open, High, Low, Close, Volume) candle data for a specific market pair using `pyupbit.get_ohlcv()`. It shows examples for 1, 3, 5, 10, 30, and 60-minute intervals, each returning up to 200 candles. ```python # 분봉 # 1, 3, 5, 10, 15, 30, 60, 240분봉에 대해서 최대 200개 조회 가능 import pyupbit # 1분봉 (최대 200개 요청가능) minute1 = pyupbit.get_ohlcv("KRW-BTC", "minute1") print(minute1) print(type(minute1), minute1.shape) # 3분봉 (최대 200개 요청가능) minute3 = pyupbit.get_ohlcv("KRW-BTC", "minute3") print(minute3) # 5분봉 (최대 200개 요청가능) minute5 = pyupbit.get_ohlcv("KRW-BTC", "minute5") print(minute5) # 10분봉 (최대 200개 요청가능) minute10 = pyupbit.get_ohlcv("KRW-BTC", "minute10") print(minute10) # 30분봉 (최대 200개 요청가능) minute30 = pyupbit.get_ohlcv("KRW-BTC", "minute30") print(minute30) # 60분봉 (최대 200개 요청가능) minute60 = pyupbit.get_ohlcv("KRW-BTC", "minute60") print(minute60) ``` -------------------------------- ### Get Current Price of Cryptocurrencies (pyupbit) Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Illustrates how to retrieve the current trading price for a single cryptocurrency ticker or multiple tickers using `get_current_price()`. The function returns a float for a single ticker or a dictionary for multiple tickers, with a limit of 100 tickers per request. ```Python print(pyupbit.get_current_price("KRW-BTC")) ``` ```Python print(pyupbit.get_current_price(["KRW-BTC", "KRW-XRP"])) ``` -------------------------------- ### Enable Sphinx Read the Docs Navigation Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/_build/html/genindex.html Initializes the Sphinx Read the Docs navigation functionality using jQuery. This script ensures that the navigation sidebar is properly enabled when the document is ready, enhancing user experience for documentation browsing. ```JavaScript jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); ``` -------------------------------- ### Enable Sphinx Read the Docs Theme Navigation Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/_build/html/search.html This JavaScript snippet initializes the navigation functionality provided by the Sphinx Read the Docs theme. It ensures that interactive navigation elements, such as sidebar toggles or responsive menus, are properly enabled upon document readiness. ```JavaScript jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); ``` -------------------------------- ### Load Search Index for Sphinx Documentation Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/_build/html/search.html This JavaScript code loads the search index file ('searchindex.js') required for the client-side search functionality within Sphinx-generated documentation. It's crucial for enabling users to search the documentation content directly from the browser. ```JavaScript jQuery(function() { Search.loadIndex("searchindex.js"); }); ``` -------------------------------- ### PyUpbit Quotation API Overview and Rate Limits Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/quotation.rst Provides an overview of the PyUpbit Quotation API, which allows querying market data without API registration, and details the associated rate limits for different types of requests. ```APIDOC PyUpbit Quotation API Rules: - Purpose: Query market prices and order books without API registration. - Websocket Connection Rate Limit: 5 requests per second, 100 requests per minute. - Ticker, Candle, Trade, Ticker, Orderbook API Rate Limit: 10 requests per second, 600 requests per minute. ``` -------------------------------- ### Import pyupbit Library in Python Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Demonstrates how to import the pyupbit library into a Python script, making its functions available for use. ```Python import pyupbit ``` -------------------------------- ### Retrieve Order Book Information (pyupbit) Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Demonstrates how to fetch real-time order book (bid/ask) information for single or multiple cryptocurrency tickers using `get_orderbook()`. The function returns a list of dictionaries containing market, timestamp, and detailed orderbook units. ```Python print(pyupbit.get_orderbook(ticker="KRW-BTC")) ``` ```Python print(pyupbit.get_orderbook(ticker=["KRW-BTC", "KRW-XRP"])) ``` -------------------------------- ### Specify OHLCV Data Interval (pyupbit) Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Demonstrates how to retrieve OHLCV data for different time intervals using the `interval` parameter in `get_ohlcv()`. Supported intervals include daily, various minute intervals (minute1, minute3, etc.), weekly, and monthly. ```Python print(pyupbit.get_ohlcv("KRW-BTC", interval="day")) print(pyupbit.get_ohlcv("KRW-BTC", interval="minute1")) print(pyupbit.get_ohlcv("KRW-BTC", interval="week")) ``` -------------------------------- ### Retrieve Cryptocurrency Tickers (pyupbit) Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Shows how to fetch a list of all cryptocurrencies supported by Upbit using `get_tickers()`. It also demonstrates filtering tickers by a specific fiat market like KRW, BTC, or USDT. The function returns a list of ticker strings. ```Python print(pyupbit.get_tickers()) ``` ```Python print(pyupbit.get_tickers(fiat="KRW")) ``` -------------------------------- ### Fetch OHLCV Data Up To a Specific Date (pyupbit) Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Explains how to retrieve OHLCV data up to a specific date or time using the `to` parameter in `get_ohlcv()`. This allows fetching historical data ending at a precise point, respecting the specified interval. ```Python print(pyupbit.get_ohlcv("KRW-BTC", to="20201010")) ``` ```Python print(pyupbit.get_ohlcv("KRW-BTC", interval="minute1", to="20201010")) ``` -------------------------------- ### Fetch OHLCV Chart Data (pyupbit) Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Demonstrates how to retrieve Open, High, Low, Close, and Volume (OHLCV) data for a cryptocurrency ticker using `get_ohlcv()`. The function returns a pandas DataFrame, with data sorted in ascending order by date. ```Python df = pyupbit.get_ohlcv("KRW-BTC") print(df.tail()) ``` -------------------------------- ### Retrieve Daily Candles using PyUpbit Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/quotation.rst Shows how to retrieve daily OHLCV candle data for a market pair using `pyupbit.get_ohlcv()`. By default, it fetches up to 200 days, but the `count` parameter can be used to specify a smaller number of days. ```python # 일봉 import pyupbit # 기본 요청시 200일 (최대) df = pyupbit.get_ohlcv("KRW-BTC", "day") print(df) # 200개 미만의 경우 count 인자에 설정 가능 df = pyupbit.get_ohlcv("KRW-BTC", "day", count=10) print(df) ``` -------------------------------- ### Adjust OHLCV Data Fetching Period (pyupbit) Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Shows how to control the data fetching frequency for `get_ohlcv()` when requesting more than 200 data points. The `period` parameter, specified in seconds, helps manage API rate limits for large data requests; it is ignored for requests under 200 data points. ```Python df = pyupbit.get_ohlcv("KRW-BTC", count=600, period=1) ``` -------------------------------- ### Retrieve Weekly Candles using PyUpbit Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/quotation.rst Demonstrates fetching weekly OHLCV candle data for a market pair using `pyupbit.get_ohlcv()`. Similar to daily candles, it retrieves up to 200 weekly candles by default. ```python # 주봉 import pyupbit # 기본 요청시 200개 df = pyupbit.get_ohlcv("KRW-BTC", "week") print(df) ``` -------------------------------- ### Retrieve Monthly Candles using PyUpbit Source: https://github.com/sharebook-kr/pyupbit/blob/master/docs/quotation.rst Illustrates how to retrieve monthly OHLCV candle data for a market pair using `pyupbit.get_ohlcv()`. This function fetches monthly candles, typically up to 200 by default. ```python import pyupbit df = pyupbit.get_ohlcv("KRW-BTC", "month") print(df) ``` -------------------------------- ### Fetch Specific Number of OHLCV Data Points (pyupbit) Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Explains how to limit the number of OHLCV data points retrieved using the `count` parameter in `get_ohlcv()`. This allows fetching a specified number of recent trading days' data, with a default count of 200 if not specified. ```Python df = pyupbit.get_ohlcv("KRW-BTC", count=5) print(len(df)) ``` -------------------------------- ### Cancel Upbit Order using Python Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Demonstrates how to cancel an existing order on Upbit using its UUID. The `upbit.cancel_order()` function returns a dictionary containing the details of the cancelled order, such as `uuid`, `side`, `ord_type`, and `state`. ```python print(upbit.cancel_order('50e184b3-9b4f-4bb0-9c03-30318e3ff10a')) ``` -------------------------------- ### Upbit Quotation API Rate Limits Source: https://github.com/sharebook-kr/pyupbit/blob/master/README.md Details the rate limits for the Upbit Quotation API. Websocket connections are limited to 5 requests per second and 100 per minute. Other APIs like ticker, candle, trade, and order book are limited to 10 requests per second and 600 per minute. ```APIDOC Websocket: 5 requests/sec, 100 requests/min Other APIs (ticker, candle, trade, order book): 10 requests/sec, 600 requests/min ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.