-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f6b37c
commit 53f7aaf
Showing
30 changed files
with
304 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ | |
option_base.rst | ||
algorithm.rst | ||
strategy.rst | ||
jupyter.rst | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.. _demo_jupyter: | ||
|
||
Jupyter 示例 | ||
==================================================== | ||
|
||
.. contents:: 目录 | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
notebooks/demo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"metadata": {}, | ||
"cell_type": "markdown", | ||
"source": "## 获取实时行情", | ||
"id": "cf67a7321f3bb1f9" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"id": "initial_id", | ||
"metadata": { | ||
"collapsed": true, | ||
"ExecuteTime": { | ||
"end_time": "2024-06-19T02:43:38.474676Z", | ||
"start_time": "2024-06-19T02:43:37.562702Z" | ||
} | ||
}, | ||
"source": [ | ||
"from tqsdk import TqApi, TqSim, TqAuth\n", | ||
"auth = TqAuth('快期账户', '快期密码')" | ||
], | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"在使用天勤量化之前,默认您已经知晓并同意以下免责条款,如果不同意请立即停止使用:https://www.shinnytech.com/blog/disclaimer/\n" | ||
] | ||
} | ||
], | ||
"execution_count": 1 | ||
}, | ||
{ | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-06-19T02:43:40.994847Z", | ||
"start_time": "2024-06-19T02:43:38.476915Z" | ||
} | ||
}, | ||
"cell_type": "code", | ||
"source": "api = TqApi(TqSim(), auth=auth)", | ||
"id": "1e9889a79d1712c6", | ||
"outputs": [], | ||
"execution_count": 2 | ||
}, | ||
{ | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-06-19T02:43:41.019471Z", | ||
"start_time": "2024-06-19T02:43:40.996711Z" | ||
} | ||
}, | ||
"cell_type": "code", | ||
"source": "q = api.get_quote('SHFE.rb2410')", | ||
"id": "2882551c574b0eb", | ||
"outputs": [], | ||
"execution_count": 3 | ||
}, | ||
{ | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-06-19T02:43:41.025745Z", | ||
"start_time": "2024-06-19T02:43:41.021628Z" | ||
} | ||
}, | ||
"cell_type": "code", | ||
"source": "print(q.datetime, q.last_price)", | ||
"id": "61778b7e63c12fd7", | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"2024-06-19 10:43:40.500000 3639\n" | ||
] | ||
} | ||
], | ||
"execution_count": 4 | ||
}, | ||
{ | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-06-19T02:43:41.051300Z", | ||
"start_time": "2024-06-19T02:43:41.027038Z" | ||
} | ||
}, | ||
"cell_type": "code", | ||
"source": "api.close()", | ||
"id": "d399ddff6ba9fc70", | ||
"outputs": [], | ||
"execution_count": 5 | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ | |
targetpostask.rst | ||
backtest.rst | ||
web_gui.rst | ||
jupyter.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.. _jupyter: | ||
|
||
在 Jupyter Notebook 中使用 TqSdk | ||
==================================================== | ||
|
||
本文档将介绍如何在 Jupyter Notebook 中使用 TqSdk。与普通代码类似,直接导入 TqSdk 并使用即可。 | ||
|
||
安装 Jupyter Notebook | ||
---------------------------------------------------- | ||
|
||
Jupyter Notebook 是一个开源项目,能够在交互式编程环境中提供丰富的可视化表达,可以创建和共享代码和文档。 | ||
|
||
可以使用以下命令安装 Jupyter Notebook: | ||
|
||
```bash | ||
pip install jupyter | ||
``` | ||
|
||
更多 Jupyter Notebook 安装文档请参考 | ||
|
||
`Jupyter Notebook 安装文档 <https://jupyter.org/install/>`_ :: | ||
`Jupyter Notebook 文档 <https://jupyter-notebook.readthedocs.io/en/latest//>`_ :: | ||
|
||
|
||
安装 TqSdk | ||
---------------------------------------------------- | ||
|
||
请参考 :ref:`安装文档 <tqsdk_install>` 。 | ||
|
||
|
||
在 Jupyter Notebook 中使用 TqSdk | ||
---------------------------------------------------- | ||
|
||
请参考 :ref:`示例 <demo_jupyter>` 。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
setuptools.setup( | ||
name='tqsdk', | ||
version="3.5.10", | ||
version="3.6.0", | ||
description='TianQin SDK', | ||
author='TianQin', | ||
author_email='[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '3.5.10' | ||
__version__ = '3.6.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.