Skip to main content

Trading calendar for Vietnamese stock exchanges (HOSE, HNX, UPCOM)

Project description

vn-market-calendar

CI PyPI version Python 3.10+ License: MIT Coverage

Trading calendar for Vietnamese stock exchanges — HOSE, HNX, UPCOM. Holidays, session schedules, tick sizes, T+2 settlement, and real-time market-state helpers. Data 2000-2040, auto-updated annually.

Install

pip install vn-market-calendar              # core
pip install "vn-market-calendar[pandas]"   # + pandas helpers

Quick start

from vn_market_calendar import HOSE

cal = HOSE()
cal.is_trading_day("2024-04-30")           # False (Reunification Day)
cal.next_trading_day("2024-04-26")         # date(2024, 5, 2)
cal.count_trading_days("2024-01-01", "2024-12-31")  # 250

for s in cal.sessions("2024-05-02"):
    print(s.name, s.start, s.end)
    # pre_open_ato         09:00:00 09:15:00
    # continuous_morning   09:15:00 11:30:00
    # lunch_break          11:30:00 13:00:00
    # continuous_afternoon 13:00:00 14:30:00
    # atc                  14:30:00 14:45:00
    # put_through          14:45:00 15:00:00

    cal.tick_size(price=15_000)                # 50 VND
    cal.lot_size("ACB")                        # 100
    ```

    ## Financial analysis

    ```python
    from vn_market_calendar import HOSE, VN_TZ
    import datetime

    cal = HOSE()

    # Real-time market state
    cal.is_open()                  # True/False right now (Vietnam time)
    cal.current_session()          # Session("continuous_morning", ...) or None
    cal.next_session_open()        # datetime of next session open, tz-aware

    # T+2 settlement
    cal.settlement_day("2024-05-02")           # date(2024, 5, 6)
    cal.settlement_day("2024-04-26", lag=2)    # date(2024, 5, 3)

    # Trading minutes per day
    cal.trading_minutes("2024-05-02")          # 270 (excl. lunch)
    ```

    ## pandas helpers

    ```python
    from vn_market_calendar.pandas_helpers import (
        trading_days, is_trading_day_series,
            next_trading_day_series, previous_trading_day_series,
                settlement_day_series,
                )

                idx    = trading_days("2024-01-01", "2024-12-31")
                settled = settlement_day_series(df["trade_date"], lag=2)
                ```

                ## CLI

                ```
                vn-market-calendar is-trading 2024-04-30
                vn-market-calendar next       2024-04-29 --exchange HNX
                vn-market-calendar count      2024-01-01 2024-12-31
                vn-market-calendar sessions   2024-05-02
                ```

                ## Supported exchanges

                | Exchange | Open date  | Tick size          |
                |----------|------------|--------------------|
                | HOSE     | 2000-07-28 | 10 / 50 / 100 VND  |
                | HNX      | 2005-03-14 | 100 VND flat       |
                | UPCOM    | 2009-06-24 | 100 VND flat       |

                ## Development

                ```
                make dev      # editable install
                make check    # lint + typecheck + tests
                ```

                **First-time repo setup:** `gh workflow run repo-setup.yml`  sets GitHub topics and homepage.

                **PyPI trusted publishing** (one-time, no stored secrets):
                1. PyPI -> Manage -> Settings -> Publishing -> Add trusted publisher
                2. Workflow: `publish.yml`, Environment: `pypi`

                ## License

                MIT (c) DataCore Vietnam
                

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

vn_market_calendar-0.2.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

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

vn_market_calendar-0.2.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file vn_market_calendar-0.2.0.tar.gz.

File metadata

  • Download URL: vn_market_calendar-0.2.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for vn_market_calendar-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e3a95f8dc9066e6b1706f4a748c2fa5a5dd33978789085d0bcb079ed30ba2455
MD5 5688a146dfb6bc5374412b28f53b8a88
BLAKE2b-256 ea6512d4a637ab9075adcb9a8b224e8420c368ede06816ed5bbc8d9ee66eac00

See more details on using hashes here.

Provenance

The following attestation bundles were made for vn_market_calendar-0.2.0.tar.gz:

Publisher: publish.yml on DataCore-VietNam/vn-market-calendar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vn_market_calendar-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vn_market_calendar-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7060e849e98836fd4050283977fa38a8c0b5cb4bce232f151b41d6abfa8410b1
MD5 10f3f0f95938060194b86032d712ddd5
BLAKE2b-256 c2a93bfe3538b03ff9c9d45bed8812449a16e0125e8a0b7dc55be7a6ba0d533d

See more details on using hashes here.

Provenance

The following attestation bundles were made for vn_market_calendar-0.2.0-py3-none-any.whl:

Publisher: publish.yml on DataCore-VietNam/vn-market-calendar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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