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'

# 根据股票英文名称获取股票代码
StockNameCodeHelper.get_stock_code_by_english_name('PONY AI')
# 输出:'PONY'

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.2.0.tar.gz (82.7 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.2.0-py3-none-any.whl (82.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tcalendars-1.2.0.tar.gz
Algorithm Hash digest
SHA256 139b967bf938d13c7a18ec7e0a6db2670426b0ab0ebbd7e49e851d56f1059dad
MD5 e608075fc3f20bc76b42ec1e24bd21da
BLAKE2b-256 57667fe3db7401d0c192d55aed65cdb19bc937cc1db0bce0b8be30c023f284ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tcalendars-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 82.3 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 420f9c669853eee82ea944df76abc224bf6b57e7224b0c3a68539cd0f5db045f
MD5 112660c6aca0da2ce8b117a0e106eba4
BLAKE2b-256 2a465b1f1bcd6c09a22dc13dde0121d7650ca600edfa440852dff599c3fb6019

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