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.1.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.1-py3-none-any.whl (82.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tcalendars-1.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 6bd444f47e7151d50aa8016d30966d85326a15b09d72fbc1159ef6aea48870e1
MD5 480b5d4f9f09af91b6455f4b2935d657
BLAKE2b-256 cb95db770aad7106d9405df1229a32ff07ff5ca89b565349e4fbd0b71ed42faa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tcalendars-1.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3a48ff84f693eb99eb699ca9d10fdc469c44b3a748ee0f4f202a225715a2c96
MD5 8c55c9aa67ebd0db5cd447349b06a235
BLAKE2b-256 761513fe5e847580627aaace8f4677166959d1b86df0ac273b973ef210145e9d

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