{"id":40037352,"url":"https://github.com/ztsec/xtp_pro_api_python","last_synced_at":"2026-04-07T07:49:10.436Z","repository":{"id":322920086,"uuid":"1090075167","full_name":"ztsec/xtp_pro_api_python","owner":"ztsec","description":"xtp pro版本API","archived":false,"fork":false,"pushed_at":"2026-01-14T01:54:17.000Z","size":46320,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-14T05:35:56.008Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/ztsec.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-05T07:30:16.000Z","updated_at":"2026-01-14T01:54:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ztsec/xtp_pro_api_python","commit_stats":null,"previous_names":["ztsec/xtp_pro_api_python"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ztsec/xtp_pro_api_python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ztsec%2Fxtp_pro_api_python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ztsec%2Fxtp_pro_api_python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ztsec%2Fxtp_pro_api_python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ztsec%2Fxtp_pro_api_python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ztsec","download_url":"https://codeload.github.com/ztsec/xtp_pro_api_python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ztsec%2Fxtp_pro_api_python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28561842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-19T05:00:31.509Z","updated_at":"2026-01-19T05:00:42.096Z","avatar_url":"https://github.com/ztsec.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"中泰证券量化交易平台XTP PRO PYTHON API接口\n\n本项目是中泰证券XTP极速交易PYTHON接口的开源实现，供客户在量化交易中使用PYTHON接口快速接入XTP系统。中泰证券XTP是为股票交易而生的极速交易系统，为投资者提供极速交易、极速行情、Level2行情。\n\n目前xtp pro系统最新的api版本为1.0.15，支持windows、linux平台运行。\n\n请先到中泰证券xtp官方网站申请测试账号 https://xtp.zts.com.cn 及测试环境的连接ip、端口等信息。\n\nAPI参考官方C++版本的接口文档 https://xtp.zts.com.cn/xtp-pro\n\npython版本api封装使用的Visual Studio 2015，如果本地安装的vs是较低的vs2010版本，并且未安装vs环境，运行时会提示ImportError:DLL load failed。需根据python的位数选择对应Visual C++库的运行时组件，64位选vc_redist.x64.exe，执行程序参考文件包vs2015运行库。\n\n官网下载地址：https://www.microsoft.com/zh-CN/download/details.aspx?id=48145\n\n##事项说明:\n\n1.当前xtp pro的python api封装支持win7系统、win10系统和Linux系统，在bin目录下Linux文件夹中有python3封装库，Windows文件夹中有64位的python3封装库。test文件夹下包含行情和交易的测试脚本。\n\n2.当前bin目录下编译时使用的 python3.9.13 + boost_1_80_0 版本，如果直接使用当前的封装库，请注意使用的python版本是否为3.9系列，如果您使用的python版本和我们编译时使用的版本不一致，会导致调用python封装库失败。\n\n3.如果客户需要按自己的python版本编译封装库，可以使用source目录下的代码，根据自己的python的版本，及该python版本对应的编译后的boost库，自行编译所需的python封装库。（具体过程在doc文件夹下有编译过程文档，source文件夹下有源码，包括Linux和Windows下编译的python3封装库）。\n\n4.XTP Pro版本封装的python版本sdk中回调函数onDepthMarketData()的数据data跟之前的版本有区别，stk(股票)，bond(债券)，opt(期权)三个数据作为字典嵌套到data里的,具体参考quotetest.py里的示例。同理，回调函数onTickByTick()的数据data跟之前版本也不同，entrust(逐笔委托)，trade(逐笔成交)，state(逐笔状态)三个数据是作为字段嵌套到data里的，参考quotetest.py里的示例。\n\n5.XTP_PRO_API文件夹下存放最新的C++版本的SDK，当前python封装库分别包含行情和交易库，python封装后的接口与当前c++版本的SDK中的API所有接口都保持一致，只有方法名有所区别，python封装后的接口方法名首字母小写，而C++版本的api方法名首字母大写。\n\n  因此所有封装后的python接口方法使用和功能都可以参见C++版本的SDK的接口方法。请在xtpx_quote_api.h、xtpx_trader_api.h两个头文件中了解各个接口的使用及功能。\n\n6. python版本的sdk包，请在git下使用clone下载：https://github.com/ztsec/xtp_pro_api_python.git\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fztsec%2Fxtp_pro_api_python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fztsec%2Fxtp_pro_api_python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fztsec%2Fxtp_pro_api_python/lists"}