@n1xyz/nord-ts 0.1.8 → 0.1.9

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,7 +3,7 @@ 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, AccountPnlPage, AccountPnlQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, HistoryTriggerQuery, TriggerHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo } from "../types";
6
+ import { Account, AccountPnlPage, AccountPnlQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, HistoryTriggerQuery, TriggerHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo, AccountVolumeInfo, GetAccountVolumeQuery } from "../types";
7
7
  import { NordWebSocketClient } from "../websocket/index";
8
8
  import { OrderbookSubscription, TradeSubscription } from "../websocket/Subscriber";
9
9
  /**
@@ -89,6 +89,17 @@ export declare class Nord {
89
89
  * @throws {NordError} If the request fails
90
90
  */
91
91
  getAdminList(): Promise<Array<AdminInfo>>;
92
+ /**
93
+ * Get account volume across all markets, optionally for a specific market.
94
+ *
95
+ * @param accountId - Account identifier
96
+ * @param since - RFC3339 timestamp marking the inclusive start of the window
97
+ * @param until - RFC3339 timestamp marking the exclusive end of the window
98
+ * @param marketId - Optional market identifier to scope the volume
99
+ * @returns Array of market volumes (single entry when `marketId` is provided)
100
+ * @throws {NordError} If the request fails
101
+ */
102
+ getAccountVolume({ accountId, since, until, marketId, }: Readonly<GetAccountVolumeQuery>): Promise<Array<AccountVolumeInfo>>;
92
103
  /**
93
104
  * Fetch information about Nord markets and tokens
94
105
  *
@@ -130,6 +130,28 @@ export class Nord {
130
130
  async getAdminList() {
131
131
  return await this.GET("/admin", {});
132
132
  }
133
+ /**
134
+ * Get account volume across all markets, optionally for a specific market.
135
+ *
136
+ * @param accountId - Account identifier
137
+ * @param since - RFC3339 timestamp marking the inclusive start of the window
138
+ * @param until - RFC3339 timestamp marking the exclusive end of the window
139
+ * @param marketId - Optional market identifier to scope the volume
140
+ * @returns Array of market volumes (single entry when `marketId` is provided)
141
+ * @throws {NordError} If the request fails
142
+ */
143
+ async getAccountVolume({ accountId, since, until, marketId, }) {
144
+ return await this.GET("/account/volume", {
145
+ params: {
146
+ query: {
147
+ accountId,
148
+ since,
149
+ until,
150
+ marketId,
151
+ },
152
+ },
153
+ });
154
+ }
133
155
  /**
134
156
  * Fetch information about Nord markets and tokens
135
157
  *
@@ -1266,6 +1266,60 @@ export interface paths {
1266
1266
  patch?: never;
1267
1267
  trace?: never;
1268
1268
  };
1269
+ "/account/volume": {
1270
+ parameters: {
1271
+ query?: never;
1272
+ header?: never;
1273
+ path?: never;
1274
+ cookie?: never;
1275
+ };
1276
+ /** @description Get trading volume for an account
1277
+ *
1278
+ * Optionally, you can specify a market to get volume for. If not specified, array of (MarketId, Volume) is returned.
1279
+ *
1280
+ * Returns raw values, caller must rescale to base token decimals */
1281
+ get: {
1282
+ parameters: {
1283
+ query: {
1284
+ accountId: number;
1285
+ marketId?: number | null;
1286
+ /** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
1287
+ since?: string;
1288
+ /** @description end with this timestamp (RFC3339); defaults to current date-time */
1289
+ until?: string;
1290
+ };
1291
+ header?: never;
1292
+ path?: never;
1293
+ cookie?: never;
1294
+ };
1295
+ requestBody?: never;
1296
+ responses: {
1297
+ 200: {
1298
+ headers: {
1299
+ [name: string]: unknown;
1300
+ };
1301
+ content: {
1302
+ "application/json": components["schemas"]["AccountVolumeInfo"][];
1303
+ };
1304
+ };
1305
+ 404: {
1306
+ headers: {
1307
+ [name: string]: unknown;
1308
+ };
1309
+ content: {
1310
+ "application/json": components["schemas"]["UserNotFound"];
1311
+ };
1312
+ };
1313
+ };
1314
+ };
1315
+ put?: never;
1316
+ post?: never;
1317
+ delete?: never;
1318
+ options?: never;
1319
+ head?: never;
1320
+ patch?: never;
1321
+ trace?: never;
1322
+ };
1269
1323
  "/tv": {
1270
1324
  parameters: {
1271
1325
  query?: never;
@@ -2276,6 +2330,8 @@ export interface components {
2276
2330
  high24h: number;
2277
2331
  /** Format: double */
2278
2332
  low24h: number;
2333
+ /** Format: double */
2334
+ closePrice24h: number;
2279
2335
  perpStats?: components["schemas"]["PerpMarketStats"] | null;
2280
2336
  };
2281
2337
  PerpMarketStats: {
@@ -2727,6 +2783,28 @@ export interface components {
2727
2783
  key: string;
2728
2784
  roles: string[];
2729
2785
  };
2786
+ GetAccountVolumeQuery: {
2787
+ /** Format: uint32 */
2788
+ accountId: number;
2789
+ /** Format: uint32 */
2790
+ marketId?: number | null;
2791
+ /**
2792
+ * @description start with this timestamp (RFC3339); defaults to UNIX epoch start
2793
+ * @default null
2794
+ */
2795
+ since: string;
2796
+ /**
2797
+ * @description end with this timestamp (RFC3339); defaults to current date-time
2798
+ * @default null
2799
+ */
2800
+ until: string;
2801
+ };
2802
+ AccountVolumeInfo: {
2803
+ /** Format: uint32 */
2804
+ marketId: number;
2805
+ /** Format: double */
2806
+ volume: number;
2807
+ };
2730
2808
  /** @description TV config query response https://www.tradingview.com/charting-library-docs/latest/connecting_data/UDF/#data-feed-configuration-data */
2731
2809
  TvConfigResponse: {
2732
2810
  supported_resolutions: components["schemas"]["Resolution"][];
package/dist/types.d.ts CHANGED
@@ -71,6 +71,8 @@ export type TokenStats = components["schemas"]["TokenStats"];
71
71
  export type AccountFeeTier = components["schemas"]["AccountFeeTier"];
72
72
  export type AccountFeeTierPage = components["schemas"]["PageResult_for_uint32_and_AccountFeeTier"];
73
73
  export type AdminInfo = components["schemas"]["AdminInfo"];
74
+ export type GetAccountVolumeQuery = components["schemas"]["GetAccountVolumeQuery"];
75
+ export type AccountVolumeInfo = components["schemas"]["AccountVolumeInfo"];
74
76
  /**
75
77
  * Configuration options for the Nord client
76
78
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n1xyz/nord-ts",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Typescript for Nord",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@bufbuild/protobuf": "^2.6.3",
47
- "@n1xyz/proton": "0.0.6",
47
+ "@n1xyz/proton": "0.0.7",
48
48
  "@noble/curves": "^1.9.6",
49
49
  "@noble/ed25519": "^2.3.0",
50
50
  "@noble/hashes": "^1.8.0",