Skip to main content

交易日历

Project description

Trading Calendars(tcalendars)

交易日历,用于交易时间的判断。当前支持的市场有:

  • 中国股票市场(2005年1月1日起)

安装

pip install tcalendars

示例

from tcalendars import TradingCalendars

calendar = TradingCalendars()
# 判断2023年1月1日是否为交易日
calendar.is_trading_day('2023-01-01')
# 输出:False

# 获取2023年1月1日至2023年1月5日的所有交易日
calendar.get_trading_days('2023-01-01', '2023-01-05')
# 输出:['2023-01-03', '2023-01-04', '2023-01-05']

# 获取2023年1月1日所在的交易日,如果1月1日不是交易日,则返回后一个交易日
calendar.get_trading_day('2023-01-01')
# 输出:'2023-01-03'

from tcalendars import StockNameCodeHelper

helper = StockNameCodeHelper()

# 根据股票代码获取股票名称
helper.get_stock_name('000001')
# 输出:'平安银行'

# 根据股票名称获取股票代码
helper.get_stock_code('平安银行')
# 输出:'000001'

Project details


Download files

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

Source Distribution

tcalendars-1.1.0.tar.gz (80.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tcalendars-1.1.0-py3-none-any.whl (79.9 kB view details)

Uploaded Python 3

File details

Details for the file tcalendars-1.1.0.tar.gz.

File metadata

  • Download URL: tcalendars-1.1.0.tar.gz
  • Upload date:
  • Size: 80.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for tcalendars-1.1.0.tar.gz
Algorithm Hash digest
SHA256 68aa33a1afbc4482815ff7bebf7137b5daff448301c6b39e7a678186ec356b39
MD5 391b9bc1ca4277338fb5377cff30a365
BLAKE2b-256 e46af636ad9046f2651527ab63f56bb9e5b3c208dea7d260002b32362203cdb7

See more details on using hashes here.

File details

Details for the file tcalendars-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: tcalendars-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 79.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for tcalendars-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dde639c541cd44b61a610a0dc8e2ce690a3c1d66b0fb5a331b4f8e710c9e1d90
MD5 e4d2452dc5f122f494cd0d1f942c698f
BLAKE2b-256 9eef9a554f9da7d98adbc5bd482c3cfc4587b828aebcf26e83afa8c92bc99bc0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page