Skip to main content

获取股票代码对应的详细信息

安装(Installation)

pip install http+git@github.com:rainx/py_security_code.git

or

pip install py-security-code

使用说明(Usage)

导入

from security_code import ShenZhenStockExchange, ShangHaiStockExchange, SecurityTags

获取代码的信息,根据前3, 2, 1字节的信息

In [7]: ShenZhenStockExchange.get_xxx_type_by_code('000001')
Out[7]: {'name': '主板 A 股', 'tags': ['a_share', 'stock']}

In [8]: ShenZhenStockExchange.get_xx_type_by_code('000001')
Out[8]: {'name': 'A股证券'}

In [9]: ShenZhenStockExchange.get_x_type_by_code('000001')
Out[9]: {'name': 'A股'}

判断代码是否属于某个标签

In [10]: ShenZhenStockExchange.has_tag('000001', SecurityTags.A_SHARE)
Out[10]: True

In [11]: ShenZhenStockExchange.has_tag('000001', SecurityTags.STOCK)
Out[11]: True

In [12]: ShenZhenStockExchange.has_tag('000001', SecurityTags.INDEX)
Out[12]: False

提交PR

非常欢迎提交PR给本仓库,本仓库需要如下几方面的帮助:

  1. 针对后续各个交易所的公告信息,修正和追加新的信息到 sse.yml , szse.yml 等文件

  2. 追加标签,目前针对 xxx(1to3)级别的信息,会对代码段进行打标签,由于我本人不是金融专业,所以很多标签没有整理,建议增加更丰富的标签。

  3. 提供更多的市场(尤其是数字编号的市场)支持,如港交所等…

Metadata

Release files for py-security-code 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-security-code 0.1
File Size Uploaded
py-security-code-0.1.tar.gz 4.6 kB Details

Release files / py-security-code-0.1.tar.gz

Download URL py-security-code-0.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0825744256d4a76f8f3de8ee92f637c1f4a98eb0dff37945a713fef043c0d8b8
BLAKE2b-256 checksum
How to use checksums
2ada848166024121319d0c5ac5612a3bc034c326d0b428573eb100c48ec77bbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page