{"id":24542,"library":"rqdatac","title":"rqdatac - Ricequant Data SDK","description":"Ricequant Data SDK (rqdatac) provides programmatic access to Chinese financial market data, including stocks, futures, options, and index data. It offers both snapshot and historical data retrieval with a pandas-friendly API. Current version: 3.5.1.1. The library is actively maintained by Ricequant and releases follow a monthly cadence.","status":"active","version":"3.5.1.1","language":"python","source_language":"en","source_url":"https://github.com/ricequant/rqdatac","tags":["financial-data","china-stocks","data-sdk","ricequant"],"install":[{"cmd":"pip install rqdatac","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"rqdatac exports its main functions at the top level; the canonical import is 'import rqdatac as rq'.","wrong":"from rqdatac import rqdatac","symbol":"init","correct":"import rqdatac as rq"},{"note":"Direct import from the subpackage is unnecessary; top-level import works.","wrong":"from rqdatac.rqdatac import all_instruments","symbol":"all_instruments","correct":"from rqdatac import all_instruments"},{"note":"get_price is a function, not a module.","wrong":"import rqdatac.get_price","symbol":"get_price","correct":"from rqdatac import get_price"}],"quickstart":{"code":"import rqdatac as rq\n\n# Initialize with your token (get from https://www.ricequant.com)\nrq.init('your_token_here')\n\n# List all instruments\ninstruments = rq.all_instruments()\nprint(instruments.head())\n\n# Get historical price data for a stock\nprices = rq.get_price('000001.XSHE', start_date='2024-01-01', end_date='2024-06-01', fields=['close'])\nprint(prices.head())","lang":"python","description":"Initialize rqdatac with your API token and fetch instrument list and historical prices."},"warnings":[{"fix":"Use rq.init('your_full_token') - obtain token from Ricequant website.","message":"Token format changed in v3.0 - you must now pass a full API token (not user/password). Old init patterns no longer work.","severity":"breaking","affected_versions":">=3.0"},{"fix":"Always append the correct exchange suffix (e.g., '000001.XSHE', '600000.XSHG').","message":"Stock codes on Chinese exchanges require exchange suffix: .XSHE for Shenzhen, .XSHG for Shanghai. Omitting suffix returns empty data.","severity":"gotcha","affected_versions":"all"},{"fix":"Check column names with .columns and refer to 'order_book_id' for instrument identifiers.","message":"The 'rqdatac.all_instruments' function now returns a DataFrame with different column names (e.g., 'order_book_id' instead of 'code'). Old code referencing 'code' or 'symbol' will break.","severity":"deprecated","affected_versions":">=3.0"},{"fix":"Always pass dates as strings: start_date='2024-01-01'.","message":"get_price() expects start_date and end_date as strings in 'YYYY-MM-DD' format. Python date objects or other formats may cause unexpected errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Make sure you call rq.init('valid_token_here') with a token obtained from your Ricequant account. Token must be a string.","cause":"Token is expired, malformed, or missing. Also occurs if init() is not called.","error":"rqdatac.exceptions.AuthenticationError: invalid token"},{"fix":"Check your rqdatac version: if <3.0, use 'code' instead. If >=3.0, use 'order_book_id'. Alternatively, use .get('order_book_id', None) or update to latest version.","cause":"Code refers to column 'order_book_id' but older version returns 'code' or 'symbol'.","error":"KeyError: 'order_book_id'"},{"fix":"Ensure stock codes include exchange suffix (e.g., '000001.XSHE'). Also verify that the date range is within available data.","cause":"Instrument code is missing exchange suffix or incorrect date range.","error":"Empty DataFrame returned when calling get_price"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}