@piaa/sdk 1.1.0 → 1.2.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 +10 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +80 -6
- package/dist/resources/macro.d.ts +29 -0
- package/dist/resources/options.d.ts +25 -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
|
@@ -8,6 +8,8 @@ import { NewsResource } from "./resources/news";
|
|
|
8
8
|
import { SocialResource } from "./resources/social";
|
|
9
9
|
import { EconomicResource } from "./resources/economic";
|
|
10
10
|
import { FixedIncomeResource } from "./resources/fixed-income";
|
|
11
|
+
import { MacroResource } from "./resources/macro";
|
|
12
|
+
import { OptionsResource } from "./resources/options";
|
|
11
13
|
import { WsResource } from "./resources/ws";
|
|
12
14
|
import type { RateLimitInfo } from "./types";
|
|
13
15
|
export declare class PiaClient {
|
|
@@ -17,6 +19,14 @@ export declare class PiaClient {
|
|
|
17
19
|
* Market data & prices API resource.
|
|
18
20
|
*/
|
|
19
21
|
readonly market: MarketResource;
|
|
22
|
+
/**
|
|
23
|
+
* Derivatives, options chain, and Gamma Exposure (GEX) resource.
|
|
24
|
+
*/
|
|
25
|
+
readonly options: OptionsResource;
|
|
26
|
+
/**
|
|
27
|
+
* Macro indicators, Fear & Greed index, COT positioning, and central banks.
|
|
28
|
+
*/
|
|
29
|
+
readonly macro: MacroResource;
|
|
20
30
|
/**
|
|
21
31
|
* Social sentiment and discussions resource.
|
|
22
32
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,14 @@ 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 EconomicEvent, type EconomicCalendarResponse, type GetCalendarOptions, type YieldCurvePoint, type YieldCurveResponse, type MarketInsight, 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 SocialPostItem, type SocialPostsResponse, type GetSocialPostsOptions, type OptionContract, type OptionChainResponse, type OptionGexResponse, type OptionSummaryResponse, type FearGreedData, type FearGreedHistoryResponse, type CotPositioning, type CotReportResponse, type CentralBankStanceResponse, type NewsArticle, type NewsFeedResponse, type GetNewsOptions, type EconomicEvent, type EconomicCalendarResponse, type GetCalendarOptions, type YieldCurvePoint, type YieldCurveResponse, type MarketInsight, type WsTicketResponse, } from "./types";
|
|
10
|
+
export { MarketResource } from "./resources/market";
|
|
11
|
+
export { OptionsResource } from "./resources/options";
|
|
12
|
+
export { MacroResource } from "./resources/macro";
|
|
13
|
+
export { SocialResource } from "./resources/social";
|
|
14
|
+
export { NewsResource } from "./resources/news";
|
|
15
|
+
export { EconomicResource } from "./resources/economic";
|
|
16
|
+
export { FixedIncomeResource } from "./resources/fixed-income";
|
|
17
|
+
export { WsResource } from "./resources/ws";
|
|
10
18
|
export { RealtimeClient, type SocketState } from "./realtime/socket";
|
|
11
19
|
export { type RealtimeEvents } from "./realtime/events";
|
package/dist/index.js
CHANGED
|
@@ -253,7 +253,7 @@ function resolveConfig(options = {}) {
|
|
|
253
253
|
|
|
254
254
|
// src/http/transport.ts
|
|
255
255
|
var RETRYABLE_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504]);
|
|
256
|
-
var SDK_VERSION = "1.0
|
|
256
|
+
var SDK_VERSION = "1.2.0";
|
|
257
257
|
|
|
258
258
|
class HttpTransport {
|
|
259
259
|
config;
|
|
@@ -290,6 +290,7 @@ class HttpTransport {
|
|
|
290
290
|
}
|
|
291
291
|
try {
|
|
292
292
|
const headers = {
|
|
293
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
293
294
|
"x-api-key": this.config.apiKey,
|
|
294
295
|
Accept: "application/json",
|
|
295
296
|
"User-Agent": `pia-sdk-ts/${SDK_VERSION}`,
|
|
@@ -775,6 +776,17 @@ class SocialResource {
|
|
|
775
776
|
constructor(transport) {
|
|
776
777
|
this.transport = transport;
|
|
777
778
|
}
|
|
779
|
+
async getPosts(options) {
|
|
780
|
+
const params = new URLSearchParams;
|
|
781
|
+
if (options?.symbol)
|
|
782
|
+
params.set("symbol", options.symbol.trim().toUpperCase());
|
|
783
|
+
if (options?.limit)
|
|
784
|
+
params.set("limit", String(options.limit));
|
|
785
|
+
if (options?.cursor)
|
|
786
|
+
params.set("cursor", options.cursor);
|
|
787
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
788
|
+
return this.transport.request(`/api/v1/social/posts${query}`, "GET", undefined, options);
|
|
789
|
+
}
|
|
778
790
|
async getFeed(options) {
|
|
779
791
|
const params = new URLSearchParams;
|
|
780
792
|
if (options?.symbol)
|
|
@@ -786,9 +798,6 @@ class SocialResource {
|
|
|
786
798
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
787
799
|
return this.transport.request(`/api/v1/social/feed${query}`, "GET", undefined, options);
|
|
788
800
|
}
|
|
789
|
-
async getPosts(options) {
|
|
790
|
-
return this.getFeed(options);
|
|
791
|
-
}
|
|
792
801
|
}
|
|
793
802
|
|
|
794
803
|
// src/resources/economic.ts
|
|
@@ -825,6 +834,59 @@ class FixedIncomeResource {
|
|
|
825
834
|
}
|
|
826
835
|
}
|
|
827
836
|
|
|
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
|
+
|
|
828
890
|
// src/resources/ws.ts
|
|
829
891
|
class WsResource {
|
|
830
892
|
transport;
|
|
@@ -841,16 +903,20 @@ class PiaClient {
|
|
|
841
903
|
config;
|
|
842
904
|
transport;
|
|
843
905
|
market;
|
|
906
|
+
options;
|
|
907
|
+
macro;
|
|
844
908
|
social;
|
|
845
909
|
news;
|
|
846
910
|
economic;
|
|
847
911
|
fixedIncome;
|
|
848
912
|
ws;
|
|
849
913
|
realtime;
|
|
850
|
-
constructor(options
|
|
851
|
-
this.config =
|
|
914
|
+
constructor(options) {
|
|
915
|
+
this.config = resolveConfig(options);
|
|
852
916
|
this.transport = new HttpTransport(this.config);
|
|
853
917
|
this.market = new MarketResource(this.transport);
|
|
918
|
+
this.options = new OptionsResource(this.transport);
|
|
919
|
+
this.macro = new MacroResource(this.transport);
|
|
854
920
|
this.social = new SocialResource(this.transport);
|
|
855
921
|
this.news = new NewsResource(this.transport);
|
|
856
922
|
this.economic = new EconomicResource(this.transport);
|
|
@@ -871,15 +937,23 @@ export {
|
|
|
871
937
|
DEFAULT_TIMEOUT_MS,
|
|
872
938
|
DEFAULT_WS_URL,
|
|
873
939
|
DefaultLogger,
|
|
940
|
+
EconomicResource,
|
|
941
|
+
FixedIncomeResource,
|
|
942
|
+
MacroResource,
|
|
943
|
+
MarketResource,
|
|
874
944
|
NetworkError,
|
|
945
|
+
NewsResource,
|
|
946
|
+
OptionsResource,
|
|
875
947
|
ParseError,
|
|
876
948
|
PermissionError,
|
|
877
949
|
PiaClient,
|
|
878
950
|
PiaError,
|
|
879
951
|
RateLimitError,
|
|
880
952
|
RealtimeClient,
|
|
953
|
+
SocialResource,
|
|
881
954
|
TimeoutError,
|
|
882
955
|
ValidationError,
|
|
956
|
+
WsResource,
|
|
883
957
|
redactSensitive,
|
|
884
958
|
resolveConfig
|
|
885
959
|
};
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|