@piaa/sdk 1.2.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/dist/client.d.ts +23 -11
- package/dist/errors.d.ts +4 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.js +200 -77
- 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/market.d.ts +16 -0
- package/dist/resources/sec.d.ts +38 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -4,12 +4,16 @@
|
|
|
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
|
-
import { MacroResource } from "./resources/macro";
|
|
12
|
-
import { OptionsResource } from "./resources/options";
|
|
13
17
|
import { WsResource } from "./resources/ws";
|
|
14
18
|
import type { RateLimitInfo } from "./types";
|
|
15
19
|
export declare class PiaClient {
|
|
@@ -19,6 +23,10 @@ export declare class PiaClient {
|
|
|
19
23
|
* Market data & prices API resource.
|
|
20
24
|
*/
|
|
21
25
|
readonly market: MarketResource;
|
|
26
|
+
/**
|
|
27
|
+
* AI-powered quantitative intelligence and narrative catalysts resource.
|
|
28
|
+
*/
|
|
29
|
+
readonly intelligence: IntelligenceResource;
|
|
22
30
|
/**
|
|
23
31
|
* Derivatives, options chain, and Gamma Exposure (GEX) resource.
|
|
24
32
|
*/
|
|
@@ -27,6 +35,18 @@ export declare class PiaClient {
|
|
|
27
35
|
* Macro indicators, Fear & Greed index, COT positioning, and central banks.
|
|
28
36
|
*/
|
|
29
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;
|
|
30
50
|
/**
|
|
31
51
|
* Social sentiment and discussions resource.
|
|
32
52
|
*/
|
|
@@ -53,14 +73,6 @@ export declare class PiaClient {
|
|
|
53
73
|
readonly realtime: RealtimeClient;
|
|
54
74
|
/**
|
|
55
75
|
* Initializes a new PIA API Client.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```typescript
|
|
59
|
-
* import { PiaClient } from "@piaa/sdk";
|
|
60
|
-
*
|
|
61
|
-
* const client = new PiaClient({ apiKey: "wi_live_..." });
|
|
62
|
-
* const prices = await client.market.getPrices();
|
|
63
|
-
* ```
|
|
64
76
|
*/
|
|
65
77
|
constructor(options?: PiaClientOptions);
|
|
66
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,17 +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 {
|
|
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";
|
|
10
11
|
export { MarketResource } from "./resources/market";
|
|
12
|
+
export { IntelligenceResource, type IntelligenceAnalyzeRequest, type IntelligenceAnalyzeResponse, type MarketInsightResponse } from "./resources/intelligence";
|
|
11
13
|
export { OptionsResource } from "./resources/options";
|
|
12
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";
|
|
13
18
|
export { SocialResource } from "./resources/social";
|
|
14
19
|
export { NewsResource } from "./resources/news";
|
|
15
20
|
export { EconomicResource } from "./resources/economic";
|
|
16
21
|
export { FixedIncomeResource } from "./resources/fixed-income";
|
|
17
22
|
export { WsResource } from "./resources/ws";
|
|
18
|
-
export { RealtimeClient, type SocketState } from "./realtime/socket";
|
|
19
|
-
export { type RealtimeEvents } from "./realtime/events";
|
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.
|
|
265
|
+
var SDK_VERSION = "1.3.0";
|
|
257
266
|
|
|
258
267
|
class HttpTransport {
|
|
259
268
|
config;
|
|
@@ -739,34 +748,162 @@ class MarketResource {
|
|
|
739
748
|
const cleanSymbol = symbol.trim().toUpperCase();
|
|
740
749
|
return this.transport.request(`/api/v1/market/insights/${encodeURIComponent(cleanSymbol)}`, "GET", undefined, options);
|
|
741
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
|
+
}
|
|
742
771
|
async getWhy(symbol, options) {
|
|
743
772
|
return this.getInsights(symbol, options);
|
|
744
773
|
}
|
|
745
774
|
}
|
|
746
775
|
|
|
747
|
-
// src/resources/
|
|
748
|
-
class
|
|
776
|
+
// src/resources/intelligence.ts
|
|
777
|
+
class IntelligenceResource {
|
|
749
778
|
transport;
|
|
750
779
|
constructor(transport) {
|
|
751
780
|
this.transport = transport;
|
|
752
781
|
}
|
|
753
|
-
async
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
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");
|
|
757
788
|
}
|
|
758
|
-
|
|
759
|
-
|
|
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);
|
|
760
894
|
if (options?.limit)
|
|
761
895
|
params.set("limit", String(options.limit));
|
|
896
|
+
if (options?.since)
|
|
897
|
+
params.set("since", options.since);
|
|
762
898
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
763
|
-
return this.transport.request(`/api/v1/
|
|
764
|
-
}
|
|
765
|
-
async getLatest(options) {
|
|
766
|
-
return this.transport.request("/api/v1/news/latest", "GET", undefined, options);
|
|
899
|
+
return this.transport.request(`/api/v1/sec/filings${query}`, "GET", undefined, options);
|
|
767
900
|
}
|
|
768
|
-
async
|
|
769
|
-
|
|
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);
|
|
770
907
|
}
|
|
771
908
|
}
|
|
772
909
|
|
|
@@ -800,6 +937,32 @@ class SocialResource {
|
|
|
800
937
|
}
|
|
801
938
|
}
|
|
802
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);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
803
966
|
// src/resources/economic.ts
|
|
804
967
|
class EconomicResource {
|
|
805
968
|
transport;
|
|
@@ -818,6 +981,12 @@ class EconomicResource {
|
|
|
818
981
|
async getIndicators(options) {
|
|
819
982
|
return this.transport.request("/api/v1/economic/indicators", "GET", undefined, options);
|
|
820
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
|
+
}
|
|
821
990
|
}
|
|
822
991
|
|
|
823
992
|
// src/resources/fixed-income.ts
|
|
@@ -834,59 +1003,6 @@ class FixedIncomeResource {
|
|
|
834
1003
|
}
|
|
835
1004
|
}
|
|
836
1005
|
|
|
837
|
-
// src/resources/macro.ts
|
|
838
|
-
class MacroResource {
|
|
839
|
-
transport;
|
|
840
|
-
constructor(transport) {
|
|
841
|
-
this.transport = transport;
|
|
842
|
-
}
|
|
843
|
-
async getFearGreed(options) {
|
|
844
|
-
return this.transport.request("/api/v1/fear-greed", "GET", undefined, options);
|
|
845
|
-
}
|
|
846
|
-
async getFearGreedHistory(options) {
|
|
847
|
-
return this.transport.request("/api/v1/fear-greed/history", "GET", undefined, options);
|
|
848
|
-
}
|
|
849
|
-
async getCot(symbol, options) {
|
|
850
|
-
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
851
|
-
throw new ValidationError("Symbol must be a non-empty string.", "symbol");
|
|
852
|
-
}
|
|
853
|
-
const clean = symbol.trim().toUpperCase();
|
|
854
|
-
return this.transport.request(`/api/v1/cot/symbol/${encodeURIComponent(clean)}`, "GET", undefined, options);
|
|
855
|
-
}
|
|
856
|
-
async getCentralBankStance(bank, options) {
|
|
857
|
-
if (!bank || typeof bank !== "string" || bank.trim() === "") {
|
|
858
|
-
throw new ValidationError("Bank must be a non-empty string.", "bank");
|
|
859
|
-
}
|
|
860
|
-
const clean = bank.trim().toLowerCase();
|
|
861
|
-
return this.transport.request(`/api/v1/central-banks/${encodeURIComponent(clean)}/stance`, "GET", undefined, options);
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
// src/resources/options.ts
|
|
866
|
-
class OptionsResource {
|
|
867
|
-
transport;
|
|
868
|
-
constructor(transport) {
|
|
869
|
-
this.transport = transport;
|
|
870
|
-
}
|
|
871
|
-
async getChain(symbol, options) {
|
|
872
|
-
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
873
|
-
throw new ValidationError("Symbol must be a non-empty string.", "symbol");
|
|
874
|
-
}
|
|
875
|
-
const clean = symbol.trim().toUpperCase();
|
|
876
|
-
return this.transport.request(`/api/v1/options/chain/${encodeURIComponent(clean)}`, "GET", undefined, options);
|
|
877
|
-
}
|
|
878
|
-
async getGex(symbol, options) {
|
|
879
|
-
if (!symbol || typeof symbol !== "string" || symbol.trim() === "") {
|
|
880
|
-
throw new ValidationError("Symbol must be a non-empty string.", "symbol");
|
|
881
|
-
}
|
|
882
|
-
const clean = symbol.trim().toUpperCase();
|
|
883
|
-
return this.transport.request(`/api/v1/options/gex/${encodeURIComponent(clean)}`, "GET", undefined, options);
|
|
884
|
-
}
|
|
885
|
-
async getSummary(options) {
|
|
886
|
-
return this.transport.request("/api/v1/options/summary", "GET", undefined, options);
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
|
|
890
1006
|
// src/resources/ws.ts
|
|
891
1007
|
class WsResource {
|
|
892
1008
|
transport;
|
|
@@ -903,8 +1019,12 @@ class PiaClient {
|
|
|
903
1019
|
config;
|
|
904
1020
|
transport;
|
|
905
1021
|
market;
|
|
1022
|
+
intelligence;
|
|
906
1023
|
options;
|
|
907
1024
|
macro;
|
|
1025
|
+
geosignals;
|
|
1026
|
+
energy;
|
|
1027
|
+
sec;
|
|
908
1028
|
social;
|
|
909
1029
|
news;
|
|
910
1030
|
economic;
|
|
@@ -915,8 +1035,12 @@ class PiaClient {
|
|
|
915
1035
|
this.config = resolveConfig(options);
|
|
916
1036
|
this.transport = new HttpTransport(this.config);
|
|
917
1037
|
this.market = new MarketResource(this.transport);
|
|
1038
|
+
this.intelligence = new IntelligenceResource(this.transport);
|
|
918
1039
|
this.options = new OptionsResource(this.transport);
|
|
919
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);
|
|
920
1044
|
this.social = new SocialResource(this.transport);
|
|
921
1045
|
this.news = new NewsResource(this.transport);
|
|
922
1046
|
this.economic = new EconomicResource(this.transport);
|
|
@@ -932,13 +1056,11 @@ export {
|
|
|
932
1056
|
ApiError,
|
|
933
1057
|
AuthenticationError,
|
|
934
1058
|
ConfigurationError,
|
|
935
|
-
DEFAULT_BASE_URL,
|
|
936
|
-
DEFAULT_MAX_RETRIES,
|
|
937
|
-
DEFAULT_TIMEOUT_MS,
|
|
938
|
-
DEFAULT_WS_URL,
|
|
939
|
-
DefaultLogger,
|
|
940
1059
|
EconomicResource,
|
|
1060
|
+
EnergyResource,
|
|
941
1061
|
FixedIncomeResource,
|
|
1062
|
+
GeosignalsResource,
|
|
1063
|
+
IntelligenceResource,
|
|
942
1064
|
MacroResource,
|
|
943
1065
|
MarketResource,
|
|
944
1066
|
NetworkError,
|
|
@@ -950,6 +1072,7 @@ export {
|
|
|
950
1072
|
PiaError,
|
|
951
1073
|
RateLimitError,
|
|
952
1074
|
RealtimeClient,
|
|
1075
|
+
SecResource,
|
|
953
1076
|
SocialResource,
|
|
954
1077
|
TimeoutError,
|
|
955
1078
|
ValidationError,
|
|
@@ -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
|
+
}
|
|
@@ -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,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
|
+
}
|