Skip to main content

Security Code(equtity, option, bond etc..) of all Exchanges

Project description



pip install


pip install py-security-code



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



  1. 针对后续各个交易所的公告信息,修正和追加新的信息到 sse.yml , szse.yml 等文件
  2. 追加标签,目前针对 xxx(1to3)级别的信息,会对代码段进行打标签,由于我本人不是金融专业,所以很多标签没有整理,建议增加更丰富的标签。
  3. 提供更多的市场(尤其是数字编号的市场)支持,如港交所等…

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py-security-code, version 0.5
Filename, size File type Python version Upload date Hashes
Filename, size py-security-code-0.5.tar.gz (9.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page