Install easyquotation via pip
masterInstall the easyquotation package using pip to access real-time market data from Sina, Tencent, and Jisilu.
pip install easyquotationrepository·master·Indexed 26 days ago
https://github.com/shidenggui/easyquotationA lightweight Python library for fetching real-time market data from Sina, Tencent, and Jisilu. It provides functionality to retrieve market snapshots, real-time quotes for single or multiple stocks, and Hong Kong stock daily K-line data via specific providers such as 'sina', 'tencent', 'daykline', 'hkquote', and 'jsl'.
Install the easyquotation package using pip to access real-time market data from Sina, Tencent, and Jisilu.
pip install easyquotationUse the 'hkquote' provider to retrieve real-time quotes for Hong Kong stocks.
import easyquotation
quotation = easyquotation.use("hkquote")
data = quotation.real(['00001','00700'])
print(data)Use the 'daykline' provider to retrieve daily K-line data for Hong Kong stocks. The returned data is a list of lists, where each inner list contains: [Date, Open, Close, High, Low, Volume].
import easyquotation
quotation = easyquotation.use("daykline")
data = quotation.real(['00001','00700'])
print(data)real() method to fetch quotes for specific stocks. You can pass a single string or a list of strings. If you provide codes without prefixes, you can optionally pass prefix=True to ensure correct matching when dealing with both indices and stocks.To avoid data restrictions when using the 'jsl' (Jisilu) provider, provide a cookie obtained from your browser using set_cookie().
quotation.set_cookie('从浏览器获取的集思录 Cookie')When using the 'jsl' provider, you can query ETF index data using etfindex().
Note: This does not currently include Gold ETFs or Money Market ETFs. To avoid data limitations, it is recommended to set your Jisilu cookie using set_cookie().
easyquotation.update_stock_codes() to refresh the internal list of all market stock codes.easyquotation.update_stock_codes()Retrieve real-time quotes for the entire market using market_snapshot().
Use the prefix=True argument to include market prefixes (e.g., sz, sh, bj) in the returned stock codes. This is required when fetching both indices and stocks with the same code to avoid ambiguity.
Use easyquotation.use(provider) to select a data source. Available providers include:
'sina''tencent' or 'qq''daykline' (for Hong Kong stock daily K-line data)'hkquote' (for Hong Kong stock real-time data)'jsl' (for Jisilu data)import easyquotation
quotation = easyquotation.use('sina')