{"id":19242903,"url":"https://github.com/ricequant/rqalpha-mod-stock-realtime","last_synced_at":"2025-04-21T09:32:42.404Z","repository":{"id":65306208,"uuid":"148997396","full_name":"ricequant/rqalpha-mod-stock-realtime","owner":"ricequant","description":"RQAlpha 接受实时行情并触发事件 Mod","archived":false,"fork":false,"pushed_at":"2018-09-19T12:54:56.000Z","size":15,"stargazers_count":18,"open_issues_count":0,"forks_count":18,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-01T12:04:07.143Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ricequant.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-16T13:16:42.000Z","updated_at":"2024-10-12T08:38:42.000Z","dependencies_parsed_at":"2023-01-16T21:16:00.405Z","dependency_job_id":null,"html_url":"https://github.com/ricequant/rqalpha-mod-stock-realtime","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqalpha-mod-stock-realtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqalpha-mod-stock-realtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqalpha-mod-stock-realtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqalpha-mod-stock-realtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ricequant","download_url":"https://codeload.github.com/ricequant/rqalpha-mod-stock-realtime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250032222,"owners_count":21363796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T17:15:59.243Z","updated_at":"2025-04-21T09:32:42.043Z","avatar_url":"https://github.com/ricequant.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"===============================\nstock_realtime Mod\n===============================\n\nRQAlpha 接受实时行情并触发事件 Mod\n\n该模块目前只是一个初级的 Demo，用于展示如何接入自有行情进行回测/模拟/实盘\n\n该模块使用 tushare 获取实时行情，但可能与新版本的 tushare 不兼容\n\n开启或关闭 Mod\n===============================\n\n..  code-block:: bash\n\n    # 关闭 Mod\n    $ rqalpha mod disable stock_realtime\n\n    # 启用 Mod\n    $ rqalpha mod enable stock_realtime\n\n使用统一行情服务\n===============================\n提供一个行情下载服务，启动该服务，会实时往 redis 中写入全市场股票行情数据。多个 RQAlpha 可以连接该 redis 获取实时盘口数据，就不需要重复获取数据。\n\n您本地需要安装 redis 服务，然后将 redis 的 uri 填入到 quotation_server 的参数中，行情服务就会将实时行情数据写入到 redis 中。\n\n.. code-block:: bash\n\n    rqalpha_quotation_server redis://localhost/1\n\n使用方式\n===============================\n\n在启动该 Mod 的情况下（可以通过 rqalpha mod list 确认是否启动），\n\n使用 :code:`--run-type` 或者 :code:`-rt` 为 :code:`p` (PaperTrading)，就可以激活该 mod。\n\n.. code-block:: bash\n\n    rqalpha run -fq 1m -rt p -f ~/strategy.py --account stock 100000 -l verbose\n\n在启用了 redis 服务后，可以让 rqalpha 连接 redis ，从 redis 读取实时行情数据。只需要增加参数 --redis-uri ，填入启动 quotation_server 的 uri，既可以将两者连通。\n\n.. code-block:: bash\n\n    rqalpha run -fq 1m -rt p -f ~/strategy.py --account stock 100000 -l verbose --redis-uri redis://localhost/1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricequant%2Frqalpha-mod-stock-realtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricequant%2Frqalpha-mod-stock-realtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricequant%2Frqalpha-mod-stock-realtime/lists"}