@nadohq/nuanze-client 0.41.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.
Files changed (102) hide show
  1. package/README.md +72 -0
  2. package/dist/NuanzeClient-BUjoXpWV.cjs +327 -0
  3. package/dist/NuanzeClient-BUjoXpWV.cjs.map +1 -0
  4. package/dist/NuanzeClient.cjs +4 -0
  5. package/dist/NuanzeClient.d.cts +229 -0
  6. package/dist/NuanzeClient.d.cts.map +1 -0
  7. package/dist/NuanzeClient.d.ts +229 -0
  8. package/dist/NuanzeClient.d.ts.map +1 -0
  9. package/dist/NuanzeClient.js +293 -0
  10. package/dist/NuanzeClient.js.map +1 -0
  11. package/dist/NuanzeServerFailureError-B9EhXPyW.d.cts +29 -0
  12. package/dist/NuanzeServerFailureError-B9EhXPyW.d.cts.map +1 -0
  13. package/dist/NuanzeServerFailureError-DqWaKEMA.d.ts +29 -0
  14. package/dist/NuanzeServerFailureError-DqWaKEMA.d.ts.map +1 -0
  15. package/dist/clientModelTypes-A-D7ER-p.d.ts +932 -0
  16. package/dist/clientModelTypes-A-D7ER-p.d.ts.map +1 -0
  17. package/dist/clientModelTypes-BLPA-e3V.d.cts +932 -0
  18. package/dist/clientModelTypes-BLPA-e3V.d.cts.map +1 -0
  19. package/dist/clientTypes-DdpinbkS.d.ts +642 -0
  20. package/dist/clientTypes-DdpinbkS.d.ts.map +1 -0
  21. package/dist/clientTypes-Du2RLy4W.d.cts +642 -0
  22. package/dist/clientTypes-Du2RLy4W.d.cts.map +1 -0
  23. package/dist/dataMappers.cjs +688 -0
  24. package/dist/dataMappers.cjs.map +1 -0
  25. package/dist/dataMappers.d.cts +159 -0
  26. package/dist/dataMappers.d.cts.map +1 -0
  27. package/dist/dataMappers.d.ts +159 -0
  28. package/dist/dataMappers.d.ts.map +1 -0
  29. package/dist/dataMappers.js +650 -0
  30. package/dist/dataMappers.js.map +1 -0
  31. package/dist/endpoints.cjs +18 -0
  32. package/dist/endpoints.cjs.map +1 -0
  33. package/dist/endpoints.d.cts +14 -0
  34. package/dist/endpoints.d.cts.map +1 -0
  35. package/dist/endpoints.d.ts +14 -0
  36. package/dist/endpoints.d.ts.map +1 -0
  37. package/dist/endpoints.js +17 -0
  38. package/dist/endpoints.js.map +1 -0
  39. package/dist/index.cjs +79 -0
  40. package/dist/index.d.cts +10 -0
  41. package/dist/index.d.ts +10 -0
  42. package/dist/index.js +9 -0
  43. package/dist/nuanzeErrorCodes-CWCTWh2k.d.cts +14 -0
  44. package/dist/nuanzeErrorCodes-CWCTWh2k.d.cts.map +1 -0
  45. package/dist/nuanzeErrorCodes-Dh6juim0.d.ts +14 -0
  46. package/dist/nuanzeErrorCodes-Dh6juim0.d.ts.map +1 -0
  47. package/dist/serverModelTypes-D-vS_7uc.d.ts +377 -0
  48. package/dist/serverModelTypes-D-vS_7uc.d.ts.map +1 -0
  49. package/dist/serverModelTypes-DZDxdIzz.d.cts +377 -0
  50. package/dist/serverModelTypes-DZDxdIzz.d.cts.map +1 -0
  51. package/dist/serverQueryTypes-BBIFZZ36.d.cts +240 -0
  52. package/dist/serverQueryTypes-BBIFZZ36.d.cts.map +1 -0
  53. package/dist/serverQueryTypes-e7HWmE8t.d.ts +240 -0
  54. package/dist/serverQueryTypes-e7HWmE8t.d.ts.map +1 -0
  55. package/dist/types/NuanzeServerFailureError.cjs +21 -0
  56. package/dist/types/NuanzeServerFailureError.cjs.map +1 -0
  57. package/dist/types/NuanzeServerFailureError.d.cts +2 -0
  58. package/dist/types/NuanzeServerFailureError.d.ts +2 -0
  59. package/dist/types/NuanzeServerFailureError.js +20 -0
  60. package/dist/types/NuanzeServerFailureError.js.map +1 -0
  61. package/dist/types/clientModelTypes.cjs +236 -0
  62. package/dist/types/clientModelTypes.cjs.map +1 -0
  63. package/dist/types/clientModelTypes.d.cts +2 -0
  64. package/dist/types/clientModelTypes.d.ts +2 -0
  65. package/dist/types/clientModelTypes.js +208 -0
  66. package/dist/types/clientModelTypes.js.map +1 -0
  67. package/dist/types/clientTypes.cjs +0 -0
  68. package/dist/types/clientTypes.d.cts +2 -0
  69. package/dist/types/clientTypes.d.ts +2 -0
  70. package/dist/types/clientTypes.js +1 -0
  71. package/dist/types/index.cjs +36 -0
  72. package/dist/types/index.d.cts +7 -0
  73. package/dist/types/index.d.ts +7 -0
  74. package/dist/types/index.js +5 -0
  75. package/dist/types/nuanzeErrorCodes.cjs +32 -0
  76. package/dist/types/nuanzeErrorCodes.cjs.map +1 -0
  77. package/dist/types/nuanzeErrorCodes.d.cts +2 -0
  78. package/dist/types/nuanzeErrorCodes.d.ts +2 -0
  79. package/dist/types/nuanzeErrorCodes.js +31 -0
  80. package/dist/types/nuanzeErrorCodes.js.map +1 -0
  81. package/dist/types/serverModelTypes.cjs +0 -0
  82. package/dist/types/serverModelTypes.d.cts +2 -0
  83. package/dist/types/serverModelTypes.d.ts +2 -0
  84. package/dist/types/serverModelTypes.js +1 -0
  85. package/dist/types/serverQueryTypes.cjs +15 -0
  86. package/dist/types/serverQueryTypes.cjs.map +1 -0
  87. package/dist/types/serverQueryTypes.d.cts +2 -0
  88. package/dist/types/serverQueryTypes.d.ts +2 -0
  89. package/dist/types/serverQueryTypes.js +14 -0
  90. package/dist/types/serverQueryTypes.js.map +1 -0
  91. package/package.json +54 -0
  92. package/src/NuanzeClient.ts +556 -0
  93. package/src/dataMappers.ts +889 -0
  94. package/src/endpoints.ts +14 -0
  95. package/src/index.ts +4 -0
  96. package/src/types/NuanzeServerFailureError.ts +36 -0
  97. package/src/types/clientModelTypes.ts +1085 -0
  98. package/src/types/clientTypes.ts +719 -0
  99. package/src/types/index.ts +6 -0
  100. package/src/types/nuanzeErrorCodes.ts +31 -0
  101. package/src/types/serverModelTypes.ts +422 -0
  102. package/src/types/serverQueryTypes.ts +298 -0
@@ -0,0 +1,6 @@
1
+ export * from './clientModelTypes';
2
+ export * from './clientTypes';
3
+ export * from './nuanzeErrorCodes';
4
+ export * from './NuanzeServerFailureError';
5
+ export * from './serverModelTypes';
6
+ export * from './serverQueryTypes';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Error codes returned by the Nuanze API, in the order the service declares them. The codes are part
3
+ * of the published contract and additive only, so a client release can only ever lag behind on new
4
+ * ones - it never has to unlearn a code.
5
+ */
6
+ export const NUANZE_ERROR_CODES = [
7
+ 'BAD_REQUEST',
8
+ 'INVALID_CURSOR',
9
+ 'CURSOR_FILTER_MISMATCH',
10
+ 'INVALID_ADDRESS',
11
+ 'INVALID_SUBACCOUNT',
12
+ 'AMBIGUOUS_MARKET',
13
+ 'MARKET_SELECTOR_MISMATCH',
14
+ 'MARKET_NOT_FOUND',
15
+ 'WALLET_NOT_FOUND',
16
+ 'UNSUPPORTED_INTERVAL',
17
+ 'UNSUPPORTED_BUCKET',
18
+ 'RANGE_TOO_LARGE',
19
+ 'NOT_FOUND',
20
+ 'METHOD_NOT_ALLOWED',
21
+ 'PAYLOAD_TOO_LARGE',
22
+ 'RATE_LIMITED',
23
+ 'INTERNAL_ERROR',
24
+ 'DEPENDENCY_UNAVAILABLE',
25
+ 'GATEWAY_TIMEOUT',
26
+ ] as const;
27
+
28
+ /**
29
+ * Union of all known Nuanze API error codes.
30
+ */
31
+ export type NuanzeErrorCode = (typeof NUANZE_ERROR_CODES)[number];
@@ -0,0 +1,422 @@
1
+ import {
2
+ NuanzeCohortKey,
3
+ NuanzeFlowEventType,
4
+ NuanzeFundamentalsSource,
5
+ NuanzeMarginKind,
6
+ NuanzeMarketComponentUpdatedAt,
7
+ NuanzeMarketIdentity,
8
+ NuanzeMarketTradingStatus,
9
+ NuanzeMarketVenue,
10
+ NuanzeMinPositionUsd,
11
+ NuanzeNewsStory,
12
+ NuanzeNotionalBucket,
13
+ NuanzePositionSide,
14
+ NuanzeTradeSide,
15
+ } from './clientModelTypes';
16
+
17
+ /**
18
+ * Latest price snapshot as returned on the wire. Decimals are finite base-10 strings and timestamps
19
+ * are UTC ISO 8601 strings; `dataMappers.ts` produces the client-facing shapes.
20
+ */
21
+ export interface NuanzeServerLatestTicker {
22
+ midPrice: string | null;
23
+ bidPrice: string | null;
24
+ askPrice: string | null;
25
+ volume24h: string | null;
26
+ openInterest: string | null;
27
+ priceChange24hPct: string | null;
28
+ updatedAt: string;
29
+ }
30
+
31
+ /**
32
+ * Market entry as returned on the wire. Unlike the other Nado services, Nuanze already serves
33
+ * camelCase keys and normalized enum values, so only decimals need mapping.
34
+ */
35
+ export interface NuanzeServerMarket extends NuanzeMarketIdentity {
36
+ tradingStatus: NuanzeMarketTradingStatus;
37
+ priceIncrement: string;
38
+ sizeIncrement: string;
39
+ minSize: string;
40
+ latest: NuanzeServerLatestTicker | null;
41
+ skew: string | null;
42
+ skewUpdatedAt: string | null;
43
+ updatedAt: string;
44
+ }
45
+
46
+ /**
47
+ * Funding observation as returned on the wire.
48
+ */
49
+ export interface NuanzeServerFundingObservation {
50
+ rate: string;
51
+ annualizedRate: string;
52
+ observedAt: string;
53
+ }
54
+
55
+ /**
56
+ * Funding rate row as returned on the wire.
57
+ */
58
+ export interface NuanzeServerFundingRate
59
+ extends NuanzeMarketIdentity, NuanzeServerFundingObservation {}
60
+
61
+ /**
62
+ * Nested key-data block as returned on the wire.
63
+ */
64
+ export interface NuanzeServerFundamentalsKeyData {
65
+ dividendYield: string | null;
66
+ employees: number | null;
67
+ enterpriseValue: string | null;
68
+ sharesOutstanding: string | null;
69
+ beta: string | null;
70
+ fiftyTwoWeekHigh: string | null;
71
+ fiftyTwoWeekLow: string | null;
72
+ volume: string | null;
73
+ averageVolume: string | null;
74
+ circulatingSupply: string | null;
75
+ totalSupply: string | null;
76
+ maxSupply: string | null;
77
+ fullyDilutedValuation: string | null;
78
+ ath: string | null;
79
+ atl: string | null;
80
+ high24h: string | null;
81
+ low24h: string | null;
82
+ }
83
+
84
+ /**
85
+ * Valuation block as returned on the wire.
86
+ */
87
+ export interface NuanzeServerFundamentalsValuation {
88
+ trailingPE: string | null;
89
+ forwardPE: string | null;
90
+ priceToBook: string | null;
91
+ enterpriseToRevenue: string | null;
92
+ enterpriseToEbitda: string | null;
93
+ revenue: string | null;
94
+ profitMargins: string | null;
95
+ }
96
+
97
+ /**
98
+ * Performance block as returned on the wire.
99
+ */
100
+ export interface NuanzeServerFundamentalsPerformance {
101
+ oneMonth: string | null;
102
+ threeMonth: string | null;
103
+ ytd: string | null;
104
+ oneYear: string | null;
105
+ }
106
+
107
+ /**
108
+ * Social/link block as returned on the wire. Identical to the client shape.
109
+ */
110
+ export interface NuanzeServerFundamentalsSocial {
111
+ website: string | null;
112
+ x: string | null;
113
+ linkedin: string | null;
114
+ }
115
+
116
+ /**
117
+ * Fundamentals projection as returned on the wire.
118
+ */
119
+ export interface NuanzeServerStockFundamentals {
120
+ productId: number;
121
+ source: NuanzeFundamentalsSource | null;
122
+ quoteType: string | null;
123
+ currency: string | null;
124
+ name: string | null;
125
+ description: string | null;
126
+ sector: string | null;
127
+ industry: string | null;
128
+ website: string | null;
129
+ employees: number | null;
130
+ marketCap: string | null;
131
+ keyData: NuanzeServerFundamentalsKeyData;
132
+ valuation: NuanzeServerFundamentalsValuation;
133
+ performance: NuanzeServerFundamentalsPerformance;
134
+ social: NuanzeServerFundamentalsSocial;
135
+ updatedAt: string;
136
+ }
137
+
138
+ /**
139
+ * Resolved market detail as returned on the wire.
140
+ */
141
+ export interface NuanzeServerMarketDetail extends NuanzeServerMarket {
142
+ primaryProductId: number;
143
+ availableVenues: NuanzeMarketVenue[];
144
+ primaryVenue: NuanzeMarketVenue;
145
+ funding: NuanzeServerFundingObservation | null;
146
+ fundamentals: NuanzeServerStockFundamentals | null;
147
+ news: NuanzeNewsStory[];
148
+ componentUpdatedAt: NuanzeMarketComponentUpdatedAt;
149
+ }
150
+
151
+ /**
152
+ * Leaderboard row as returned on the wire.
153
+ */
154
+ export interface NuanzeServerLeaderboardItem {
155
+ rank: number;
156
+ rankDelta: number | null;
157
+ address: string;
158
+ accountPnl: string;
159
+ pnl24h: string | null;
160
+ pnl7d: string | null;
161
+ pnl30d: string | null;
162
+ pnlAll: string;
163
+ wins: number;
164
+ losses: number;
165
+ winRate: string | null;
166
+ }
167
+
168
+ /**
169
+ * Followed-leaderboard row as returned on the wire.
170
+ */
171
+ export interface NuanzeServerFollowedLeaderboardItem {
172
+ subaccountHex: string;
173
+ pnl: string | null;
174
+ wins: number;
175
+ losses: number;
176
+ winRate: string | null;
177
+ trades: number;
178
+ productIds: number[];
179
+ productCount: number;
180
+ globalRank: number | null;
181
+ }
182
+
183
+ /**
184
+ * Platform percentage deltas as returned on the wire.
185
+ */
186
+ export interface NuanzeServerPlatformDeltas {
187
+ volumePct: string | null;
188
+ tradesPct: string | null;
189
+ tradersPct: string | null;
190
+ }
191
+
192
+ /**
193
+ * Wallet position snapshot as returned on the wire.
194
+ */
195
+ export interface NuanzeServerWalletPosition {
196
+ subaccountName: string;
197
+ productId: number;
198
+ symbol: string;
199
+ ticker: string;
200
+ venue: NuanzeMarketVenue;
201
+ side: NuanzePositionSide;
202
+ isSpot: boolean;
203
+ amount: string;
204
+ oraclePrice: string;
205
+ notional: string;
206
+ unrealizedPnl: string;
207
+ snapshotAt: string;
208
+ }
209
+
210
+ /**
211
+ * Market tape row as returned on the wire.
212
+ */
213
+ export interface NuanzeServerMarketTrade {
214
+ id: number;
215
+ productId: number;
216
+ symbol: string;
217
+ ticker: string;
218
+ venue: NuanzeMarketVenue;
219
+ side: NuanzeTradeSide;
220
+ price: string;
221
+ amount: string;
222
+ notional: string;
223
+ matchedAt: string;
224
+ }
225
+
226
+ /**
227
+ * Per-trader market position leg as returned on the wire.
228
+ */
229
+ export interface NuanzeServerMarketPosition {
230
+ subaccountOwner: string;
231
+ subaccountName: string;
232
+ symbol: string;
233
+ marginKind: NuanzeMarginKind;
234
+ side: NuanzePositionSide;
235
+ amount: string;
236
+ notional: string;
237
+ upnl: string;
238
+ margin: string | null;
239
+ entryPrice: string | null;
240
+ }
241
+
242
+ /**
243
+ * Globally ranked current open position leg as returned on the wire.
244
+ */
245
+ export interface NuanzeServerOpenPosition extends NuanzeServerMarketPosition {
246
+ productId: number;
247
+ ticker: string;
248
+ venue: 'perp';
249
+ snapshotAt: string;
250
+ }
251
+
252
+ /**
253
+ * Candle as returned on the wire.
254
+ */
255
+ export interface NuanzeServerCandle {
256
+ openTime: string;
257
+ open: string;
258
+ high: string;
259
+ low: string;
260
+ close: string;
261
+ volume: string;
262
+ complete: boolean;
263
+ }
264
+
265
+ /**
266
+ * Wallet trade as returned on the wire.
267
+ */
268
+ export interface NuanzeServerWalletTrade {
269
+ id: number;
270
+ subaccountName: string;
271
+ productId: number;
272
+ symbol: string;
273
+ ticker: string;
274
+ venue: NuanzeMarketVenue;
275
+ side: NuanzeTradeSide;
276
+ isMaker: boolean;
277
+ price: string;
278
+ amount: string;
279
+ notional: string;
280
+ matchedAt: string;
281
+ }
282
+
283
+ /**
284
+ * Wallet series point as returned on the wire.
285
+ */
286
+ export interface NuanzeServerSeriesPoint {
287
+ timestamp: string;
288
+ value: string | null;
289
+ synthetic: boolean;
290
+ provisional: boolean;
291
+ }
292
+
293
+ /**
294
+ * Collateral event as returned on the wire. Tags have no decimals.
295
+ */
296
+ export interface NuanzeServerCollateralFlow {
297
+ id: number;
298
+ eventType: NuanzeFlowEventType;
299
+ productId: number;
300
+ symbol: string;
301
+ assetAmount: string;
302
+ oraclePrice: string | null;
303
+ usdValue: string | null;
304
+ owner: string;
305
+ subaccountName: string;
306
+ timestamp: string;
307
+ tags: {
308
+ whale: boolean;
309
+ smartMoney: boolean;
310
+ freshWallet: boolean;
311
+ };
312
+ }
313
+
314
+ /**
315
+ * Collateral flow series point as returned on the wire.
316
+ */
317
+ export interface NuanzeServerCollateralFlowPoint {
318
+ timestamp: string;
319
+ deposited: string;
320
+ withdrawn: string;
321
+ net: string;
322
+ cumulativeNet: string;
323
+ eventCount: number;
324
+ valuedCount: number;
325
+ unvaluedCount: number;
326
+ }
327
+
328
+ /**
329
+ * Positioning totals as returned on the wire.
330
+ */
331
+ export interface NuanzeServerPositioningTotals {
332
+ longPositions: number | null;
333
+ shortPositions: number | null;
334
+ longOwners: number | null;
335
+ shortOwners: number | null;
336
+ netFlatOwners: number | null;
337
+ longNotional: string | null;
338
+ shortNotional: string | null;
339
+ longPositionPct: string | null;
340
+ shortPositionPct: string | null;
341
+ longShortRatio: string | null;
342
+ }
343
+
344
+ /**
345
+ * Shared positioning cell fields as returned on the wire.
346
+ */
347
+ export interface NuanzeServerPositioningCellBase {
348
+ label: string;
349
+ side: NuanzePositionSide | null;
350
+ suppressed: boolean;
351
+ suppressionThreshold: 20;
352
+ positions: number | null;
353
+ owners: number | null;
354
+ notional: string | null;
355
+ averageNotional: string | null;
356
+ percentage: string | null;
357
+ }
358
+
359
+ /**
360
+ * Side positioning cell as returned on the wire.
361
+ */
362
+ export interface NuanzeServerSidePositioningCell extends NuanzeServerPositioningCellBase {
363
+ key: NuanzePositionSide;
364
+ }
365
+
366
+ /**
367
+ * Cohort positioning cell as returned on the wire.
368
+ */
369
+ export interface NuanzeServerCohortPositioningCell extends NuanzeServerPositioningCellBase {
370
+ key: NuanzeCohortKey;
371
+ }
372
+
373
+ /**
374
+ * Notional-bucket positioning cell as returned on the wire.
375
+ */
376
+ export interface NuanzeServerNotionalBucketPositioningCell extends NuanzeServerPositioningCellBase {
377
+ key: NuanzeNotionalBucket;
378
+ }
379
+
380
+ /**
381
+ * Shared positioning response fields as returned on the wire.
382
+ */
383
+ export interface NuanzeServerMarketPositioningBase extends NuanzeMarketIdentity {
384
+ effectiveMinPositionUsd: NuanzeMinPositionUsd;
385
+ suppressionThreshold: 20;
386
+ totals: NuanzeServerPositioningTotals;
387
+ newestSnapshotAt: string | null;
388
+ oldestSnapshotAt: string | null;
389
+ asOf: string;
390
+ }
391
+
392
+ /**
393
+ * Side-grouped positioning response as returned on the wire.
394
+ */
395
+ export interface NuanzeServerMarketPositioningSideResponse extends NuanzeServerMarketPositioningBase {
396
+ groupBy: 'side';
397
+ cells: NuanzeServerSidePositioningCell[];
398
+ }
399
+
400
+ /**
401
+ * Cohort-grouped positioning response as returned on the wire.
402
+ */
403
+ export interface NuanzeServerMarketPositioningCohortResponse extends NuanzeServerMarketPositioningBase {
404
+ groupBy: 'cohort';
405
+ cells: NuanzeServerCohortPositioningCell[];
406
+ }
407
+
408
+ /**
409
+ * Notional-bucket positioning response as returned on the wire.
410
+ */
411
+ export interface NuanzeServerMarketPositioningNotionalBucketResponse extends NuanzeServerMarketPositioningBase {
412
+ groupBy: 'notionalBucket';
413
+ cells: NuanzeServerNotionalBucketPositioningCell[];
414
+ }
415
+
416
+ /**
417
+ * Discriminated positioning response as returned on the wire.
418
+ */
419
+ export type NuanzeServerMarketPositioningResponse =
420
+ | NuanzeServerMarketPositioningSideResponse
421
+ | NuanzeServerMarketPositioningCohortResponse
422
+ | NuanzeServerMarketPositioningNotionalBucketResponse;