@n1xyz/nord-ts 0.3.2 → 0.3.3

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.
@@ -3,9 +3,9 @@ import { Connection, PublicKey } from "@solana/web3.js";
3
3
  import { EventEmitter } from "events";
4
4
  import { Client } from "openapi-fetch";
5
5
  import type { paths } from "../gen/openapi.ts";
6
- import { Account, AccountPnlInfoPage, PagedQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, TriggerHistoryPage, WithdrawalHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo, AccountVolumeInfo, GetAccountVolumeQuery, PreviousMarketPrice } from "../types";
6
+ import { Account, AccountPnlInfoPage, PagedQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, TriggerHistoryPage, WithdrawalHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo, AccountVolumeInfo, GetAccountVolumeQuery, PreviousMarketPrice, CandleResolution } from "../types";
7
7
  import { NordWebSocketClient } from "../websocket/index";
8
- import { OrderbookSubscription, TradeSubscription } from "../websocket/Subscriber";
8
+ import { OrderbookSubscription, TradeSubscription, CandleSubscription } from "../websocket/Subscriber";
9
9
  /**
10
10
  * User subscription interface
11
11
  */
@@ -45,6 +45,7 @@ export declare class Nord {
45
45
  * @param trades - Market symbols to subscribe to for trade updates
46
46
  * @param deltas - Market symbols to subscribe to for orderbook delta updates
47
47
  * @param accounts - Account IDs to subscribe to for account updates
48
+ * @param candles - Candle subscriptions with symbol and resolution
48
49
  * @returns A new WebSocket client with the requested subscriptions
49
50
  * @throws {NordError} If invalid subscription options are provided
50
51
  *
@@ -62,10 +63,14 @@ export declare class Nord {
62
63
  * trades: ["BTCUSDC", "ETHUSDC"]
63
64
  * });
64
65
  */
65
- createWebSocketClient({ trades, deltas, accounts, }: Readonly<{
66
+ createWebSocketClient({ trades, deltas, accounts, candles, }: Readonly<{
66
67
  trades?: string[];
67
68
  deltas?: string[];
68
69
  accounts?: number[];
70
+ candles?: Array<{
71
+ symbol: string;
72
+ resolution: CandleResolution;
73
+ }>;
69
74
  }>): NordWebSocketClient;
70
75
  private GET;
71
76
  /**
@@ -161,6 +166,7 @@ export declare class Nord {
161
166
  * @throws {NordError} If symbol is invalid
162
167
  */
163
168
  subscribeOrderbook(symbol: string): OrderbookSubscription;
169
+ subscribeBars(symbol: string, resolution: CandleResolution): CandleSubscription;
164
170
  /**
165
171
  * Subscribe to trade updates for a market
166
172
  *
@@ -303,7 +303,7 @@ export interface paths {
303
303
  query?: never;
304
304
  header?: never;
305
305
  path: {
306
- /** @description where `streams` is `trades@{symbol} | deltas@{symbol} | account@{account id} [&, ...]` e.g. `/ws/trades@BTCUSDC&deltas@BTCUSDC&account@42` */
306
+ /** @description where `streams` is `trades@{symbol} | deltas@{symbol} | account@{account id} | candle@{symbol}:{resolution} [&, ...]` e.g. `/ws/trades@BTCUSDC&deltas@BTCUSDC&account@42&candle@BTCUSDC:60` */
307
307
  streams: string;
308
308
  };
309
309
  cookie?: never;
@@ -752,7 +752,13 @@ export interface paths {
752
752
  * For exact applied PnL use more per trade PnL. */
753
753
  get: {
754
754
  parameters: {
755
- query?: never;
755
+ query?: {
756
+ /** @description Optional market filter by market id or symbol. */
757
+ marketId?: number | null;
758
+ /** @description Optional limit on number of returned entries summary items per `market_id`. */
759
+ count?: number;
760
+ since?: string;
761
+ };
756
762
  header?: never;
757
763
  path: {
758
764
  /** @description Account for which to retrieve PnL history */
@@ -770,6 +776,22 @@ export interface paths {
770
776
  "application/json": components["schemas"]["AccountPnlHistInfo"][];
771
777
  };
772
778
  };
779
+ 400: {
780
+ headers: {
781
+ [name: string]: unknown;
782
+ };
783
+ content: {
784
+ "application/json": components["schemas"]["BadRequest"];
785
+ };
786
+ };
787
+ 404: {
788
+ headers: {
789
+ [name: string]: unknown;
790
+ };
791
+ content: {
792
+ "application/json": components["schemas"]["UserNotFound"];
793
+ };
794
+ };
773
795
  };
774
796
  };
775
797
  put?: never;
@@ -1571,6 +1593,116 @@ export interface paths {
1571
1593
  patch?: never;
1572
1594
  trace?: never;
1573
1595
  };
1596
+ "/account/{account_id}/history/deposit": {
1597
+ parameters: {
1598
+ query?: never;
1599
+ header?: never;
1600
+ path?: never;
1601
+ cookie?: never;
1602
+ };
1603
+ /** @description Fetch full history of deposits for an account. */
1604
+ get: {
1605
+ parameters: {
1606
+ query?: {
1607
+ /** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
1608
+ since?: string;
1609
+ /** @description end with this timestamp (RFC3339); defaults to current date-time */
1610
+ until?: string;
1611
+ /** @description fetch results starting with this page; query starts with first entry if page isn't specified */
1612
+ startInclusive?: string | null;
1613
+ /** @description Query returns up to 50 trades in one go. */
1614
+ pageSize?: number | null;
1615
+ };
1616
+ header?: never;
1617
+ path: {
1618
+ /** @description Account ID for which to fetch deposit history. */
1619
+ account_id: number;
1620
+ };
1621
+ cookie?: never;
1622
+ };
1623
+ requestBody?: never;
1624
+ responses: {
1625
+ 200: {
1626
+ headers: {
1627
+ [name: string]: unknown;
1628
+ };
1629
+ content: {
1630
+ "application/json": components["schemas"]["PageResult_for_String_and_DepositInfo"];
1631
+ };
1632
+ };
1633
+ 404: {
1634
+ headers: {
1635
+ [name: string]: unknown;
1636
+ };
1637
+ content: {
1638
+ "application/json": components["schemas"]["UserNotFound"];
1639
+ };
1640
+ };
1641
+ };
1642
+ };
1643
+ put?: never;
1644
+ post?: never;
1645
+ delete?: never;
1646
+ options?: never;
1647
+ head?: never;
1648
+ patch?: never;
1649
+ trace?: never;
1650
+ };
1651
+ "/account/{account_id}/history/liquidation": {
1652
+ parameters: {
1653
+ query?: never;
1654
+ header?: never;
1655
+ path?: never;
1656
+ cookie?: never;
1657
+ };
1658
+ /** @description Fetch full history of liquidations for an account. */
1659
+ get: {
1660
+ parameters: {
1661
+ query?: {
1662
+ /** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
1663
+ since?: string;
1664
+ /** @description end with this timestamp (RFC3339); defaults to current date-time */
1665
+ until?: string;
1666
+ /** @description fetch results starting with this page; query starts with first entry if page isn't specified */
1667
+ startInclusive?: string | null;
1668
+ /** @description Query returns up to 50 trades in one go. */
1669
+ pageSize?: number | null;
1670
+ };
1671
+ header?: never;
1672
+ path: {
1673
+ /** @description Account ID for which to fetch liquidation history. */
1674
+ account_id: number;
1675
+ };
1676
+ cookie?: never;
1677
+ };
1678
+ requestBody?: never;
1679
+ responses: {
1680
+ 200: {
1681
+ headers: {
1682
+ [name: string]: unknown;
1683
+ };
1684
+ content: {
1685
+ "application/json": components["schemas"]["PageResult_for_String_and_LiquidationInfo"];
1686
+ };
1687
+ };
1688
+ 404: {
1689
+ headers: {
1690
+ [name: string]: unknown;
1691
+ };
1692
+ content: {
1693
+ "application/json": components["schemas"]["UserNotFound"];
1694
+ };
1695
+ };
1696
+ };
1697
+ };
1698
+ put?: never;
1699
+ post?: never;
1700
+ delete?: never;
1701
+ options?: never;
1702
+ head?: never;
1703
+ patch?: never;
1704
+ trace?: never;
1705
+ };
1574
1706
  "/tv": {
1575
1707
  parameters: {
1576
1708
  query?: never;
@@ -1617,7 +1749,9 @@ export interface paths {
1617
1749
  /** @description Gets market updates history for some period of time. Default is hourly for last 24 hours */
1618
1750
  get: {
1619
1751
  parameters: {
1620
- query?: never;
1752
+ query?: {
1753
+ pageSize?: number;
1754
+ };
1621
1755
  header?: never;
1622
1756
  path: {
1623
1757
  market_id: number;
@@ -2861,6 +2995,23 @@ export interface components {
2861
2995
  */
2862
2996
  pnl: number;
2863
2997
  };
2998
+ /** @description Non paginating, just goes to some past extent. */
2999
+ GetAccountPnlFundingHistQuery: {
3000
+ /**
3001
+ * Format: uint32
3002
+ * @description Optional market filter by market id or symbol.
3003
+ * @default null
3004
+ */
3005
+ marketId: number | null;
3006
+ /**
3007
+ * Format: uint8
3008
+ * @description Optional limit on number of returned entries summary items per `market_id`.
3009
+ * @default 24
3010
+ */
3011
+ count: number;
3012
+ /** @default null */
3013
+ since: string;
3014
+ };
2864
3015
  AccountPnlHistInfo: {
2865
3016
  /** @description Same time when funding is applied */
2866
3017
  time: string;
@@ -2893,6 +3044,7 @@ export interface components {
2893
3044
  market_id: number;
2894
3045
  market_symbol: string;
2895
3046
  };
3047
+ BadRequest: null;
2896
3048
  PageResult_for_String_and_Trigger: {
2897
3049
  /** @description Set of items for requested by query. */
2898
3050
  items: components["schemas"]["Trigger"][];
@@ -3145,6 +3297,83 @@ export interface components {
3145
3297
  /** Format: int64 */
3146
3298
  fee: number;
3147
3299
  };
3300
+ PageResult_for_String_and_DepositInfo: {
3301
+ /** @description Set of items for requested by query. */
3302
+ items: components["schemas"]["DepositInfo"][];
3303
+ /** @description If request contains more data, this is the id is set with which next request should be performed to get next page. If no more data, then it is undefined. */
3304
+ nextStartInclusive?: string | null;
3305
+ };
3306
+ DepositInfo: {
3307
+ time: string;
3308
+ actionId: string;
3309
+ /** Format: uint32 */
3310
+ accountId: number;
3311
+ /** Format: uint32 */
3312
+ tokenId: number;
3313
+ /** Format: double */
3314
+ amount: number;
3315
+ /** Format: double */
3316
+ balance: number;
3317
+ /** Format: uint64 */
3318
+ eventIndex: number;
3319
+ };
3320
+ PageResult_for_String_and_LiquidationInfo: {
3321
+ /** @description Set of items for requested by query. */
3322
+ items: components["schemas"]["LiquidationInfo"][];
3323
+ /** @description If request contains more data, this is the id is set with which next request should be performed to get next page. If no more data, then it is undefined. */
3324
+ nextStartInclusive?: string | null;
3325
+ };
3326
+ LiquidationInfo: {
3327
+ time: string;
3328
+ actionId: string;
3329
+ /** Format: uint32 */
3330
+ liquidatorId: number;
3331
+ /** Format: uint32 */
3332
+ liquidateeId: number;
3333
+ /** Format: double */
3334
+ fee: number;
3335
+ liquidationKind: components["schemas"]["LiquidationKind"];
3336
+ /** Format: uint32 */
3337
+ marketId?: number | null;
3338
+ /** Format: uint32 */
3339
+ tokenId?: number | null;
3340
+ orderId?: string | null;
3341
+ /** Format: double */
3342
+ orderPrice?: number | null;
3343
+ /** Format: double */
3344
+ orderSize?: number | null;
3345
+ /** Format: double */
3346
+ orderQuote?: number | null;
3347
+ /** Format: double */
3348
+ preOmf: number;
3349
+ /** Format: double */
3350
+ preMmf: number;
3351
+ /** Format: double */
3352
+ preImf: number;
3353
+ /** Format: double */
3354
+ preCmf: number;
3355
+ /** Format: double */
3356
+ prePon: number;
3357
+ /** Format: double */
3358
+ preMf: number;
3359
+ /** Format: double */
3360
+ prePn: number;
3361
+ /** Format: double */
3362
+ postOmf: number;
3363
+ /** Format: double */
3364
+ postMmf: number;
3365
+ /** Format: double */
3366
+ postImf: number;
3367
+ /** Format: double */
3368
+ postCmf: number;
3369
+ /** Format: double */
3370
+ postPon: number;
3371
+ /** Format: double */
3372
+ postMf: number;
3373
+ /** Format: double */
3374
+ postPn: number;
3375
+ };
3376
+ LiquidationKind: "place_order" | "cancel_order" | "bankruptcy";
3148
3377
  /** @description TV config query response https://www.tradingview.com/charting-library-docs/latest/connecting_data/UDF/#data-feed-configuration-data */
3149
3378
  TvConfigResponse: {
3150
3379
  supported_resolutions: components["schemas"]["Resolution"][];
@@ -3157,7 +3386,7 @@ export interface components {
3157
3386
  * @description More limited resolution than history one, used in some HTTP queries
3158
3387
  * @enum {string}
3159
3388
  */
3160
- Resolution: "1" | "5" | "15" | "30" | "60" | "1D" | "1W" | "1M";
3389
+ Resolution: "OneMinute" | "FiveMinutes" | "FifteenMinutes" | "ThirtyMinutes" | "SixtyMinutes" | "OneDay" | "OneWeek" | "OneMonth";
3161
3390
  /** @description TV symbols query */
3162
3391
  TvSymbolsQuery: {
3163
3392
  symbol: string;
@@ -3309,6 +3538,13 @@ export interface components {
3309
3538
  };
3310
3539
  /** @description Empty object, to make quotes item conform to API error spec */
3311
3540
  TvQuotesErrorValues: Record<string, never>;
3541
+ GetMarketHistoryQuery: {
3542
+ /**
3543
+ * Format: uint8
3544
+ * @default 24
3545
+ */
3546
+ pageSize: number;
3547
+ };
3312
3548
  PageResult_for_String_and_MarketHistoryInfo: {
3313
3549
  /** @description Set of items for requested by query. */
3314
3550
  items: components["schemas"]["MarketHistoryInfo"][];
@@ -3323,6 +3559,13 @@ export interface components {
3323
3559
  fundingIndex: components["schemas"]["FundingIndexMantissa"];
3324
3560
  /** Format: double */
3325
3561
  fundingRate: number;
3562
+ /**
3563
+ * Format: double
3564
+ * @description Scaled in market price decimals
3565
+ */
3566
+ indexPrice: number;
3567
+ /** Format: double */
3568
+ markPrice: number;
3326
3569
  };
3327
3570
  /**
3328
3571
  * Format: int128