{"id":19242894,"url":"https://github.com/ricequant/rqopen-client","last_synced_at":"2025-10-28T10:40:03.238Z","repository":{"id":57462919,"uuid":"77203812","full_name":"ricequant/rqopen-client","owner":"ricequant","description":"rqopen-client：本地拿到Ricequant上实盘模拟交易策略的交易信号和持仓","archived":false,"fork":false,"pushed_at":"2019-08-20T06:09:17.000Z","size":15,"stargazers_count":84,"open_issues_count":0,"forks_count":32,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-09-29T12:02:03.648Z","etag":null,"topics":["python","quant","ricequant","trade"],"latest_commit_sha":null,"homepage":"https://www.ricequant.com/?f=n","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ricequant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-23T06:34:12.000Z","updated_at":"2025-09-27T20:56:39.000Z","dependencies_parsed_at":"2022-09-05T15:40:44.701Z","dependency_job_id":null,"html_url":"https://github.com/ricequant/rqopen-client","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ricequant/rqopen-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqopen-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqopen-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqopen-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqopen-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ricequant","download_url":"https://codeload.github.com/ricequant/rqopen-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqopen-client/sbom","scorecard":{"id":775069,"data":{"date":"2025-08-11","repo":{"name":"github.com/ricequant/rqopen-client","commit":"33c2b6832ae24b9260a7f00e0ba7f7c03069dfbd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/23 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2020-73","Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T03:21:20.805Z","repository_id":57462919,"created_at":"2025-08-23T03:21:20.805Z","updated_at":"2025-08-23T03:21:20.805Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281425553,"owners_count":26499030,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["python","quant","ricequant","trade"],"created_at":"2024-11-09T17:15:54.691Z","updated_at":"2025-10-28T10:40:03.197Z","avatar_url":"https://github.com/ricequant.png","language":"Python","readme":"# RQOpen-Client - RQOpen客户端\n\n## 简介\n通过这个简单的python库，你可以拿到你在 www.ricequant.com 运行的实盘、模拟交易或回测的运行数据。包含交易列表，仓位信息，投资组合信息。\n\nRQOpen 获取到的信号，会比系统时间稍微延迟一些。Ricequant Gateway 在切分钟线的时候会延迟10多秒，因为数据源的问题。而 RQAlpha 产生信号后，保存在数据库中。由 RQOpen 轮训，轮训的间隔，也是信号的延迟时间。\n\n## 安装\n```\npip install rqopen-client\n```\n\n## 简单的范例\n``` python\nfrom pprint import pprint\nfrom rqopen_client import RQOpenClient\n\nusername = \"your ricequant username\"\npassword = \"your ricequant password\"\nrun_id = your_run_id\n\nclient = RQOpenClient(username, password)\n# client = RQOpenClient(username, password, return_df=Fales)\n\npprint(client.trades(run_id))\npprint(client.current_positions(run_id))\n```\n上面代码的一些展示结果（随便一个范例）：\n### 初始化\u0026登录: RQOpenClient(username, password, return_df=True)\n```\n:param username: 登录账户\n:param password: 密码\n:param logger: 日志\n:param log_level: 日志级别\n:param base_url: 服务地址，默认web端   rqpro2.0需要单独配置\n:param timeout: 超时时间\n:param return_df: 返回数据是否为DataFrame  False返回dict\n```\n\n### 查询当日交易记录: current_trades(run_id)\n\n返回示例 - 今天没有任何下单：\n```\n# return_df=False\n{'code': 200,\n 'resp': {'name': '改进版小盘股 2016-08-28 16:15:06', 'run_id': 968101, 'trades': []}}\n\n# return_df=True\nEmpty DataFrame\nColumns: []\nIndex: []\n```\n\n返回示例 - 当日有交易：\n```\n# return_df=False\n{'code': 200,\n 'resp': {'data': [{'commission': 5.0,\n                    'date': '2019-01-04 09:31:00',\n                    'exec_id': '15641121150000',\n                    'last_price': 9.29,\n                    'last_quantity': 100.0,\n                    'order_book_id': '000001.XSHE',\n                    'order_id': 15641121140000,\n                    'position_effect': 'OPEN',\n                    'side': 'BUY',\n                    'tax': 0.0,\n                    'trade_id': '15641121150000',\n                    'transaction_cost': 5.0},\n                   {'commission': 5.0,\n                    'date': '2019-01-04 09:31:00',\n                    'exec_id': '15641121150002',\n                    'last_price': 16.29,\n                    'last_quantity': 100.0,\n                    'order_book_id': '000004.XSHE',\n                    'order_id': 15641121140002,\n                    'position_effect': 'OPEN',\n                    'side': 'BUY',\n                    'tax': 0.0,\n                    'trade_id': '15641121150002',\n                    'transaction_cost': 5.0}],\n          'name': 'SVM大法好',\n          'run_id': 6281}}\n\n# return_df=True\n                     commission  ... transaction_cost\ndate                             ...                 \n2018-05-04 09:31:00       8.568  ...            8.568\n2018-05-04 09:32:00       8.608  ...            8.608\n2018-05-04 09:33:00       8.592  ...            8.592\n2018-05-04 09:34:00       8.600  ...            8.600\n2018-05-04 09:35:00       8.592  ...            8.592\n```\n\n### 查询最新持仓: current_positions(run_id)\n\n返回示 - 有持仓：\n```\n# return_df=False\n{'code': 200,\n 'resp': {'name':  'SVM大法好',\n  'run_id': 6281,\n  'positions': [{'order_book_id': '000001.XSHE',\n    'last_price': 13.86,\n    'quantity': 5062.0},\n   {'order_book_id': '000002.XSHE', 'last_price': 32.22, 'quantity': 4939.0},\n   {'order_book_id': '000004.XSHE', 'last_price': 21.67, 'quantity': 4341.0},\n   {'order_book_id': '000005.XSHE', 'last_price': 3.97, 'quantity': 4903.0}}]}}\n\n# return_df=True\n    last_price order_book_id  quantity\n0        13.86   000001.XSHE    5062.0\n1        32.22   000002.XSHE    4939.0\n2        21.67   000004.XSHE    4341.0\n3         3.97   000005.XSHE    4903.0\n4         7.13   000006.XSHE    5011.0\n5         7.57   000007.XSHE    4955.0\n6         4.97   000008.XSHE    4906.0\n7         7.19   000009.XSHE    4995.0\n8         3.76   000010.XSHE    4996.0\n9        12.19   000011.XSHE    4931.0\n10        5.81   000012.XSHE    4984.0\n11       12.75   000014.XSHE    4974.0\n```\n\n### 查询全部交易: trades(run_id)\n返回示 - 有交易：\n```\n# return_df=False\n{'code': 200,\n 'resp': {'data': [{'commission': 5.0,\n                    'date': '2019-01-07 11:05:00',\n                    'exec_id': '15641121150040',\n                    'last_price': 3.36,\n                    'last_quantity': 1.0,\n                    'order_book_id': '000010.XSHE',\n                    'order_id': 15641121140202,\n                    'position_effect': 'CLOSE',\n                    'side': 'SELL',\n                    'tax': 0.0033599999999998076,\n                    'trade_id': '15641121150040',\n                    'transaction_cost': 5.00336},\n          'name': '横琴比赛',\n          'run_id': 6281}}\n\n# return_df=True\n                     commission  ... transaction_cost\ndate                             ...                 \n2019-01-04 09:31:00         5.0  ...          5.00000\n2019-01-04 09:31:00         5.0  ...          5.00000\n                         ...  ...              ...\n2019-04-04 14:44:00         5.0  ...          5.10176\n2019-04-04 14:54:00         5.0  ...          5.06417\n[3102 rows x 11 columns]\n\n```\n\n\n### 查询全部持仓: positions(run_id)\n返回示 - 有持仓：\n```\n# return_df=False\n{'code': 200,\n 'resp': {'data': [{'000001.XSHE': 975.0, # market_value\n                    '000002.XSHE': 2493.0,\n                    '000004.XSHE': 1660.0000000000002,\n                    '000005.XSHE': 275.0,\n                    '000006.XSHE': 526.0,\n                    '000007.XSHE': 800.0,\n                    '000008.XSHE': 391.0,\n                    '000009.XSHE': 437.0,\n                    '000010.XSHE': 332.0,\n                    '000011.XSHE': 956.0,\n                    '000012.XSHE': 409.99999999999994,\n                    '000014.XSHE': 969.0,\n                    'cash': 1990076.0,\n                    'date': '2019-01-04 00:00:00'},\n          'name': '横琴比赛',\n          'run_id': 6281}}\n\n# return_df=True\n            000001.XSHE  000002.XSHE  ...  000014.XSHE          cash\ndate                                  ...                           \n2019-01-04       975.00      2493.00  ...       969.00  1.990076e+06\n2019-01-07      1801.90      4534.05  ...      1664.99  1.981082e+06\n2019-01-08      2675.82      6950.00  ...      2388.66  1.972075e+06\n2019-01-09      3618.16      9144.13  ...      3246.15  1.963209e+06\n[4rows x 13 columns]\n```\n\n### 查询投资组合: portfolio(run_id)\n```\n# return_df=False\n{'code': 200,\n 'resp': {'data': [{'annualized_returns': 0.038520563489603976,\n                    'benchmark_daily_returns': 0.023957447956719332,\n                    'benchmark_total_returns': 0.023957447956719332,\n                    'cash': 1990076.0,\n                    'daily_pnl': 300.000000000189,\n                    'daily_returns': 0.0001500000000000945,\n                    'date': '2019-01-04 00:00:00',\n                    'market_value': 10224.0,\n                    'portfolio_value': 2000300.0,\n                    'starting_cash': 2000000.0,\n                    'total_returns': 0.0001500000000000945,\n                    'transaction_cost': 60.0},],\n          'name': '横琴比赛',\n          'run_id': 6281}}\n\n# return_df=True\n            annualized_returns  ...  transaction_cost\ndate                            ...                  \n2019-01-04            0.038521  ...          60.00000\n2019-01-07            0.022092  ...         226.54735\n2019-01-08           -0.005048  ...         251.59331\n2019-01-09           -0.004138  ...         266.77119=\n[4 rows x 11 columns]\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricequant%2Frqopen-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricequant%2Frqopen-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricequant%2Frqopen-client/lists"}