@piaa/sdk 1.0.2 → 1.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 CHANGED
@@ -8,12 +8,11 @@ Designed for institutional algorithmic traders, fintech dashboards, and quantita
8
8
 
9
9
  ## Features
10
10
 
11
- - **Zero-Fuss Sensible Defaults**: Connect in 3 lines of code with pre-configured endpoints and sensible timeout/retry defaults.
12
- - 🔁 **Enterprise Resiliency**: Automatic exponential backoff with full jitter for transient 5xx/429 network hiccups and retry-after headers.
13
- - 🛡️ **Typed Error Hierarchy**: Clear, actionable, strongly-typed errors (`AuthenticationError`, `RateLimitError`, `TimeoutError`, `ValidationError`, `NetworkError`).
14
- - 🔒 **Zero Sensitive Data Leaks**: Automatic redaction of API keys, bearer tokens, and secrets from error logs and stack traces.
15
- - 📡 **Cross-Platform Realtime Streaming**: Built-in resilient WebSocket client with **In-Band Message Authentication**, ping/pong keep-alives, and automatic re-subscription on reconnect.
16
- - 📊 **Rate Limit Telemetry**: Real-time inspection of RFC 6585 and daily quota headers (`X-RateLimit-*`, `X-DailyQuota-*`).
11
+ - **Zero-Fuss Sensible Defaults**: Connect in 3 lines of code with pre-configured endpoints and sensible timeout/retry defaults.
12
+ - **Typed Error Hierarchy**: Clear, actionable, strongly-typed errors (`AuthenticationError`, `RateLimitError`, `TimeoutError`, `ValidationError`, `NetworkError`).
13
+ - **Zero Sensitive Data Leaks**: Automatic redaction of API keys, bearer tokens, and secrets from error logs and stack traces.
14
+ - **Cross-Platform Realtime Streaming**: Built-in resilient WebSocket client with **In-Band Message Authentication**, ping/pong keep-alives, and automatic re-subscription on reconnect.
15
+ - **Rate Limit Telemetry**: Real-time inspection of RFC 6585 and daily quota headers (`X-RateLimit-*`, `X-DailyQuota-*`).
17
16
 
18
17
  ---
19
18
 
package/dist/client.d.ts CHANGED
@@ -6,6 +6,8 @@ import { RealtimeClient } from "./realtime/socket";
6
6
  import { MarketResource } from "./resources/market";
7
7
  import { NewsResource } from "./resources/news";
8
8
  import { SocialResource } from "./resources/social";
9
+ import { EconomicResource } from "./resources/economic";
10
+ import { FixedIncomeResource } from "./resources/fixed-income";
9
11
  import { WsResource } from "./resources/ws";
10
12
  import type { RateLimitInfo } from "./types";
11
13
  export declare class PiaClient {
@@ -23,6 +25,14 @@ export declare class PiaClient {
23
25
  * Financial news resource.
24
26
  */
25
27
  readonly news: NewsResource;
28
+ /**
29
+ * Macroeconomic calendar and indicators resource.
30
+ */
31
+ readonly economic: EconomicResource;
32
+ /**
33
+ * Sovereign bond yields and fixed income rates resource.
34
+ */
35
+ readonly fixedIncome: FixedIncomeResource;
26
36
  /**
27
37
  * WebSocket ticket issuance resource.
28
38
  */
package/dist/index.d.ts CHANGED
@@ -6,6 +6,6 @@ export { PiaClient } from "./client";
6
6
  export { type PiaClientOptions, type ResolvedPiaConfig, resolveConfig, DEFAULT_BASE_URL, DEFAULT_WS_URL, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_RETRIES, } from "./config";
7
7
  export { PiaError, type PiaErrorDetails, ConfigurationError, ValidationError, AuthenticationError, PermissionError, RateLimitError, TimeoutError, NetworkError, ParseError, ApiError, } from "./errors";
8
8
  export { type PiaLogger, type LogLevel, DefaultLogger, redactSensitive, } from "./logger";
9
- export { type Timeframe, type RateLimitInfo, type RequestOptions, type MarketPrice, type MarketPricesResponse, type Candle, type CandleResponse, type GetCandlesOptions, type OrderBook, type OrderBookLevel, type SocialPost, type SocialFeedResponse, type GetSocialOptions, type NewsArticle, type NewsFeedResponse, type GetNewsOptions, type WsTicketResponse, } from "./types";
9
+ export { type Timeframe, type RateLimitInfo, type RequestOptions, type MarketPrice, type MarketPricesResponse, type Candle, type CandleResponse, type GetCandlesOptions, type OrderBook, type OrderBookLevel, type SocialPost, type SocialFeedResponse, type GetSocialOptions, type NewsArticle, type NewsFeedResponse, type GetNewsOptions, type EconomicEvent, type EconomicCalendarResponse, type GetCalendarOptions, type YieldCurvePoint, type YieldCurveResponse, type MarketInsight, type WsTicketResponse, } from "./types";
10
10
  export { RealtimeClient, type SocketState } from "./realtime/socket";
11
11
  export { type RealtimeEvents } from "./realtime/events";
package/dist/index.js CHANGED
@@ -731,6 +731,16 @@ class MarketResource {
731
731
  const cleanSymbol = symbol.trim().toUpperCase();
732
732
  return this.transport.request(`/api/v1/market/orderbook/${encodeURIComponent(cleanSymbol)}`, "GET", undefined, options);
733
733
  }
734
+ async getInsights(symbol, options) {
735
+ if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
736
+ throw new ValidationError("Symbol must be a non-empty string.", "symbol");
737
+ }
738
+ const cleanSymbol = symbol.trim().toUpperCase();
739
+ return this.transport.request(`/api/v1/market/insights/${encodeURIComponent(cleanSymbol)}`, "GET", undefined, options);
740
+ }
741
+ async getWhy(symbol, options) {
742
+ return this.getInsights(symbol, options);
743
+ }
734
744
  }
735
745
 
736
746
  // src/resources/news.ts
@@ -744,11 +754,19 @@ class NewsResource {
744
754
  if (options?.symbols && options.symbols.length > 0) {
745
755
  params.set("symbols", options.symbols.map((s) => s.trim().toUpperCase()).join(","));
746
756
  }
757
+ if (options?.category)
758
+ params.set("category", options.category);
747
759
  if (options?.limit)
748
760
  params.set("limit", String(options.limit));
749
761
  const query = params.toString() ? `?${params.toString()}` : "";
750
762
  return this.transport.request(`/api/v1/news${query}`, "GET", undefined, options);
751
763
  }
764
+ async getLatest(options) {
765
+ return this.transport.request("/api/v1/news/latest", "GET", undefined, options);
766
+ }
767
+ async getById(id, options) {
768
+ return this.transport.request(`/api/v1/news/${encodeURIComponent(id)}`, "GET", undefined, options);
769
+ }
752
770
  }
753
771
 
754
772
  // src/resources/social.ts
@@ -757,7 +775,7 @@ class SocialResource {
757
775
  constructor(transport) {
758
776
  this.transport = transport;
759
777
  }
760
- async getPosts(options) {
778
+ async getFeed(options) {
761
779
  const params = new URLSearchParams;
762
780
  if (options?.symbol)
763
781
  params.set("symbol", options.symbol.trim().toUpperCase());
@@ -766,7 +784,44 @@ class SocialResource {
766
784
  if (options?.cursor)
767
785
  params.set("cursor", options.cursor);
768
786
  const query = params.toString() ? `?${params.toString()}` : "";
769
- return this.transport.request(`/api/v1/social/posts${query}`, "GET", undefined, options);
787
+ return this.transport.request(`/api/v1/social/feed${query}`, "GET", undefined, options);
788
+ }
789
+ async getPosts(options) {
790
+ return this.getFeed(options);
791
+ }
792
+ }
793
+
794
+ // src/resources/economic.ts
795
+ class EconomicResource {
796
+ transport;
797
+ constructor(transport) {
798
+ this.transport = transport;
799
+ }
800
+ async getCalendar(options) {
801
+ const params = new URLSearchParams;
802
+ if (options?.impact)
803
+ params.set("impact", options.impact);
804
+ if (options?.limit)
805
+ params.set("limit", String(options.limit));
806
+ const query = params.toString() ? `?${params.toString()}` : "";
807
+ return this.transport.request(`/api/v1/economic/calendar${query}`, "GET", undefined, options);
808
+ }
809
+ async getIndicators(options) {
810
+ return this.transport.request("/api/v1/economic/indicators", "GET", undefined, options);
811
+ }
812
+ }
813
+
814
+ // src/resources/fixed-income.ts
815
+ class FixedIncomeResource {
816
+ transport;
817
+ constructor(transport) {
818
+ this.transport = transport;
819
+ }
820
+ async getYieldCurve(options) {
821
+ return this.transport.request("/api/v1/fixed-income/yield-curve", "GET", undefined, options);
822
+ }
823
+ async getSpreads(options) {
824
+ return this.transport.request("/api/v1/fixed-income/spreads", "GET", undefined, options);
770
825
  }
771
826
  }
772
827
 
@@ -788,6 +843,8 @@ class PiaClient {
788
843
  market;
789
844
  social;
790
845
  news;
846
+ economic;
847
+ fixedIncome;
791
848
  ws;
792
849
  realtime;
793
850
  constructor(options = {}) {
@@ -796,6 +853,8 @@ class PiaClient {
796
853
  this.market = new MarketResource(this.transport);
797
854
  this.social = new SocialResource(this.transport);
798
855
  this.news = new NewsResource(this.transport);
856
+ this.economic = new EconomicResource(this.transport);
857
+ this.fixedIncome = new FixedIncomeResource(this.transport);
799
858
  this.ws = new WsResource(this.transport);
800
859
  this.realtime = new RealtimeClient(this.config);
801
860
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Official PIA SDK - Economic Intelligence API Resource
3
+ */
4
+ import type { HttpTransport } from "../http/transport";
5
+ import type { EconomicCalendarResponse, GetCalendarOptions, RequestOptions } from "../types";
6
+ export declare class EconomicResource {
7
+ private readonly transport;
8
+ constructor(transport: HttpTransport);
9
+ /**
10
+ * Fetches global macroeconomic calendar events (NFP, CPI, interest rates, GDP).
11
+ */
12
+ getCalendar(options?: GetCalendarOptions): Promise<EconomicCalendarResponse>;
13
+ /**
14
+ * Retrieves macroeconomic indicators and series metadata.
15
+ */
16
+ getIndicators(options?: RequestOptions): Promise<any>;
17
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Official PIA SDK - Fixed Income & Sovereign Rates API Resource
3
+ */
4
+ import type { HttpTransport } from "../http/transport";
5
+ import type { RequestOptions, YieldCurveResponse } from "../types";
6
+ export declare class FixedIncomeResource {
7
+ private readonly transport;
8
+ constructor(transport: HttpTransport);
9
+ /**
10
+ * Retrieves US Treasury sovereign bond yield curve structure across all standard tenors.
11
+ */
12
+ getYieldCurve(options?: RequestOptions): Promise<YieldCurveResponse>;
13
+ /**
14
+ * Retrieves sovereign yield spreads (2Y-10Y, 3M-10Y curve steepness indicators).
15
+ */
16
+ getSpreads(options?: RequestOptions): Promise<any>;
17
+ }
@@ -21,4 +21,12 @@ export declare class MarketResource {
21
21
  * Retrieves Level 2 DOM (Depth of Market) order book for a symbol.
22
22
  */
23
23
  getOrderBook(symbol: string, options?: RequestOptions): Promise<OrderBook>;
24
+ /**
25
+ * Retrieves AI/Quant market insights and price movement narrative for a given instrument.
26
+ */
27
+ getInsights(symbol: string, options?: RequestOptions): Promise<any>;
28
+ /**
29
+ * @deprecated Use `getInsights(symbol)` instead.
30
+ */
31
+ getWhy(symbol: string, options?: RequestOptions): Promise<any>;
24
32
  }
@@ -2,7 +2,7 @@
2
2
  * Official PIA SDK - News Intelligence API Resource
3
3
  */
4
4
  import type { HttpTransport } from "../http/transport";
5
- import type { GetNewsOptions, NewsFeedResponse } from "../types";
5
+ import type { GetNewsOptions, NewsFeedResponse, RequestOptions } from "../types";
6
6
  export declare class NewsResource {
7
7
  private readonly transport;
8
8
  constructor(transport: HttpTransport);
@@ -10,4 +10,12 @@ export declare class NewsResource {
10
10
  * Fetches curated financial and macro news articles.
11
11
  */
12
12
  getNews(options?: GetNewsOptions): Promise<NewsFeedResponse>;
13
+ /**
14
+ * Fetches the latest breaking financial news bulletin.
15
+ */
16
+ getLatest(options?: RequestOptions): Promise<any>;
17
+ /**
18
+ * Fetches detailed intelligence for a specific news article ID.
19
+ */
20
+ getById(id: string, options?: RequestOptions): Promise<any>;
13
21
  }
@@ -9,5 +9,9 @@ export declare class SocialResource {
9
9
  /**
10
10
  * Fetches the latest social sentiment posts and discussions.
11
11
  */
12
+ getFeed(options?: GetSocialOptions): Promise<SocialFeedResponse>;
13
+ /**
14
+ * @deprecated Use `getFeed(options)` instead.
15
+ */
12
16
  getPosts(options?: GetSocialOptions): Promise<SocialFeedResponse>;
13
17
  }
package/dist/types.d.ts CHANGED
@@ -98,8 +98,45 @@ export interface NewsFeedResponse {
98
98
  }
99
99
  export interface GetNewsOptions extends RequestOptions {
100
100
  symbols?: string[];
101
+ category?: "forex" | "stock" | "all" | string;
101
102
  limit?: number;
102
103
  }
104
+ export interface EconomicEvent {
105
+ id?: string;
106
+ event: string;
107
+ country: string;
108
+ currency?: string;
109
+ date: string;
110
+ time?: string;
111
+ actual?: number | null;
112
+ forecast?: number | null;
113
+ previous?: number | null;
114
+ impact?: "high" | "medium" | "low" | string;
115
+ }
116
+ export interface EconomicCalendarResponse {
117
+ total: number;
118
+ items: EconomicEvent[];
119
+ }
120
+ export interface GetCalendarOptions extends RequestOptions {
121
+ impact?: string;
122
+ limit?: number;
123
+ }
124
+ export interface YieldCurvePoint {
125
+ tenor: string;
126
+ yield: number;
127
+ date?: string;
128
+ }
129
+ export interface YieldCurveResponse {
130
+ date: string;
131
+ points: YieldCurvePoint[];
132
+ }
133
+ export interface MarketInsight {
134
+ symbol: string;
135
+ title: string;
136
+ summary: string;
137
+ sentiment?: string;
138
+ confidence?: number;
139
+ }
103
140
  export interface WsTicketResponse {
104
141
  ticket: string;
105
142
  expires_in?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piaa/sdk",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Official TypeScript/JavaScript SDK for PIA Market Intelligence Platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",