isttz

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: MIT Imports: 1 Imported by: 0

README

kite-mcp-isttz

Go Reference

IST (Indian Standard Time) timezone helpers for the algo2go ecosystem. Provides time.Location wrappers for Asia/Kolkata plus market-hours helpers (NSE/BSE 09:15-15:30 IST) for Indian retail trading platforms.

Used by Sundeepg98/kite-mcp-server for scheduler tick alignment, briefing dispatch windows, and audit-log timestamp formatting.

Why a separate module?

IST + market-hours are orthogonal time primitives — usable by any algo2go project (broker dashboards, alerts, monitoring, future broker adapters) independent of kite-mcp-server. Centralizing as a module:

  • Lets IST helpers version independently of consumer business logic
  • Encourages consistent market-hours semantics across consumers
  • Keeps the dep-graph weight minimal for users who only need time helpers

Stability promise

v0.x — unstable. Function signatures may break between minor versions. Pin v0.1.0 deliberately. v1.0 ships only after the public function surface is reviewed for stability.

Install

go get github.com/algo2go/kite-mcp-isttz@v0.1.0

Public API

  • Location() *time.Location — returns Asia/Kolkata Location, panics on load failure (unrecoverable system tzdata absence)
  • Now() time.Time — current time in IST
  • Helpers for market-open / market-close / weekend detection (see isttz.go and pkg.go.dev for details)

Reference consumer

Sundeepg98/kite-mcp-server — used across:

  • kc/scheduler for cron-style tick alignment
  • kc/alerts/briefing.go for morning/EOD dispatch windows
  • kc/instruments/manager.go for cache-refresh windows
  • kc/domain/session.go for IST timestamp formatting

License

MIT — see LICENSE.

Authors

Original design: Sundeepg98 (Zerodha Tech). Multi-module promotion (2026-05-10): algo2go contributors.

Documentation

Overview

Package isttz provides the Asia/Kolkata timezone loaded once at init. This is a leaf package with zero internal dependencies, so any package in the module can import it without risk of circular imports.

Index

Constants

This section is empty.

Variables

View Source
var Location = func() *time.Location {
	loc, err := time.LoadLocation("Asia/Kolkata")
	if err != nil {
		panic("failed to load Asia/Kolkata timezone: " + err.Error())
	}
	return loc
}()

Location is the Asia/Kolkata timezone used throughout for IST operations. Loaded once at init; panics if tzdata is missing (Alpine needs the tzdata package).

Coverage note: the panic branch (line inside if err != nil) is unreachable on any system with tzdata installed. Go embeds tzdata since 1.15, and our Docker image includes the tzdata Alpine package. The 75% coverage reflects this untestable panic guard — not a gap in test quality.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL