@newyorkcompute/kalshi-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # @newyorkcompute/kalshi-core
2
+
3
+ Shared utilities for Kalshi prediction market tools — SDK configuration, formatting, and types.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @newyorkcompute/kalshi-core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Configuration
14
+
15
+ ```typescript
16
+ import {
17
+ getKalshiConfig,
18
+ createMarketApi,
19
+ createPortfolioApi,
20
+ } from "@newyorkcompute/kalshi-core";
21
+
22
+ // Get config from environment variables
23
+ const config = getKalshiConfig();
24
+
25
+ // Create API clients
26
+ const marketApi = createMarketApi(config);
27
+ const portfolioApi = createPortfolioApi(config);
28
+ ```
29
+
30
+ ### Formatting
31
+
32
+ ```typescript
33
+ import {
34
+ formatPrice,
35
+ formatCurrency,
36
+ formatPriceChange,
37
+ } from "@newyorkcompute/kalshi-core";
38
+
39
+ formatPrice(45); // "45¢"
40
+ formatCurrency(4500); // "$45.00"
41
+ formatPriceChange(2); // "▲ +2"
42
+ formatPriceChange(-3); // "▼ -3"
43
+ ```
44
+
45
+ ## Environment Variables
46
+
47
+ | Variable | Required | Description |
48
+ |----------|----------|-------------|
49
+ | `KALSHI_API_KEY` | Yes | Your Kalshi API key ID |
50
+ | `KALSHI_PRIVATE_KEY` | Yes | RSA private key (PEM format) |
51
+ | `KALSHI_BASE_PATH` | No | API base URL (default: production) |
52
+
53
+ ## License
54
+
55
+ MIT © [NewYorkCompute](https://github.com/newyorkcompute)
56
+
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Kalshi SDK Configuration
3
+ *
4
+ * Provides configuration and factory functions for Kalshi API clients.
5
+ */
6
+ import { Configuration, MarketApi, PortfolioApi, OrdersApi, EventsApi } from "kalshi-typescript";
7
+ /**
8
+ * Kalshi API configuration
9
+ */
10
+ export interface KalshiConfig {
11
+ apiKey: string;
12
+ privateKey: string;
13
+ basePath: string;
14
+ }
15
+ /**
16
+ * Default Kalshi API base path (production)
17
+ */
18
+ export declare const DEFAULT_BASE_PATH = "https://api.elections.kalshi.com/trade-api/v2";
19
+ /**
20
+ * Demo/sandbox API base path
21
+ */
22
+ export declare const DEMO_BASE_PATH = "https://demo-api.kalshi.co/trade-api/v2";
23
+ /**
24
+ * Get Kalshi configuration from environment variables
25
+ *
26
+ * @throws Error if required environment variables are missing
27
+ */
28
+ export declare function getKalshiConfig(): KalshiConfig;
29
+ /**
30
+ * Create a configured Kalshi SDK Configuration instance
31
+ */
32
+ export declare function createSdkConfig(config: KalshiConfig): Configuration;
33
+ /**
34
+ * Create a MarketApi instance with the given configuration
35
+ */
36
+ export declare function createMarketApi(config: KalshiConfig): MarketApi;
37
+ /**
38
+ * Create a PortfolioApi instance with the given configuration
39
+ */
40
+ export declare function createPortfolioApi(config: KalshiConfig): PortfolioApi;
41
+ /**
42
+ * Create an OrdersApi instance with the given configuration
43
+ */
44
+ export declare function createOrdersApi(config: KalshiConfig): OrdersApi;
45
+ /**
46
+ * Create an EventsApi instance with the given configuration
47
+ */
48
+ export declare function createEventsApi(config: KalshiConfig): EventsApi;
49
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,SAAS,EACT,SAAS,EACV,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,kDAAkD,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,cAAc,4CAA4C,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAc9C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CAMnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAG/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAGrE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAG/D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAG/D"}
package/dist/config.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Kalshi SDK Configuration
3
+ *
4
+ * Provides configuration and factory functions for Kalshi API clients.
5
+ */
6
+ import { Configuration, MarketApi, PortfolioApi, OrdersApi, EventsApi, } from "kalshi-typescript";
7
+ /**
8
+ * Default Kalshi API base path (production)
9
+ */
10
+ export const DEFAULT_BASE_PATH = "https://api.elections.kalshi.com/trade-api/v2";
11
+ /**
12
+ * Demo/sandbox API base path
13
+ */
14
+ export const DEMO_BASE_PATH = "https://demo-api.kalshi.co/trade-api/v2";
15
+ /**
16
+ * Get Kalshi configuration from environment variables
17
+ *
18
+ * @throws Error if required environment variables are missing
19
+ */
20
+ export function getKalshiConfig() {
21
+ const apiKey = process.env.KALSHI_API_KEY;
22
+ const privateKey = process.env.KALSHI_PRIVATE_KEY;
23
+ const basePath = process.env.KALSHI_BASE_PATH || DEFAULT_BASE_PATH;
24
+ if (!apiKey) {
25
+ throw new Error("KALSHI_API_KEY environment variable is required");
26
+ }
27
+ if (!privateKey) {
28
+ throw new Error("KALSHI_PRIVATE_KEY environment variable is required");
29
+ }
30
+ return { apiKey, privateKey, basePath };
31
+ }
32
+ /**
33
+ * Create a configured Kalshi SDK Configuration instance
34
+ */
35
+ export function createSdkConfig(config) {
36
+ return new Configuration({
37
+ apiKey: config.apiKey,
38
+ privateKeyPem: config.privateKey,
39
+ basePath: config.basePath,
40
+ });
41
+ }
42
+ /**
43
+ * Create a MarketApi instance with the given configuration
44
+ */
45
+ export function createMarketApi(config) {
46
+ const sdkConfig = createSdkConfig(config);
47
+ return new MarketApi(sdkConfig);
48
+ }
49
+ /**
50
+ * Create a PortfolioApi instance with the given configuration
51
+ */
52
+ export function createPortfolioApi(config) {
53
+ const sdkConfig = createSdkConfig(config);
54
+ return new PortfolioApi(sdkConfig);
55
+ }
56
+ /**
57
+ * Create an OrdersApi instance with the given configuration
58
+ */
59
+ export function createOrdersApi(config) {
60
+ const sdkConfig = createSdkConfig(config);
61
+ return new OrdersApi(sdkConfig);
62
+ }
63
+ /**
64
+ * Create an EventsApi instance with the given configuration
65
+ */
66
+ export function createEventsApi(config) {
67
+ const sdkConfig = createSdkConfig(config);
68
+ return new EventsApi(sdkConfig);
69
+ }
70
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,SAAS,EACT,SAAS,GACV,MAAM,mBAAmB,CAAC;AAW3B;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,+CAA+C,CAAC;AAEjF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,yCAAyC,CAAC;AAExE;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC1C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,iBAAiB,CAAC;IAEnE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB;IAClD,OAAO,IAAI,aAAa,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,aAAa,EAAE,MAAM,CAAC,UAAU;QAChC,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB;IAClD,MAAM,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAoB;IACrD,MAAM,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,IAAI,YAAY,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB;IAClD,MAAM,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB;IAClD,MAAM,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Formatting Utilities
3
+ *
4
+ * Common formatting functions for Kalshi market data.
5
+ */
6
+ /**
7
+ * Format a price in cents to a display string (e.g., 45 -> "45¢")
8
+ */
9
+ export declare function formatPrice(cents: number | undefined | null): string;
10
+ /**
11
+ * Format a price in cents to dollars (e.g., 4500 -> "$45.00")
12
+ */
13
+ export declare function formatCurrency(cents: number | undefined | null): string;
14
+ /**
15
+ * Format a number as a percentage (e.g., 0.45 -> "45%")
16
+ */
17
+ export declare function formatPercent(value: number | undefined | null): string;
18
+ /**
19
+ * Format a price change with indicator (e.g., 2 -> "▲ +2", -3 -> "▼ -3", 0 -> "━ 0")
20
+ */
21
+ export declare function formatPriceChange(change: number): string;
22
+ /**
23
+ * Format a large number with abbreviations (e.g., 1500000 -> "1.5M")
24
+ */
25
+ export declare function formatCompactNumber(value: number | undefined | null): string;
26
+ /**
27
+ * Format a timestamp to a relative time string
28
+ */
29
+ export declare function formatRelativeTime(timestamp: string | Date): string;
30
+ /**
31
+ * Truncate a string to a maximum length with ellipsis
32
+ */
33
+ export declare function truncate(str: string, maxLength: number): string;
34
+ /**
35
+ * Pad a string to a fixed width (left or right aligned)
36
+ */
37
+ export declare function padString(str: string, width: number, align?: "left" | "right"): string;
38
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAKpE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAMvE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAKtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAY5E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAuBnE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAM,GAAG,OAAgB,GAC/B,MAAM,CAMR"}
package/dist/format.js ADDED
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Formatting Utilities
3
+ *
4
+ * Common formatting functions for Kalshi market data.
5
+ */
6
+ /**
7
+ * Format a price in cents to a display string (e.g., 45 -> "45¢")
8
+ */
9
+ export function formatPrice(cents) {
10
+ if (cents === undefined || cents === null) {
11
+ return "—";
12
+ }
13
+ return `${cents}¢`;
14
+ }
15
+ /**
16
+ * Format a price in cents to dollars (e.g., 4500 -> "$45.00")
17
+ */
18
+ export function formatCurrency(cents) {
19
+ if (cents === undefined || cents === null) {
20
+ return "—";
21
+ }
22
+ const dollars = cents / 100;
23
+ return `$${dollars.toFixed(2)}`;
24
+ }
25
+ /**
26
+ * Format a number as a percentage (e.g., 0.45 -> "45%")
27
+ */
28
+ export function formatPercent(value) {
29
+ if (value === undefined || value === null) {
30
+ return "—";
31
+ }
32
+ return `${Math.round(value * 100)}%`;
33
+ }
34
+ /**
35
+ * Format a price change with indicator (e.g., 2 -> "▲ +2", -3 -> "▼ -3", 0 -> "━ 0")
36
+ */
37
+ export function formatPriceChange(change) {
38
+ if (change > 0) {
39
+ return `▲ +${change}`;
40
+ }
41
+ else if (change < 0) {
42
+ return `▼ ${change}`;
43
+ }
44
+ return "━ 0";
45
+ }
46
+ /**
47
+ * Format a large number with abbreviations (e.g., 1500000 -> "1.5M")
48
+ */
49
+ export function formatCompactNumber(value) {
50
+ if (value === undefined || value === null) {
51
+ return "—";
52
+ }
53
+ if (value >= 1_000_000) {
54
+ return `${(value / 1_000_000).toFixed(1)}M`;
55
+ }
56
+ if (value >= 1_000) {
57
+ return `${(value / 1_000).toFixed(1)}K`;
58
+ }
59
+ return value.toString();
60
+ }
61
+ /**
62
+ * Format a timestamp to a relative time string
63
+ */
64
+ export function formatRelativeTime(timestamp) {
65
+ const date = typeof timestamp === "string" ? new Date(timestamp) : timestamp;
66
+ const now = new Date();
67
+ const diffMs = date.getTime() - now.getTime();
68
+ const diffSecs = Math.abs(Math.floor(diffMs / 1000));
69
+ const diffMins = Math.floor(diffSecs / 60);
70
+ const diffHours = Math.floor(diffMins / 60);
71
+ const diffDays = Math.floor(diffHours / 24);
72
+ const isPast = diffMs < 0;
73
+ const suffix = isPast ? " ago" : "";
74
+ const prefix = isPast ? "" : "in ";
75
+ if (diffDays > 0) {
76
+ return `${prefix}${diffDays}d${suffix}`;
77
+ }
78
+ if (diffHours > 0) {
79
+ return `${prefix}${diffHours}h${suffix}`;
80
+ }
81
+ if (diffMins > 0) {
82
+ return `${prefix}${diffMins}m${suffix}`;
83
+ }
84
+ return "now";
85
+ }
86
+ /**
87
+ * Truncate a string to a maximum length with ellipsis
88
+ */
89
+ export function truncate(str, maxLength) {
90
+ if (str.length <= maxLength) {
91
+ return str;
92
+ }
93
+ return str.slice(0, maxLength - 1) + "…";
94
+ }
95
+ /**
96
+ * Pad a string to a fixed width (left or right aligned)
97
+ */
98
+ export function padString(str, width, align = "left") {
99
+ if (str.length >= width) {
100
+ return str.slice(0, width);
101
+ }
102
+ const padding = " ".repeat(width - str.length);
103
+ return align === "left" ? str + padding : padding + str;
104
+ }
105
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgC;IAC1D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAA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AE,CAAC;IAC3C,CAAC;IACD,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACjB,OAAO,GAAG,MAAM,GAAG,QAAQ,IAAI,MAAM,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,SAAiB;IACrD,IAAI,GAAG,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CACvB,GAAW,EACX,KAAa,EACb,QAA0B,MAAM;IAEhC,IAAI,GAAG,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/C,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=format.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.test.d.ts","sourceRoot":"","sources":["../src/format.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,90 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { formatPrice, formatCurrency, formatPercent, formatPriceChange, formatCompactNumber, truncate, padString, } from "./format.js";
3
+ describe("formatPrice", () => {
4
+ it("formats cents with cent symbol", () => {
5
+ expect(formatPrice(45)).toBe("45¢");
6
+ expect(formatPrice(99)).toBe("99¢");
7
+ expect(formatPrice(1)).toBe("1¢");
8
+ });
9
+ it("returns dash for null/undefined", () => {
10
+ expect(formatPrice(null)).toBe("—");
11
+ expect(formatPrice(undefined)).toBe("—");
12
+ });
13
+ });
14
+ describe("formatCurrency", () => {
15
+ it("formats cents as dollars", () => {
16
+ expect(formatCurrency(4500)).toBe("$45.00");
17
+ expect(formatCurrency(100)).toBe("$1.00");
18
+ expect(formatCurrency(50)).toBe("$0.50");
19
+ });
20
+ it("returns dash for null/undefined", () => {
21
+ expect(formatCurrency(null)).toBe("—");
22
+ expect(formatCurrency(undefined)).toBe("—");
23
+ });
24
+ });
25
+ describe("formatPercent", () => {
26
+ it("formats decimal as percentage", () => {
27
+ expect(formatPercent(0.45)).toBe("45%");
28
+ expect(formatPercent(1)).toBe("100%");
29
+ expect(formatPercent(0.05)).toBe("5%");
30
+ });
31
+ it("returns dash for null/undefined", () => {
32
+ expect(formatPercent(null)).toBe("—");
33
+ expect(formatPercent(undefined)).toBe("—");
34
+ });
35
+ });
36
+ describe("formatPriceChange", () => {
37
+ it("shows up arrow for positive change", () => {
38
+ expect(formatPriceChange(2)).toBe("▲ +2");
39
+ expect(formatPriceChange(10)).toBe("▲ +10");
40
+ });
41
+ it("shows down arrow for negative change", () => {
42
+ expect(formatPriceChange(-3)).toBe("▼ -3");
43
+ expect(formatPriceChange(-15)).toBe("▼ -15");
44
+ });
45
+ it("shows horizontal line for no change", () => {
46
+ expect(formatPriceChange(0)).toBe("━ 0");
47
+ });
48
+ });
49
+ describe("formatCompactNumber", () => {
50
+ it("formats millions with M suffix", () => {
51
+ expect(formatCompactNumber(1_500_000)).toBe("1.5M");
52
+ expect(formatCompactNumber(10_000_000)).toBe("10.0M");
53
+ });
54
+ it("formats thousands with K suffix", () => {
55
+ expect(formatCompactNumber(1_500)).toBe("1.5K");
56
+ expect(formatCompactNumber(50_000)).toBe("50.0K");
57
+ });
58
+ it("leaves small numbers as-is", () => {
59
+ expect(formatCompactNumber(500)).toBe("500");
60
+ expect(formatCompactNumber(42)).toBe("42");
61
+ });
62
+ it("returns dash for null/undefined", () => {
63
+ expect(formatCompactNumber(null)).toBe("—");
64
+ expect(formatCompactNumber(undefined)).toBe("—");
65
+ });
66
+ });
67
+ describe("truncate", () => {
68
+ it("truncates long strings with ellipsis", () => {
69
+ expect(truncate("Hello World", 8)).toBe("Hello W…");
70
+ expect(truncate("Very Long String", 10)).toBe("Very Long…");
71
+ });
72
+ it("returns short strings unchanged", () => {
73
+ expect(truncate("Hello", 10)).toBe("Hello");
74
+ expect(truncate("Hi", 5)).toBe("Hi");
75
+ });
76
+ });
77
+ describe("padString", () => {
78
+ it("pads strings to the right by default", () => {
79
+ expect(padString("Hi", 5)).toBe("Hi ");
80
+ expect(padString("Test", 8)).toBe("Test ");
81
+ });
82
+ it("pads strings to the left when specified", () => {
83
+ expect(padString("Hi", 5, "right")).toBe(" Hi");
84
+ expect(padString("42", 5, "right")).toBe(" 42");
85
+ });
86
+ it("truncates strings that are too long", () => {
87
+ expect(padString("Hello World", 5)).toBe("Hello");
88
+ });
89
+ });
90
+ //# sourceMappingURL=format.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.test.js","sourceRoot":"","sources":["../src/format.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,WAAW,EACX,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CAAC,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fig, createMarketApi, createPortfolioApi, createOrdersApi, createEventsApi, } from "./config.js";
7
+ export { formatPrice, formatCurrency, formatPercent, formatPriceChange, formatCompactNumber, formatRelativeTime, truncate, padString, } from "./format.js";
8
+ export * from "./types.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,KAAK,YAAY,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,WAAW,EACX,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,SAAS,GACV,MAAM,aAAa,CAAC;AAGrB,cAAc,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @newyorkcompute/kalshi-core
3
+ *
4
+ * Shared utilities for Kalshi prediction market tools.
5
+ */
6
+ // Configuration
7
+ export { DEFAULT_BASE_PATH, DEMO_BASE_PATH, getKalshiConfig, createSdkConfig, createMarketApi, createPortfolioApi, createOrdersApi, createEventsApi, } from "./config.js";
8
+ // Formatting utilities
9
+ export { formatPrice, formatCurrency, formatPercent, formatPriceChange, formatCompactNumber, formatRelativeTime, truncate, padString, } from "./format.js";
10
+ // Types
11
+ export * from "./types.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,gBAAgB;AAChB,OAAO,EAEL,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,uBAAuB;AACvB,OAAO,EACL,WAAW,EACX,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,QAAQ;AACR,cAAc,YAAY,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Re-exported Types from kalshi-typescript
3
+ *
4
+ * Only exports types that are verified to exist in the SDK.
5
+ * For response types, use the API methods directly.
6
+ */
7
+ export type { MarketApi, PortfolioApi, OrdersApi, EventsApi, Configuration, } from "kalshi-typescript";
8
+ export { GetMarketsStatusEnum, GetEventsStatusEnum, CreateOrderRequestSideEnum, CreateOrderRequestActionEnum, CreateOrderRequestTypeEnum, } from "kalshi-typescript";
9
+ /**
10
+ * Side of an order or position
11
+ */
12
+ export type Side = "yes" | "no";
13
+ /**
14
+ * Action for an order
15
+ */
16
+ export type Action = "buy" | "sell";
17
+ /**
18
+ * Order type
19
+ */
20
+ export type OrderType = "limit" | "market";
21
+ /**
22
+ * Market status
23
+ */
24
+ export type MarketStatus = "open" | "closed" | "settled";
25
+ /**
26
+ * Order status
27
+ */
28
+ export type OrderStatus = "resting" | "canceled" | "executed" | "pending";
29
+ /**
30
+ * Simplified Market interface for display
31
+ */
32
+ export interface MarketDisplay {
33
+ ticker: string;
34
+ title: string;
35
+ status: MarketStatus;
36
+ yes_bid?: number;
37
+ yes_ask?: number;
38
+ no_bid?: number;
39
+ no_ask?: number;
40
+ volume?: number;
41
+ open_interest?: number;
42
+ close_time?: string;
43
+ }
44
+ /**
45
+ * Simplified Position interface for display
46
+ */
47
+ export interface PositionDisplay {
48
+ ticker: string;
49
+ position: number;
50
+ market_exposure: number;
51
+ realized_pnl?: number;
52
+ total_traded?: number;
53
+ }
54
+ /**
55
+ * Simplified Order interface for display
56
+ */
57
+ export interface OrderDisplay {
58
+ order_id: string;
59
+ ticker: string;
60
+ side: Side;
61
+ action: Action;
62
+ type: OrderType;
63
+ count: number;
64
+ remaining_count: number;
65
+ yes_price?: number;
66
+ no_price?: number;
67
+ status: string;
68
+ created_time?: string;
69
+ }
70
+ /**
71
+ * Orderbook level [price, quantity]
72
+ */
73
+ export type OrderbookLevel = [number, number];
74
+ /**
75
+ * Simplified Orderbook interface for display
76
+ */
77
+ export interface OrderbookDisplay {
78
+ yes: OrderbookLevel[];
79
+ no: OrderbookLevel[];
80
+ }
81
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,SAAS,EACT,YAAY,EACZ,SAAS,EACT,SAAS,EACT,aAAa,GACd,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,cAAc,EAAE,CAAC;IACtB,EAAE,EAAE,cAAc,EAAE,CAAC;CACtB"}
package/dist/types.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Re-exported Types from kalshi-typescript
3
+ *
4
+ * Only exports types that are verified to exist in the SDK.
5
+ * For response types, use the API methods directly.
6
+ */
7
+ // Re-export enums
8
+ export { GetMarketsStatusEnum, GetEventsStatusEnum, CreateOrderRequestSideEnum, CreateOrderRequestActionEnum, CreateOrderRequestTypeEnum, } from "kalshi-typescript";
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,kBAAkB;AAClB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@newyorkcompute/kalshi-core",
3
+ "version": "0.1.0",
4
+ "description": "Shared utilities for Kalshi prediction market tools — SDK configuration, formatting, and types",
5
+ "author": "NewYorkCompute",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/newyorkcompute/kalshi",
22
+ "directory": "packages/core"
23
+ },
24
+ "keywords": [
25
+ "kalshi",
26
+ "prediction-markets",
27
+ "trading",
28
+ "api",
29
+ "sdk",
30
+ "utilities"
31
+ ],
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "dev": "tsc --watch",
38
+ "typecheck": "tsc --noEmit",
39
+ "lint": "eslint src/",
40
+ "lint:fix": "eslint src/ --fix",
41
+ "test": "vitest run",
42
+ "test:watch": "vitest"
43
+ },
44
+ "dependencies": {
45
+ "kalshi-typescript": "^3.3.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^22.15.29",
49
+ "eslint": "^9.28.0",
50
+ "@eslint/js": "^9.28.0",
51
+ "typescript-eslint": "^8.33.1",
52
+ "vitest": "^3.2.3"
53
+ }
54
+ }
55
+