easyquotation Documentation

repository·master·Indexed 26 days ago

https://github.com/shidenggui/easyquotation

A 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'.

Tokens
646
Snippets
6
Records
9
Agent score
40%

What's inside easyquotation

  1. Get Hong Kong stock daily K-line data

    master

    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)
  2. Get real-time quotes for single or multiple stocks

    master
    Use the 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.
  3. Query ETF indices from Jisilu (jsl)

    master

    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().

  4. Get all market snapshots

    master

    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.

  5. Initialize a quotation provider with `use()`

    master

    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')