From 91724e71f950e0bb3d00626d181c9b6d36262930 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Tue, 11 Apr 2023 09:39:57 +0000 Subject: automatic import of python-tqsdk --- python-tqsdk.spec | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 python-tqsdk.spec (limited to 'python-tqsdk.spec') diff --git a/python-tqsdk.spec b/python-tqsdk.spec new file mode 100644 index 0000000..d001367 --- /dev/null +++ b/python-tqsdk.spec @@ -0,0 +1,156 @@ +%global _empty_manifest_terminate_build 0 +Name: python-tqsdk +Version: 3.3.0 +Release: 1 +Summary: TianQin SDK +License: Apache Software License +URL: https://www.shinnytech.com/tqsdk +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/56/f7/422cea722db7f87778f0ed961faf60309e2409af14b1436d7c37bab883e9/tqsdk-3.3.0.tar.gz + +Requires: python3-websockets +Requires: python3-requests +Requires: python3-numpy +Requires: python3-pandas +Requires: python3-scipy +Requires: python3-simplejson +Requires: python3-aiohttp +Requires: python3-certifi +Requires: python3-pyjwt +Requires: python3-psutil +Requires: python3-shinny-structlog +Requires: python3-sgqlc +Requires: python3-filelock + +%description +TqSdk 是一个由[信易科技](https://www.shinnytech.com)发起并贡献主要代码的开源 python 库. +依托[快期多年积累成熟的交易及行情服务器体系](https://www.shinnytech.com/diff), TqSdk 支持用户使用极少的代码量构建各种类型的量化交易策略程序, +并提供包含期货、期权、股票的 历史数据-实时数据-开发调试-策略回测-模拟交易-实盘交易-运行监控-风险管理 全套解决方案. +``` {.sourceCode .python} +from tqsdk import TqApi, TqAuth, TqAccount, TargetPosTask +api = TqApi(TqAccount("H海通期货", "4003242", "123456"), auth=TqAuth("信易账户", "账户密码")) # 创建 TqApi 实例, 指定交易账户 +q_1910 = api.get_quote("SHFE.rb1910") # 订阅近月合约行情 +t_1910 = TargetPosTask(api, "SHFE.rb1910") # 创建近月合约调仓工具 +q_2001 = api.get_quote("SHFE.rb2001") # 订阅远月合约行情 +t_2001 = TargetPosTask(api, "SHFE.rb2001") # 创建远月合约调仓工具 +while True: + api.wait_update() # 等待数据更新 + spread = q_1910["last_price"] - q_2001["last_price"] # 计算近月合约-远月合约价差 + print("当前价差:", spread) + if spread > 250: + print("价差过高: 空近月,多远月") + t_1910.set_target_volume(-1) # 要求把1910合约调整为空头1手 + t_2001.set_target_volume(1) # 要求把2001合约调整为多头1手 + elif spread < 200: + print("价差回复: 清空持仓") # 要求把 1910 和 2001合约都调整为不持仓 + t_1910.set_target_volume(0) + t_2001.set_target_volume(0) +``` +要快速了解如何使用TqSdk, 可以访问我们的 [十分钟快速入门指南](https://doc.shinnytech.com/tqsdk/latest/quickstart.html). + +%package -n python3-tqsdk +Summary: TianQin SDK +Provides: python-tqsdk +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +BuildRequires: python3-cffi +BuildRequires: gcc +BuildRequires: gdb +%description -n python3-tqsdk +TqSdk 是一个由[信易科技](https://www.shinnytech.com)发起并贡献主要代码的开源 python 库. +依托[快期多年积累成熟的交易及行情服务器体系](https://www.shinnytech.com/diff), TqSdk 支持用户使用极少的代码量构建各种类型的量化交易策略程序, +并提供包含期货、期权、股票的 历史数据-实时数据-开发调试-策略回测-模拟交易-实盘交易-运行监控-风险管理 全套解决方案. +``` {.sourceCode .python} +from tqsdk import TqApi, TqAuth, TqAccount, TargetPosTask +api = TqApi(TqAccount("H海通期货", "4003242", "123456"), auth=TqAuth("信易账户", "账户密码")) # 创建 TqApi 实例, 指定交易账户 +q_1910 = api.get_quote("SHFE.rb1910") # 订阅近月合约行情 +t_1910 = TargetPosTask(api, "SHFE.rb1910") # 创建近月合约调仓工具 +q_2001 = api.get_quote("SHFE.rb2001") # 订阅远月合约行情 +t_2001 = TargetPosTask(api, "SHFE.rb2001") # 创建远月合约调仓工具 +while True: + api.wait_update() # 等待数据更新 + spread = q_1910["last_price"] - q_2001["last_price"] # 计算近月合约-远月合约价差 + print("当前价差:", spread) + if spread > 250: + print("价差过高: 空近月,多远月") + t_1910.set_target_volume(-1) # 要求把1910合约调整为空头1手 + t_2001.set_target_volume(1) # 要求把2001合约调整为多头1手 + elif spread < 200: + print("价差回复: 清空持仓") # 要求把 1910 和 2001合约都调整为不持仓 + t_1910.set_target_volume(0) + t_2001.set_target_volume(0) +``` +要快速了解如何使用TqSdk, 可以访问我们的 [十分钟快速入门指南](https://doc.shinnytech.com/tqsdk/latest/quickstart.html). + +%package help +Summary: Development documents and examples for tqsdk +Provides: python3-tqsdk-doc +%description help +TqSdk 是一个由[信易科技](https://www.shinnytech.com)发起并贡献主要代码的开源 python 库. +依托[快期多年积累成熟的交易及行情服务器体系](https://www.shinnytech.com/diff), TqSdk 支持用户使用极少的代码量构建各种类型的量化交易策略程序, +并提供包含期货、期权、股票的 历史数据-实时数据-开发调试-策略回测-模拟交易-实盘交易-运行监控-风险管理 全套解决方案. +``` {.sourceCode .python} +from tqsdk import TqApi, TqAuth, TqAccount, TargetPosTask +api = TqApi(TqAccount("H海通期货", "4003242", "123456"), auth=TqAuth("信易账户", "账户密码")) # 创建 TqApi 实例, 指定交易账户 +q_1910 = api.get_quote("SHFE.rb1910") # 订阅近月合约行情 +t_1910 = TargetPosTask(api, "SHFE.rb1910") # 创建近月合约调仓工具 +q_2001 = api.get_quote("SHFE.rb2001") # 订阅远月合约行情 +t_2001 = TargetPosTask(api, "SHFE.rb2001") # 创建远月合约调仓工具 +while True: + api.wait_update() # 等待数据更新 + spread = q_1910["last_price"] - q_2001["last_price"] # 计算近月合约-远月合约价差 + print("当前价差:", spread) + if spread > 250: + print("价差过高: 空近月,多远月") + t_1910.set_target_volume(-1) # 要求把1910合约调整为空头1手 + t_2001.set_target_volume(1) # 要求把2001合约调整为多头1手 + elif spread < 200: + print("价差回复: 清空持仓") # 要求把 1910 和 2001合约都调整为不持仓 + t_1910.set_target_volume(0) + t_2001.set_target_volume(0) +``` +要快速了解如何使用TqSdk, 可以访问我们的 [十分钟快速入门指南](https://doc.shinnytech.com/tqsdk/latest/quickstart.html). + +%prep +%autosetup -n tqsdk-3.3.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-tqsdk -f filelist.lst +%dir %{python3_sitearch}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot - 3.3.0-1 +- Package Spec generated -- cgit v1.2.3