@piaa/sdk 1.1.0 → 1.3.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 +36 -3
- package/dist/client.d.ts +31 -9
- package/dist/errors.d.ts +4 -0
- package/dist/index.d.ts +17 -6
- package/dist/index.js +225 -28
- package/dist/resources/economic.d.ts +8 -0
- package/dist/resources/energy.d.ts +41 -0
- package/dist/resources/geosignals.d.ts +53 -0
- package/dist/resources/intelligence.d.ts +41 -0
- package/dist/resources/macro.d.ts +29 -0
- package/dist/resources/market.d.ts +16 -0
- package/dist/resources/options.d.ts +25 -0
- package/dist/resources/sec.d.ts +38 -0
- package/dist/resources/social.d.ts +7 -5
- package/dist/types.d.ts +109 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,9 @@ Designed for institutional algorithmic traders, fintech dashboards, and quantita
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
11
|
- **Zero-Fuss Sensible Defaults**: Connect in 3 lines of code with pre-configured endpoints and sensible timeout/retry defaults.
|
|
12
|
+
- **Dual Proxy-Resilient Auth**: Transparently sends both standard `Authorization: Bearer <key>` and `x-api-key` headers to guarantee 100% compatibility across Cloudflare tunnels, WAFs, and internal gateways.
|
|
12
13
|
- **Typed Error Hierarchy**: Clear, actionable, strongly-typed errors (`AuthenticationError`, `RateLimitError`, `TimeoutError`, `ValidationError`, `NetworkError`).
|
|
14
|
+
- **Derivatives & Macro Intelligence**: Real-time Options Chain, Gamma Exposure (GEX), Fear & Greed Index, and CFTC Commitment of Traders (COT) positioning.
|
|
13
15
|
- **Zero Sensitive Data Leaks**: Automatic redaction of API keys, bearer tokens, and secrets from error logs and stack traces.
|
|
14
16
|
- **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
17
|
- **Rate Limit Telemetry**: Real-time inspection of RFC 6585 and daily quota headers (`X-RateLimit-*`, `X-DailyQuota-*`).
|
|
@@ -40,7 +42,7 @@ import { PiaClient, RateLimitError, AuthenticationError } from "@piaa/sdk";
|
|
|
40
42
|
|
|
41
43
|
// Automatically picks up process.env.PIA_API_KEY if omitted
|
|
42
44
|
const client = new PiaClient({
|
|
43
|
-
apiKey: "
|
|
45
|
+
apiKey: "wi_live_...",
|
|
44
46
|
});
|
|
45
47
|
|
|
46
48
|
async function run() {
|
|
@@ -59,7 +61,22 @@ async function run() {
|
|
|
59
61
|
});
|
|
60
62
|
console.log(`Fetched ${candles.count} bars for ${candles.symbol}`);
|
|
61
63
|
|
|
62
|
-
// 3.
|
|
64
|
+
// 3. Options Chain & Gamma Exposure (GEX)
|
|
65
|
+
const gex = await client.options.getGex("SPX");
|
|
66
|
+
console.log(`SPX Net GEX: $${gex.net_gex?.toLocaleString()} (0-Gamma: ${gex.zero_gamma_level})`);
|
|
67
|
+
|
|
68
|
+
// 4. Macro Sentiment & Positioning (Fear & Greed, COT)
|
|
69
|
+
const fg = await client.macro.getFearGreed();
|
|
70
|
+
console.log(`Fear & Greed Index: ${fg.score} (${fg.rating})`);
|
|
71
|
+
|
|
72
|
+
const cot = await client.macro.getCot("GOLD");
|
|
73
|
+
console.log(`Gold Commercial Net: ${cot.reports[0]?.net_position}`);
|
|
74
|
+
|
|
75
|
+
// 5. Social Discussions & Breaking News
|
|
76
|
+
const posts = await client.social.getPosts({ limit: 10, symbol: "BTC" });
|
|
77
|
+
console.log(`Latest post by @${posts.items[0]?.author_username}: "${posts.items[0]?.text}"`);
|
|
78
|
+
|
|
79
|
+
// 6. Inspect rate limit telemetry
|
|
63
80
|
const quota = client.getRateLimitInfo();
|
|
64
81
|
console.log(`Remaining daily hits: ${quota.dailyRemaining}/${quota.dailyLimit}`);
|
|
65
82
|
} catch (err) {
|
|
@@ -80,7 +97,7 @@ run();
|
|
|
80
97
|
|
|
81
98
|
### 2. Realtime WebSocket Streaming (In-Band Message Auth)
|
|
82
99
|
|
|
83
|
-
Cross-platform streaming without query-string leakage:
|
|
100
|
+
Cross-platform streaming without query-string token leakage:
|
|
84
101
|
|
|
85
102
|
```typescript
|
|
86
103
|
import { PiaClient } from "@piaa/sdk";
|
|
@@ -119,6 +136,22 @@ client.realtime.connect();
|
|
|
119
136
|
|
|
120
137
|
---
|
|
121
138
|
|
|
139
|
+
## Complete Resource Reference
|
|
140
|
+
|
|
141
|
+
| Resource | Methods | Endpoint | Description |
|
|
142
|
+
|---|---|---|---|
|
|
143
|
+
| `client.market` | `getPrices()`, `getCandles()`, `getOrderBook()` | `/api/v1/market/*` | Live price snapshot, ClickHouse OHLCV candles, and Level 2 DOM. |
|
|
144
|
+
| `client.options` | `getChain()`, `getGex()`, `getSummary()` | `/api/v1/options/*` | Full options chain, Gamma Exposure levels, and put/call sentiment. |
|
|
145
|
+
| `client.macro` | `getFearGreed()`, `getCot()`, `getCentralBankStance()` | `/api/v1/fear-greed`, `/api/v1/cot/*`, `/api/v1/central-banks/*` | Fear & Greed sentiment index, CFTC institutional COT reports, and central bank monetary policy stance. |
|
|
146
|
+
| `client.social` | `getPosts()`, `getFeed()` | `/api/v1/social/*` | Real-time social sentiment and discussion feeds from Twitter/𝕏. |
|
|
147
|
+
| `client.news` | `getNews()` | `/api/v1/news` | Curated multi-asset financial news headlines and articles. |
|
|
148
|
+
| `client.economic` | `getCalendar()` | `/api/v1/economic/calendar` | Global economic calendar events, CPI releases, and rate decisions. |
|
|
149
|
+
| `client.fixedIncome` | `getYieldCurve()` | `/api/v1/rates/yield-curve` | Benchmark sovereign bond yield curves across tenors. |
|
|
150
|
+
| `client.ws` | `createTicket()` | `/api/v1/ws/ticket` | Ephemeral single-use WebSocket connection tickets. |
|
|
151
|
+
| `client.realtime` | `connect()`, `subscribe()`, `unsubscribe()`, `disconnect()` | `/api/v1/ws` | Low-latency streaming socket client with event emitters. |
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
122
155
|
## Configuration Reference
|
|
123
156
|
|
|
124
157
|
```typescript
|
package/dist/client.d.ts
CHANGED
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
import { type PiaClientOptions, type ResolvedPiaConfig } from "./config";
|
|
5
5
|
import { RealtimeClient } from "./realtime/socket";
|
|
6
6
|
import { MarketResource } from "./resources/market";
|
|
7
|
-
import {
|
|
7
|
+
import { IntelligenceResource } from "./resources/intelligence";
|
|
8
|
+
import { OptionsResource } from "./resources/options";
|
|
9
|
+
import { MacroResource } from "./resources/macro";
|
|
10
|
+
import { GeosignalsResource } from "./resources/geosignals";
|
|
11
|
+
import { EnergyResource } from "./resources/energy";
|
|
12
|
+
import { SecResource } from "./resources/sec";
|
|
8
13
|
import { SocialResource } from "./resources/social";
|
|
14
|
+
import { NewsResource } from "./resources/news";
|
|
9
15
|
import { EconomicResource } from "./resources/economic";
|
|
10
16
|
import { FixedIncomeResource } from "./resources/fixed-income";
|
|
11
17
|
import { WsResource } from "./resources/ws";
|
|
@@ -17,6 +23,30 @@ export declare class PiaClient {
|
|
|
17
23
|
* Market data & prices API resource.
|
|
18
24
|
*/
|
|
19
25
|
readonly market: MarketResource;
|
|
26
|
+
/**
|
|
27
|
+
* AI-powered quantitative intelligence and narrative catalysts resource.
|
|
28
|
+
*/
|
|
29
|
+
readonly intelligence: IntelligenceResource;
|
|
30
|
+
/**
|
|
31
|
+
* Derivatives, options chain, and Gamma Exposure (GEX) resource.
|
|
32
|
+
*/
|
|
33
|
+
readonly options: OptionsResource;
|
|
34
|
+
/**
|
|
35
|
+
* Macro indicators, Fear & Greed index, COT positioning, and central banks.
|
|
36
|
+
*/
|
|
37
|
+
readonly macro: MacroResource;
|
|
38
|
+
/**
|
|
39
|
+
* Geopolitical risk alerts, conflict mapping, and asset exposure resource.
|
|
40
|
+
*/
|
|
41
|
+
readonly geosignals: GeosignalsResource;
|
|
42
|
+
/**
|
|
43
|
+
* Energy benchmarks, crude spreads, and natural gas storage resource.
|
|
44
|
+
*/
|
|
45
|
+
readonly energy: EnergyResource;
|
|
46
|
+
/**
|
|
47
|
+
* SEC EDGAR corporate filings (10-K, 10-Q, 8-K, Form 4) resource.
|
|
48
|
+
*/
|
|
49
|
+
readonly sec: SecResource;
|
|
20
50
|
/**
|
|
21
51
|
* Social sentiment and discussions resource.
|
|
22
52
|
*/
|
|
@@ -43,14 +73,6 @@ export declare class PiaClient {
|
|
|
43
73
|
readonly realtime: RealtimeClient;
|
|
44
74
|
/**
|
|
45
75
|
* Initializes a new PIA API Client.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* import { PiaClient } from "@piaa/sdk";
|
|
50
|
-
*
|
|
51
|
-
* const client = new PiaClient({ apiKey: "wi_live_..." });
|
|
52
|
-
* const prices = await client.market.getPrices();
|
|
53
|
-
* ```
|
|
54
76
|
*/
|
|
55
77
|
constructor(options?: PiaClientOptions);
|
|
56
78
|
/**
|
package/dist/errors.d.ts
CHANGED
|
@@ -93,3 +93,7 @@ export declare class ApiError extends PiaError {
|
|
|
93
93
|
readonly rawBody?: unknown;
|
|
94
94
|
constructor(message: string, statusCode: number, rawBody?: unknown, details?: PiaErrorDetails);
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Sanitizes and redacts API keys and secrets from string representations.
|
|
98
|
+
*/
|
|
99
|
+
export declare function redactSensitive(input: string): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,20 @@
|
|
|
3
3
|
* Enterprise market intelligence & realtime streaming SDK.
|
|
4
4
|
*/
|
|
5
5
|
export { PiaClient } from "./client";
|
|
6
|
-
export { type PiaClientOptions, type ResolvedPiaConfig, resolveConfig,
|
|
7
|
-
export { PiaError,
|
|
8
|
-
export { type
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
6
|
+
export { type PiaClientOptions, type ResolvedPiaConfig, resolveConfig, } from "./config";
|
|
7
|
+
export { PiaError, ConfigurationError, ValidationError, AuthenticationError, PermissionError, RateLimitError, TimeoutError, NetworkError, ParseError, ApiError, redactSensitive, } from "./errors";
|
|
8
|
+
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 SocialPostItem, type SocialPostsResponse, type GetSocialPostsOptions, type GetSocialOptions, type NewsArticle, type NewsFeedResponse, type GetNewsOptions, type EconomicEvent, type EconomicCalendarResponse, type GetCalendarOptions, type YieldCurvePoint, type YieldCurveResponse, type WsTicketResponse, type OptionContract, type OptionChainResponse, type OptionGexResponse, type OptionSummaryResponse, type FearGreedData, type FearGreedHistoryResponse, type CotPositioning, type CotReportResponse, type CentralBankStanceResponse, } from "./types";
|
|
9
|
+
export { RealtimeClient, type SocketState, } from "./realtime/socket";
|
|
10
|
+
export { type RealtimeEvents, } from "./realtime/events";
|
|
11
|
+
export { MarketResource } from "./resources/market";
|
|
12
|
+
export { IntelligenceResource, type IntelligenceAnalyzeRequest, type IntelligenceAnalyzeResponse, type MarketInsightResponse } from "./resources/intelligence";
|
|
13
|
+
export { OptionsResource } from "./resources/options";
|
|
14
|
+
export { MacroResource } from "./resources/macro";
|
|
15
|
+
export { GeosignalsResource, type GeoSignalEvent, type GeoSignalsResponse, type GeoSignalsMapResponse, type GeoSignalsAssetImpactResponse } from "./resources/geosignals";
|
|
16
|
+
export { EnergyResource, type EnergyDashboardResponse, type EnergySeriesResponse } from "./resources/energy";
|
|
17
|
+
export { SecResource, type SecFilingItem, type SecFilingsResponse, type GetSecFilingsOptions } from "./resources/sec";
|
|
18
|
+
export { SocialResource } from "./resources/social";
|
|
19
|
+
export { NewsResource } from "./resources/news";
|
|
20
|
+
export { EconomicResource } from "./resources/economic";
|
|
21
|
+
export { FixedIncomeResource } from "./resources/fixed-income";
|
|
22
|
+
export { WsResource } from "./resources/ws";
|
package/dist/index.js
CHANGED
|
@@ -100,6 +100,15 @@ class ApiError extends PiaError {
|
|
|
100
100
|
this.rawBody = rawBody;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
+
function redactSensitive(input) {
|
|
104
|
+
if (!input || typeof input !== "string")
|
|
105
|
+
return input;
|
|
106
|
+
return input.replace(/wi_live_([a-zA-Z0-9_-]+)/g, (_match, p1) => {
|
|
107
|
+
if (p1.length <= 4)
|
|
108
|
+
return "wi_live_***";
|
|
109
|
+
return `wi_live_***${p1.slice(-4)}`;
|
|
110
|
+
}).replace(/Bearer\s+[a-zA-Z0-9._-]+/gi, "Bearer [REDACTED]");
|
|
111
|
+
}
|
|
103
112
|
|
|
104
113
|
// src/logger.ts
|
|
105
114
|
var SENSITIVE_KEY_PATTERNS = [
|
|
@@ -108,7 +117,7 @@ var SENSITIVE_KEY_PATTERNS = [
|
|
|
108
117
|
/api[_-]?key["':\s]+["']?([a-zA-Z0-9_-]+)["']?/gi,
|
|
109
118
|
/password["':\s]+["']?([^"'\s]+)["']?/gi
|
|
110
119
|
];
|
|
111
|
-
function
|
|
120
|
+
function redactSensitive2(input) {
|
|
112
121
|
let redacted = input;
|
|
113
122
|
for (const pattern of SENSITIVE_KEY_PATTERNS) {
|
|
114
123
|
redacted = redacted.replace(pattern, (match) => {
|
|
@@ -138,13 +147,13 @@ class DefaultLogger {
|
|
|
138
147
|
this.levelNum = LOG_LEVELS[level] ?? LOG_LEVELS.warn;
|
|
139
148
|
}
|
|
140
149
|
safeFormat(msg, args) {
|
|
141
|
-
const cleanMsg = `${this.prefix} ${
|
|
150
|
+
const cleanMsg = `${this.prefix} ${redactSensitive2(msg)}`;
|
|
142
151
|
const cleanArgs = args.map((arg) => {
|
|
143
152
|
if (typeof arg === "string")
|
|
144
|
-
return
|
|
153
|
+
return redactSensitive2(arg);
|
|
145
154
|
if (typeof arg === "object" && arg !== null) {
|
|
146
155
|
try {
|
|
147
|
-
return JSON.parse(
|
|
156
|
+
return JSON.parse(redactSensitive2(JSON.stringify(arg)));
|
|
148
157
|
} catch {
|
|
149
158
|
return "[Unserializable Object]";
|
|
150
159
|
}
|
|
@@ -253,7 +262,7 @@ function resolveConfig(options = {}) {
|
|
|
253
262
|
|
|
254
263
|
// src/http/transport.ts
|
|
255
264
|
var RETRYABLE_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504]);
|
|
256
|
-
var SDK_VERSION = "1.0
|
|
265
|
+
var SDK_VERSION = "1.3.0";
|
|
257
266
|
|
|
258
267
|
class HttpTransport {
|
|
259
268
|
config;
|
|
@@ -290,6 +299,7 @@ class HttpTransport {
|
|
|
290
299
|
}
|
|
291
300
|
try {
|
|
292
301
|
const headers = {
|
|
302
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
293
303
|
"x-api-key": this.config.apiKey,
|
|
294
304
|
Accept: "application/json",
|
|
295
305
|
"User-Agent": `pia-sdk-ts/${SDK_VERSION}`,
|
|
@@ -738,34 +748,162 @@ class MarketResource {
|
|
|
738
748
|
const cleanSymbol = symbol.trim().toUpperCase();
|
|
739
749
|
return this.transport.request(`/api/v1/market/insights/${encodeURIComponent(cleanSymbol)}`, "GET", undefined, options);
|
|
740
750
|
}
|
|
751
|
+
async getTradingHalts(options) {
|
|
752
|
+
return this.transport.request("/api/v1/market/trading-halts", "GET", undefined, options);
|
|
753
|
+
}
|
|
754
|
+
async getCorporateActions(options) {
|
|
755
|
+
return this.transport.request("/api/v1/market/corporate-actions", "GET", undefined, options);
|
|
756
|
+
}
|
|
757
|
+
async getRealizedVolatility(symbol, options) {
|
|
758
|
+
const params = new URLSearchParams;
|
|
759
|
+
if (symbol)
|
|
760
|
+
params.set("symbol", symbol.trim().toUpperCase());
|
|
761
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
762
|
+
return this.transport.request(`/api/v1/market/realized-volatility${query}`, "GET", undefined, options);
|
|
763
|
+
}
|
|
764
|
+
async getImpliedVolatility(symbol, options) {
|
|
765
|
+
const params = new URLSearchParams;
|
|
766
|
+
if (symbol)
|
|
767
|
+
params.set("symbol", symbol.trim().toUpperCase());
|
|
768
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
769
|
+
return this.transport.request(`/api/v1/market/implied-volatility${query}`, "GET", undefined, options);
|
|
770
|
+
}
|
|
741
771
|
async getWhy(symbol, options) {
|
|
742
772
|
return this.getInsights(symbol, options);
|
|
743
773
|
}
|
|
744
774
|
}
|
|
745
775
|
|
|
746
|
-
// src/resources/
|
|
747
|
-
class
|
|
776
|
+
// src/resources/intelligence.ts
|
|
777
|
+
class IntelligenceResource {
|
|
748
778
|
transport;
|
|
749
779
|
constructor(transport) {
|
|
750
780
|
this.transport = transport;
|
|
751
781
|
}
|
|
752
|
-
async
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
782
|
+
async analyze(request, options) {
|
|
783
|
+
return this.transport.request("/api/v1/intelligence/analyze", "POST", request, options);
|
|
784
|
+
}
|
|
785
|
+
async getInsights(symbol, options) {
|
|
786
|
+
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
787
|
+
throw new ValidationError("Symbol must be a non-empty string.", "symbol");
|
|
756
788
|
}
|
|
757
|
-
|
|
758
|
-
|
|
789
|
+
const cleanSymbol = symbol.trim().toUpperCase();
|
|
790
|
+
return this.transport.request(`/api/v1/market/insights/${encodeURIComponent(cleanSymbol)}`, "GET", undefined, options);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// src/resources/options.ts
|
|
795
|
+
class OptionsResource {
|
|
796
|
+
transport;
|
|
797
|
+
constructor(transport) {
|
|
798
|
+
this.transport = transport;
|
|
799
|
+
}
|
|
800
|
+
async getChain(symbol, options) {
|
|
801
|
+
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
802
|
+
throw new ValidationError("Symbol must be a non-empty string.", "symbol");
|
|
803
|
+
}
|
|
804
|
+
const clean = symbol.trim().toUpperCase();
|
|
805
|
+
return this.transport.request(`/api/v1/options/chain/${encodeURIComponent(clean)}`, "GET", undefined, options);
|
|
806
|
+
}
|
|
807
|
+
async getGex(symbol, options) {
|
|
808
|
+
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
809
|
+
throw new ValidationError("Symbol must be a non-empty string.", "symbol");
|
|
810
|
+
}
|
|
811
|
+
const clean = symbol.trim().toUpperCase();
|
|
812
|
+
return this.transport.request(`/api/v1/options/gex/${encodeURIComponent(clean)}`, "GET", undefined, options);
|
|
813
|
+
}
|
|
814
|
+
async getSummary(options) {
|
|
815
|
+
return this.transport.request("/api/v1/options/summary", "GET", undefined, options);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
// src/resources/macro.ts
|
|
820
|
+
class MacroResource {
|
|
821
|
+
transport;
|
|
822
|
+
constructor(transport) {
|
|
823
|
+
this.transport = transport;
|
|
824
|
+
}
|
|
825
|
+
async getFearGreed(options) {
|
|
826
|
+
return this.transport.request("/api/v1/fear-greed", "GET", undefined, options);
|
|
827
|
+
}
|
|
828
|
+
async getFearGreedHistory(options) {
|
|
829
|
+
return this.transport.request("/api/v1/fear-greed/history", "GET", undefined, options);
|
|
830
|
+
}
|
|
831
|
+
async getCot(symbol, options) {
|
|
832
|
+
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
833
|
+
throw new ValidationError("Symbol must be a non-empty string.", "symbol");
|
|
834
|
+
}
|
|
835
|
+
const clean = symbol.trim().toUpperCase();
|
|
836
|
+
return this.transport.request(`/api/v1/cot/symbol/${encodeURIComponent(clean)}`, "GET", undefined, options);
|
|
837
|
+
}
|
|
838
|
+
async getCentralBankStance(bank, options) {
|
|
839
|
+
if (!bank || typeof bank !== "string" || bank.trim() === "") {
|
|
840
|
+
throw new ValidationError("Bank must be a non-empty string.", "bank");
|
|
841
|
+
}
|
|
842
|
+
const clean = bank.trim().toLowerCase();
|
|
843
|
+
return this.transport.request(`/api/v1/central-banks/${encodeURIComponent(clean)}/stance`, "GET", undefined, options);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
// src/resources/geosignals.ts
|
|
848
|
+
class GeosignalsResource {
|
|
849
|
+
transport;
|
|
850
|
+
constructor(transport) {
|
|
851
|
+
this.transport = transport;
|
|
852
|
+
}
|
|
853
|
+
async getEvents(options) {
|
|
854
|
+
return this.transport.request("/api/v1/geosignals", "GET", undefined, options);
|
|
855
|
+
}
|
|
856
|
+
async getMap(options) {
|
|
857
|
+
return this.transport.request("/api/v1/geosignals/map", "GET", undefined, options);
|
|
858
|
+
}
|
|
859
|
+
async getAssetImpacts(options) {
|
|
860
|
+
return this.transport.request("/api/v1/geosignals/assets", "GET", undefined, options);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
// src/resources/energy.ts
|
|
865
|
+
class EnergyResource {
|
|
866
|
+
transport;
|
|
867
|
+
constructor(transport) {
|
|
868
|
+
this.transport = transport;
|
|
869
|
+
}
|
|
870
|
+
async getDashboard(options) {
|
|
871
|
+
return this.transport.request("/api/v1/energy/dashboard", "GET", undefined, options);
|
|
872
|
+
}
|
|
873
|
+
async getSeries(seriesId, options) {
|
|
874
|
+
const params = new URLSearchParams;
|
|
875
|
+
if (seriesId)
|
|
876
|
+
params.set("id", seriesId);
|
|
877
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
878
|
+
return this.transport.request(`/api/v1/energy/series${query}`, "GET", undefined, options);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// src/resources/sec.ts
|
|
883
|
+
class SecResource {
|
|
884
|
+
transport;
|
|
885
|
+
constructor(transport) {
|
|
886
|
+
this.transport = transport;
|
|
887
|
+
}
|
|
888
|
+
async getFilings(options) {
|
|
889
|
+
const params = new URLSearchParams;
|
|
890
|
+
if (options?.symbol)
|
|
891
|
+
params.set("symbol", options.symbol.trim().toUpperCase());
|
|
892
|
+
if (options?.form_type)
|
|
893
|
+
params.set("form_type", options.form_type);
|
|
759
894
|
if (options?.limit)
|
|
760
895
|
params.set("limit", String(options.limit));
|
|
896
|
+
if (options?.since)
|
|
897
|
+
params.set("since", options.since);
|
|
761
898
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
762
|
-
return this.transport.request(`/api/v1/
|
|
763
|
-
}
|
|
764
|
-
async getLatest(options) {
|
|
765
|
-
return this.transport.request("/api/v1/news/latest", "GET", undefined, options);
|
|
899
|
+
return this.transport.request(`/api/v1/sec/filings${query}`, "GET", undefined, options);
|
|
766
900
|
}
|
|
767
|
-
async
|
|
768
|
-
|
|
901
|
+
async getCompany(symbol, options) {
|
|
902
|
+
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
903
|
+
throw new ValidationError("Symbol must be a non-empty string.", "symbol");
|
|
904
|
+
}
|
|
905
|
+
const cleanSymbol = symbol.trim().toUpperCase();
|
|
906
|
+
return this.transport.request(`/api/v1/sec/companies/${encodeURIComponent(cleanSymbol)}`, "GET", undefined, options);
|
|
769
907
|
}
|
|
770
908
|
}
|
|
771
909
|
|
|
@@ -775,6 +913,17 @@ class SocialResource {
|
|
|
775
913
|
constructor(transport) {
|
|
776
914
|
this.transport = transport;
|
|
777
915
|
}
|
|
916
|
+
async getPosts(options) {
|
|
917
|
+
const params = new URLSearchParams;
|
|
918
|
+
if (options?.symbol)
|
|
919
|
+
params.set("symbol", options.symbol.trim().toUpperCase());
|
|
920
|
+
if (options?.limit)
|
|
921
|
+
params.set("limit", String(options.limit));
|
|
922
|
+
if (options?.cursor)
|
|
923
|
+
params.set("cursor", options.cursor);
|
|
924
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
925
|
+
return this.transport.request(`/api/v1/social/posts${query}`, "GET", undefined, options);
|
|
926
|
+
}
|
|
778
927
|
async getFeed(options) {
|
|
779
928
|
const params = new URLSearchParams;
|
|
780
929
|
if (options?.symbol)
|
|
@@ -786,8 +935,31 @@ class SocialResource {
|
|
|
786
935
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
787
936
|
return this.transport.request(`/api/v1/social/feed${query}`, "GET", undefined, options);
|
|
788
937
|
}
|
|
789
|
-
|
|
790
|
-
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// src/resources/news.ts
|
|
941
|
+
class NewsResource {
|
|
942
|
+
transport;
|
|
943
|
+
constructor(transport) {
|
|
944
|
+
this.transport = transport;
|
|
945
|
+
}
|
|
946
|
+
async getNews(options) {
|
|
947
|
+
const params = new URLSearchParams;
|
|
948
|
+
if (options?.symbols && options.symbols.length > 0) {
|
|
949
|
+
params.set("symbols", options.symbols.map((s) => s.trim().toUpperCase()).join(","));
|
|
950
|
+
}
|
|
951
|
+
if (options?.category)
|
|
952
|
+
params.set("category", options.category);
|
|
953
|
+
if (options?.limit)
|
|
954
|
+
params.set("limit", String(options.limit));
|
|
955
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
956
|
+
return this.transport.request(`/api/v1/news${query}`, "GET", undefined, options);
|
|
957
|
+
}
|
|
958
|
+
async getLatest(options) {
|
|
959
|
+
return this.transport.request("/api/v1/news/latest", "GET", undefined, options);
|
|
960
|
+
}
|
|
961
|
+
async getById(id, options) {
|
|
962
|
+
return this.transport.request(`/api/v1/news/${encodeURIComponent(id)}`, "GET", undefined, options);
|
|
791
963
|
}
|
|
792
964
|
}
|
|
793
965
|
|
|
@@ -809,6 +981,12 @@ class EconomicResource {
|
|
|
809
981
|
async getIndicators(options) {
|
|
810
982
|
return this.transport.request("/api/v1/economic/indicators", "GET", undefined, options);
|
|
811
983
|
}
|
|
984
|
+
async getCategories(options) {
|
|
985
|
+
return this.transport.request("/api/v1/economic/categories", "GET", undefined, options);
|
|
986
|
+
}
|
|
987
|
+
async getCountries(options) {
|
|
988
|
+
return this.transport.request("/api/v1/economic/countries", "GET", undefined, options);
|
|
989
|
+
}
|
|
812
990
|
}
|
|
813
991
|
|
|
814
992
|
// src/resources/fixed-income.ts
|
|
@@ -841,16 +1019,28 @@ class PiaClient {
|
|
|
841
1019
|
config;
|
|
842
1020
|
transport;
|
|
843
1021
|
market;
|
|
1022
|
+
intelligence;
|
|
1023
|
+
options;
|
|
1024
|
+
macro;
|
|
1025
|
+
geosignals;
|
|
1026
|
+
energy;
|
|
1027
|
+
sec;
|
|
844
1028
|
social;
|
|
845
1029
|
news;
|
|
846
1030
|
economic;
|
|
847
1031
|
fixedIncome;
|
|
848
1032
|
ws;
|
|
849
1033
|
realtime;
|
|
850
|
-
constructor(options
|
|
851
|
-
this.config =
|
|
1034
|
+
constructor(options) {
|
|
1035
|
+
this.config = resolveConfig(options);
|
|
852
1036
|
this.transport = new HttpTransport(this.config);
|
|
853
1037
|
this.market = new MarketResource(this.transport);
|
|
1038
|
+
this.intelligence = new IntelligenceResource(this.transport);
|
|
1039
|
+
this.options = new OptionsResource(this.transport);
|
|
1040
|
+
this.macro = new MacroResource(this.transport);
|
|
1041
|
+
this.geosignals = new GeosignalsResource(this.transport);
|
|
1042
|
+
this.energy = new EnergyResource(this.transport);
|
|
1043
|
+
this.sec = new SecResource(this.transport);
|
|
854
1044
|
this.social = new SocialResource(this.transport);
|
|
855
1045
|
this.news = new NewsResource(this.transport);
|
|
856
1046
|
this.economic = new EconomicResource(this.transport);
|
|
@@ -866,20 +1056,27 @@ export {
|
|
|
866
1056
|
ApiError,
|
|
867
1057
|
AuthenticationError,
|
|
868
1058
|
ConfigurationError,
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1059
|
+
EconomicResource,
|
|
1060
|
+
EnergyResource,
|
|
1061
|
+
FixedIncomeResource,
|
|
1062
|
+
GeosignalsResource,
|
|
1063
|
+
IntelligenceResource,
|
|
1064
|
+
MacroResource,
|
|
1065
|
+
MarketResource,
|
|
874
1066
|
NetworkError,
|
|
1067
|
+
NewsResource,
|
|
1068
|
+
OptionsResource,
|
|
875
1069
|
ParseError,
|
|
876
1070
|
PermissionError,
|
|
877
1071
|
PiaClient,
|
|
878
1072
|
PiaError,
|
|
879
1073
|
RateLimitError,
|
|
880
1074
|
RealtimeClient,
|
|
1075
|
+
SecResource,
|
|
1076
|
+
SocialResource,
|
|
881
1077
|
TimeoutError,
|
|
882
1078
|
ValidationError,
|
|
1079
|
+
WsResource,
|
|
883
1080
|
redactSensitive,
|
|
884
1081
|
resolveConfig
|
|
885
1082
|
};
|
|
@@ -14,4 +14,12 @@ export declare class EconomicResource {
|
|
|
14
14
|
* Retrieves macroeconomic indicators and series metadata.
|
|
15
15
|
*/
|
|
16
16
|
getIndicators(options?: RequestOptions): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves list of available macroeconomic indicator categories.
|
|
19
|
+
*/
|
|
20
|
+
getCategories(options?: RequestOptions): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves list of supported sovereign countries for economic indicators.
|
|
23
|
+
*/
|
|
24
|
+
getCountries(options?: RequestOptions): Promise<any>;
|
|
17
25
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official PIA SDK - Energy Markets & Commodity Reserves Resource
|
|
3
|
+
*/
|
|
4
|
+
import type { HttpTransport } from "../http/transport";
|
|
5
|
+
import type { RequestOptions } from "../types";
|
|
6
|
+
export interface EnergyDashboardResponse {
|
|
7
|
+
crude_oil?: {
|
|
8
|
+
wti_price?: number;
|
|
9
|
+
brent_price?: number;
|
|
10
|
+
spread?: number;
|
|
11
|
+
weekly_change_pct?: number;
|
|
12
|
+
};
|
|
13
|
+
natural_gas?: {
|
|
14
|
+
henry_hub_price?: number;
|
|
15
|
+
storage_bcf?: number;
|
|
16
|
+
storage_change?: number;
|
|
17
|
+
};
|
|
18
|
+
refining_margins?: Record<string, number>;
|
|
19
|
+
updated_at: string;
|
|
20
|
+
}
|
|
21
|
+
export interface EnergySeriesResponse {
|
|
22
|
+
series_id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
unit: string;
|
|
25
|
+
data: Array<{
|
|
26
|
+
date: string;
|
|
27
|
+
value: number;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export declare class EnergyResource {
|
|
31
|
+
private readonly transport;
|
|
32
|
+
constructor(transport: HttpTransport);
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves energy market dashboard including WTI/Brent crude prices, crack spreads, and storage.
|
|
35
|
+
*/
|
|
36
|
+
getDashboard(options?: RequestOptions): Promise<EnergyDashboardResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves historical time series data for a specific energy benchmark series.
|
|
39
|
+
*/
|
|
40
|
+
getSeries(seriesId: string, options?: RequestOptions): Promise<EnergySeriesResponse>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official PIA SDK - Geopolitical Signals & Macro Conflict Map Resource
|
|
3
|
+
*/
|
|
4
|
+
import type { HttpTransport } from "../http/transport";
|
|
5
|
+
import type { RequestOptions } from "../types";
|
|
6
|
+
export interface GeoSignalEvent {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
region: string;
|
|
10
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
11
|
+
category: "conflict" | "sanction" | "trade" | "election" | "supply_chain";
|
|
12
|
+
latitude?: number;
|
|
13
|
+
longitude?: number;
|
|
14
|
+
impacted_assets?: string[];
|
|
15
|
+
summary: string;
|
|
16
|
+
published_at: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GeoSignalsResponse {
|
|
19
|
+
total: number;
|
|
20
|
+
events: GeoSignalEvent[];
|
|
21
|
+
}
|
|
22
|
+
export interface GeoSignalsMapResponse {
|
|
23
|
+
layers: Array<{
|
|
24
|
+
region: string;
|
|
25
|
+
risk_level: number;
|
|
26
|
+
active_conflicts: number;
|
|
27
|
+
chokepoints_status?: Record<string, string>;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export interface GeoSignalsAssetImpactResponse {
|
|
31
|
+
assets: Array<{
|
|
32
|
+
symbol: string;
|
|
33
|
+
risk_score: number;
|
|
34
|
+
primary_risk_driver: string;
|
|
35
|
+
affected_supply_pct?: number;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
export declare class GeosignalsResource {
|
|
39
|
+
private readonly transport;
|
|
40
|
+
constructor(transport: HttpTransport);
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves active geopolitical risk events and conflict alerts.
|
|
43
|
+
*/
|
|
44
|
+
getEvents(options?: RequestOptions): Promise<GeoSignalsResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves global geopolitical risk map layer data and maritime chokepoints status.
|
|
47
|
+
*/
|
|
48
|
+
getMap(options?: RequestOptions): Promise<GeoSignalsMapResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Retrieves mapped asset vulnerabilities and commodity exposure to current geopolitical tensions.
|
|
51
|
+
*/
|
|
52
|
+
getAssetImpacts(options?: RequestOptions): Promise<GeoSignalsAssetImpactResponse>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official PIA SDK - AI Intelligence & Market Analysis Resource
|
|
3
|
+
*/
|
|
4
|
+
import type { HttpTransport } from "../http/transport";
|
|
5
|
+
import type { RequestOptions } from "../types";
|
|
6
|
+
export interface IntelligenceAnalyzeRequest {
|
|
7
|
+
symbol?: string;
|
|
8
|
+
query?: string;
|
|
9
|
+
context?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
export interface IntelligenceAnalyzeResponse {
|
|
12
|
+
symbol?: string;
|
|
13
|
+
sentiment?: "bullish" | "bearish" | "neutral";
|
|
14
|
+
confidence?: number;
|
|
15
|
+
analysis: string;
|
|
16
|
+
catalysts?: string[];
|
|
17
|
+
key_levels?: {
|
|
18
|
+
support?: number[];
|
|
19
|
+
resistance?: number[];
|
|
20
|
+
};
|
|
21
|
+
generated_at: string;
|
|
22
|
+
}
|
|
23
|
+
export interface MarketInsightResponse {
|
|
24
|
+
symbol: string;
|
|
25
|
+
summary: string;
|
|
26
|
+
sentiment: string;
|
|
27
|
+
drivers?: string[];
|
|
28
|
+
timestamp?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare class IntelligenceResource {
|
|
31
|
+
private readonly transport;
|
|
32
|
+
constructor(transport: HttpTransport);
|
|
33
|
+
/**
|
|
34
|
+
* Generates AI-powered real-time quantitative analysis and catalyst explanations.
|
|
35
|
+
*/
|
|
36
|
+
analyze(request: IntelligenceAnalyzeRequest, options?: RequestOptions): Promise<IntelligenceAnalyzeResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves synthesized AI narrative insights and price drivers for a specific symbol.
|
|
39
|
+
*/
|
|
40
|
+
getInsights(symbol: string, options?: RequestOptions): Promise<MarketInsightResponse>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official PIA SDK - Macro & Market Sentiment Resource
|
|
3
|
+
*/
|
|
4
|
+
import type { HttpTransport } from "../http/transport";
|
|
5
|
+
import type { CentralBankStanceResponse, CotReportResponse, FearGreedData, FearGreedHistoryResponse, RequestOptions } from "../types";
|
|
6
|
+
export declare class MacroResource {
|
|
7
|
+
private readonly transport;
|
|
8
|
+
constructor(transport: HttpTransport);
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves the current Fear & Greed Index score and sentiment rating.
|
|
11
|
+
*/
|
|
12
|
+
getFearGreed(options?: RequestOptions): Promise<FearGreedData>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves historical Fear & Greed Index time series.
|
|
15
|
+
*/
|
|
16
|
+
getFearGreedHistory(options?: RequestOptions): Promise<FearGreedHistoryResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Fetches CFTC Commitment of Traders (COT) institutional positioning report for a symbol.
|
|
19
|
+
*
|
|
20
|
+
* @param symbol Commodity/Currency/Index symbol (e.g. "GOLD", "WTI", "EURUSD", "SPX")
|
|
21
|
+
*/
|
|
22
|
+
getCot(symbol: string, options?: RequestOptions): Promise<CotReportResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Fetches monetary policy stance and interest rate assessment for a central bank.
|
|
25
|
+
*
|
|
26
|
+
* @param bank Bank code (e.g. "fed", "ecb", "boj", "bi", "boe")
|
|
27
|
+
*/
|
|
28
|
+
getCentralBankStance(bank: string, options?: RequestOptions): Promise<CentralBankStanceResponse>;
|
|
29
|
+
}
|
|
@@ -25,6 +25,22 @@ export declare class MarketResource {
|
|
|
25
25
|
* Retrieves AI/Quant market insights and price movement narrative for a given instrument.
|
|
26
26
|
*/
|
|
27
27
|
getInsights(symbol: string, options?: RequestOptions): Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves active market trading halts and circuit breaker triggers.
|
|
30
|
+
*/
|
|
31
|
+
getTradingHalts(options?: RequestOptions): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves upcoming and historical corporate actions (dividends, splits, earnings).
|
|
34
|
+
*/
|
|
35
|
+
getCorporateActions(options?: RequestOptions): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* Calculates historical realized volatility (HV) across rolling windows (10d, 30d, 90d).
|
|
38
|
+
*/
|
|
39
|
+
getRealizedVolatility(symbol?: string, options?: RequestOptions): Promise<any>;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves implied volatility (IV) surface and ATM volatility index.
|
|
42
|
+
*/
|
|
43
|
+
getImpliedVolatility(symbol?: string, options?: RequestOptions): Promise<any>;
|
|
28
44
|
/**
|
|
29
45
|
* @deprecated Use `getInsights(symbol)` instead.
|
|
30
46
|
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official PIA SDK - Derivatives & Options Analytics Resource
|
|
3
|
+
*/
|
|
4
|
+
import type { HttpTransport } from "../http/transport";
|
|
5
|
+
import type { OptionChainResponse, OptionGexResponse, OptionSummaryResponse, RequestOptions } from "../types";
|
|
6
|
+
export declare class OptionsResource {
|
|
7
|
+
private readonly transport;
|
|
8
|
+
constructor(transport: HttpTransport);
|
|
9
|
+
/**
|
|
10
|
+
* Fetches the real-time option chain for an underlying asset symbol.
|
|
11
|
+
*
|
|
12
|
+
* @param symbol Underlier ticker (e.g. "AAPL", "NVDA", "SPX")
|
|
13
|
+
*/
|
|
14
|
+
getChain(symbol: string, options?: RequestOptions): Promise<OptionChainResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetches Gamma Exposure (GEX) profile and key zero-gamma levels.
|
|
17
|
+
*
|
|
18
|
+
* @param symbol Underlier ticker (e.g. "SPX", "NVDA", "QQQ")
|
|
19
|
+
*/
|
|
20
|
+
getGex(symbol: string, options?: RequestOptions): Promise<OptionGexResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves overall options market activity and put/call sentiment summary.
|
|
23
|
+
*/
|
|
24
|
+
getSummary(options?: RequestOptions): Promise<OptionSummaryResponse>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official PIA SDK - SEC EDGAR Filings Resource
|
|
3
|
+
*/
|
|
4
|
+
import type { HttpTransport } from "../http/transport";
|
|
5
|
+
import type { RequestOptions } from "../types";
|
|
6
|
+
export interface SecFilingItem {
|
|
7
|
+
id: string;
|
|
8
|
+
symbol: string;
|
|
9
|
+
form_type: "10-K" | "10-Q" | "8-K" | "4" | "13F" | string;
|
|
10
|
+
company_name: string;
|
|
11
|
+
cik: string;
|
|
12
|
+
filing_date: string;
|
|
13
|
+
report_url: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SecFilingsResponse {
|
|
17
|
+
total: number;
|
|
18
|
+
items: SecFilingItem[];
|
|
19
|
+
has_more?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface GetSecFilingsOptions extends RequestOptions {
|
|
22
|
+
symbol?: string;
|
|
23
|
+
form_type?: string;
|
|
24
|
+
limit?: number;
|
|
25
|
+
since?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class SecResource {
|
|
28
|
+
private readonly transport;
|
|
29
|
+
constructor(transport: HttpTransport);
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves latest corporate SEC EDGAR filings (10-K, 10-Q, 8-K, Form 4 insider trades).
|
|
32
|
+
*/
|
|
33
|
+
getFilings(options?: GetSecFilingsOptions): Promise<SecFilingsResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves SEC filing history for a specific public company symbol.
|
|
36
|
+
*/
|
|
37
|
+
getCompany(symbol: string, options?: RequestOptions): Promise<any>;
|
|
38
|
+
}
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
* Official PIA SDK - Social Intelligence API Resource
|
|
3
3
|
*/
|
|
4
4
|
import type { HttpTransport } from "../http/transport";
|
|
5
|
-
import type { GetSocialOptions, SocialFeedResponse } from "../types";
|
|
5
|
+
import type { GetSocialOptions, GetSocialPostsOptions, SocialFeedResponse, SocialPostsResponse } from "../types";
|
|
6
6
|
export declare class SocialResource {
|
|
7
7
|
private readonly transport;
|
|
8
8
|
constructor(transport: HttpTransport);
|
|
9
9
|
/**
|
|
10
|
-
* Fetches the latest social sentiment posts
|
|
10
|
+
* Fetches the latest social sentiment posts from PostgreSQL / RSSHub ingestion pipeline.
|
|
11
|
+
*
|
|
12
|
+
* @param options Pagination limit, cursor, and optional symbol filter.
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
getPosts(options?: GetSocialPostsOptions): Promise<SocialPostsResponse>;
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* Fetches the real-time social discussion feed.
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
getFeed(options?: GetSocialOptions): Promise<SocialFeedResponse>;
|
|
17
19
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -142,3 +142,112 @@ export interface WsTicketResponse {
|
|
|
142
142
|
expires_in?: number;
|
|
143
143
|
ws_url?: string;
|
|
144
144
|
}
|
|
145
|
+
export interface SocialPostItem {
|
|
146
|
+
author_username: string;
|
|
147
|
+
author_display_name?: string;
|
|
148
|
+
text: string;
|
|
149
|
+
url: string;
|
|
150
|
+
created_at: string;
|
|
151
|
+
platform: string;
|
|
152
|
+
like_count?: number;
|
|
153
|
+
retweet_count?: number;
|
|
154
|
+
media_urls?: string[];
|
|
155
|
+
source_account?: string;
|
|
156
|
+
}
|
|
157
|
+
export interface SocialPostsResponse {
|
|
158
|
+
has_more: boolean;
|
|
159
|
+
items: SocialPostItem[];
|
|
160
|
+
next_before?: string | null;
|
|
161
|
+
}
|
|
162
|
+
export interface GetSocialPostsOptions extends RequestOptions {
|
|
163
|
+
limit?: number;
|
|
164
|
+
cursor?: string;
|
|
165
|
+
symbol?: string;
|
|
166
|
+
}
|
|
167
|
+
export interface OptionContract {
|
|
168
|
+
symbol: string;
|
|
169
|
+
strike: number;
|
|
170
|
+
expiration: string;
|
|
171
|
+
option_type: "call" | "put" | string;
|
|
172
|
+
bid?: number;
|
|
173
|
+
ask?: number;
|
|
174
|
+
last?: number;
|
|
175
|
+
volume?: number;
|
|
176
|
+
open_interest?: number;
|
|
177
|
+
implied_volatility?: number;
|
|
178
|
+
delta?: number;
|
|
179
|
+
gamma?: number;
|
|
180
|
+
theta?: number;
|
|
181
|
+
vega?: number;
|
|
182
|
+
}
|
|
183
|
+
export interface OptionChainResponse {
|
|
184
|
+
symbol: string;
|
|
185
|
+
underlying_price?: number;
|
|
186
|
+
expirations: string[];
|
|
187
|
+
contracts: OptionContract[];
|
|
188
|
+
}
|
|
189
|
+
export interface OptionGexResponse {
|
|
190
|
+
symbol: string;
|
|
191
|
+
net_gex?: number;
|
|
192
|
+
total_call_gex?: number;
|
|
193
|
+
total_put_gex?: number;
|
|
194
|
+
zero_gamma_level?: number;
|
|
195
|
+
major_positive_levels?: Array<{
|
|
196
|
+
strike: number;
|
|
197
|
+
gex: number;
|
|
198
|
+
}>;
|
|
199
|
+
major_negative_levels?: Array<{
|
|
200
|
+
strike: number;
|
|
201
|
+
gex: number;
|
|
202
|
+
}>;
|
|
203
|
+
updated_at?: string;
|
|
204
|
+
}
|
|
205
|
+
export interface OptionSummaryResponse {
|
|
206
|
+
total_volume?: number;
|
|
207
|
+
total_open_interest?: number;
|
|
208
|
+
put_call_ratio?: number;
|
|
209
|
+
most_active_symbols?: Array<{
|
|
210
|
+
symbol: string;
|
|
211
|
+
volume: number;
|
|
212
|
+
}>;
|
|
213
|
+
}
|
|
214
|
+
export interface FearGreedData {
|
|
215
|
+
score: number;
|
|
216
|
+
rating: string;
|
|
217
|
+
timestamp: string | number;
|
|
218
|
+
previous_close?: number;
|
|
219
|
+
previous_1_week?: number;
|
|
220
|
+
previous_1_month?: number;
|
|
221
|
+
previous_1_year?: number;
|
|
222
|
+
}
|
|
223
|
+
export interface FearGreedHistoryResponse {
|
|
224
|
+
current: FearGreedData;
|
|
225
|
+
history: Array<{
|
|
226
|
+
score: number;
|
|
227
|
+
rating: string;
|
|
228
|
+
timestamp: string | number;
|
|
229
|
+
}>;
|
|
230
|
+
}
|
|
231
|
+
export interface CotPositioning {
|
|
232
|
+
market_code: string;
|
|
233
|
+
market_name?: string;
|
|
234
|
+
report_date: string;
|
|
235
|
+
commercial_long?: number;
|
|
236
|
+
commercial_short?: number;
|
|
237
|
+
non_commercial_long?: number;
|
|
238
|
+
non_commercial_short?: number;
|
|
239
|
+
net_position?: number;
|
|
240
|
+
}
|
|
241
|
+
export interface CotReportResponse {
|
|
242
|
+
symbol?: string;
|
|
243
|
+
market_code?: string;
|
|
244
|
+
reports: CotPositioning[];
|
|
245
|
+
}
|
|
246
|
+
export interface CentralBankStanceResponse {
|
|
247
|
+
bank: string;
|
|
248
|
+
name?: string;
|
|
249
|
+
stance: "hawkish" | "dovish" | "neutral" | string;
|
|
250
|
+
rate?: number;
|
|
251
|
+
last_updated?: string;
|
|
252
|
+
summary?: string;
|
|
253
|
+
}
|