topstepx-api 1.0.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.
@@ -0,0 +1,731 @@
1
+ import { HubConnection } from '@microsoft/signalr';
2
+
3
+ interface HttpClientConfig {
4
+ baseUrl: string;
5
+ getToken: () => Promise<string>;
6
+ timeout?: number;
7
+ }
8
+ interface ApiResponseBase {
9
+ success: boolean;
10
+ errorCode: number;
11
+ errorMessage: string | null;
12
+ }
13
+ declare class HttpClient {
14
+ private readonly config;
15
+ constructor(config: HttpClientConfig);
16
+ post<TRequest, TResponse extends ApiResponseBase>(endpoint: string, data: TRequest): Promise<TResponse>;
17
+ }
18
+
19
+ interface Account {
20
+ id: number;
21
+ name: string;
22
+ canTrade: boolean;
23
+ isVisible: boolean;
24
+ }
25
+ interface SearchAccountsRequest {
26
+ onlyActiveAccounts: boolean;
27
+ }
28
+ interface SearchAccountsResponse {
29
+ accounts: Account[];
30
+ success: boolean;
31
+ errorCode: number;
32
+ errorMessage: string | null;
33
+ }
34
+
35
+ declare class AccountApi {
36
+ private readonly http;
37
+ constructor(http: HttpClient);
38
+ search(request: SearchAccountsRequest): Promise<Account[]>;
39
+ }
40
+
41
+ /**
42
+ * Type of order to place.
43
+ * @category Enums
44
+ */
45
+ declare enum OrderType {
46
+ /** Limit order - executes at specified price or better */
47
+ Limit = 1,
48
+ /** Market order - executes immediately at current market price */
49
+ Market = 2,
50
+ /** Stop order - becomes market order when stop price is reached */
51
+ Stop = 3,
52
+ /** Stop-limit order - becomes limit order when stop price is reached */
53
+ StopLimit = 4
54
+ }
55
+ /**
56
+ * Side of the order (buy or sell).
57
+ * @category Enums
58
+ */
59
+ declare enum OrderSide {
60
+ /** Buy order - go long or close short position */
61
+ Buy = 0,
62
+ /** Sell order - go short or close long position */
63
+ Sell = 1
64
+ }
65
+ /**
66
+ * Current status of an order.
67
+ * @category Enums
68
+ */
69
+ declare enum OrderStatus {
70
+ /** Order is pending submission */
71
+ Pending = 0,
72
+ /** Order is working (open) in the market */
73
+ Working = 1,
74
+ /** Order has been completely filled */
75
+ Filled = 2,
76
+ /** Order was cancelled */
77
+ Cancelled = 3,
78
+ /** Order was rejected */
79
+ Rejected = 4,
80
+ /** Order is partially filled */
81
+ PartiallyFilled = 5
82
+ }
83
+ /**
84
+ * Time unit for historical bar data.
85
+ * @category Enums
86
+ */
87
+ declare enum BarUnit {
88
+ /** Second bars */
89
+ Second = 1,
90
+ /** Minute bars */
91
+ Minute = 2,
92
+ /** Hourly bars */
93
+ Hour = 3,
94
+ /** Daily bars */
95
+ Day = 4,
96
+ /** Weekly bars */
97
+ Week = 5,
98
+ /** Monthly bars */
99
+ Month = 6
100
+ }
101
+ /**
102
+ * Type of position (long or short).
103
+ * @category Enums
104
+ */
105
+ declare enum PositionType {
106
+ /** Long position - bought contracts */
107
+ Long = 0,
108
+ /** Short position - sold contracts */
109
+ Short = 1
110
+ }
111
+ /**
112
+ * Type of trade execution.
113
+ * @category Enums
114
+ */
115
+ declare enum TradeType {
116
+ /** Trade executed at bid price */
117
+ Bid = 0,
118
+ /** Trade executed at ask price */
119
+ Ask = 1
120
+ }
121
+
122
+ interface Order {
123
+ id: number;
124
+ accountId: number;
125
+ contractId: string;
126
+ creationTimestamp: string;
127
+ updateTimestamp: string | null;
128
+ status: OrderStatus;
129
+ type: OrderType;
130
+ side: OrderSide;
131
+ size: number;
132
+ limitPrice: number | null;
133
+ stopPrice: number | null;
134
+ }
135
+ interface PlaceOrderRequest {
136
+ accountId: number;
137
+ contractId: string;
138
+ type: OrderType;
139
+ side: OrderSide;
140
+ size: number;
141
+ limitPrice?: number | null;
142
+ stopPrice?: number | null;
143
+ trailPrice?: number | null;
144
+ customTag?: string | null;
145
+ linkedOrderId?: number | null;
146
+ }
147
+ interface PlaceOrderResponse {
148
+ orderId: number;
149
+ success: boolean;
150
+ errorCode: number;
151
+ errorMessage: string | null;
152
+ }
153
+ interface SearchOrdersRequest {
154
+ accountId: number;
155
+ startTimestamp?: string;
156
+ endTimestamp?: string;
157
+ }
158
+ interface SearchOrdersResponse {
159
+ orders: Order[];
160
+ success: boolean;
161
+ errorCode: number;
162
+ errorMessage: string | null;
163
+ }
164
+ interface SearchOpenOrdersRequest {
165
+ accountId: number;
166
+ }
167
+ interface CancelOrderRequest {
168
+ accountId: number;
169
+ orderId: number;
170
+ }
171
+ interface CancelOrderResponse {
172
+ success: boolean;
173
+ errorCode: number;
174
+ errorMessage: string | null;
175
+ }
176
+ interface ModifyOrderRequest {
177
+ accountId: number;
178
+ orderId: number;
179
+ size?: number;
180
+ limitPrice?: number | null;
181
+ stopPrice?: number | null;
182
+ trailPrice?: number | null;
183
+ }
184
+ interface ModifyOrderResponse {
185
+ success: boolean;
186
+ errorCode: number;
187
+ errorMessage: string | null;
188
+ }
189
+
190
+ /**
191
+ * API for managing orders - place, cancel, modify, and search.
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * // Place a market order
196
+ * const result = await client.orders.place({
197
+ * accountId: 123,
198
+ * contractId: 'CON.F.US.ENQ.M25',
199
+ * type: OrderType.Market,
200
+ * side: OrderSide.Buy,
201
+ * size: 1,
202
+ * });
203
+ *
204
+ * // Cancel an order
205
+ * await client.orders.cancel({ accountId: 123, orderId: result.orderId });
206
+ * ```
207
+ *
208
+ * @category REST API
209
+ */
210
+ declare class OrderApi {
211
+ private readonly http;
212
+ /** @internal */
213
+ constructor(http: HttpClient);
214
+ /**
215
+ * Search historical orders within a date range.
216
+ * @param request - Search parameters including accountId and optional date range
217
+ * @returns Array of orders matching the search criteria
218
+ */
219
+ search(request: SearchOrdersRequest): Promise<Order[]>;
220
+ /**
221
+ * Get all currently open (working) orders for an account.
222
+ * @param request - Request containing the accountId
223
+ * @returns Array of open orders
224
+ */
225
+ searchOpen(request: SearchOpenOrdersRequest): Promise<Order[]>;
226
+ /**
227
+ * Place a new order.
228
+ * @param request - Order details including type, side, size, and prices
229
+ * @returns Response containing the new orderId
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * // Market order
234
+ * await client.orders.place({
235
+ * accountId: 123,
236
+ * contractId: 'CON.F.US.ENQ.M25',
237
+ * type: OrderType.Market,
238
+ * side: OrderSide.Buy,
239
+ * size: 1,
240
+ * });
241
+ *
242
+ * // Limit order
243
+ * await client.orders.place({
244
+ * accountId: 123,
245
+ * contractId: 'CON.F.US.ENQ.M25',
246
+ * type: OrderType.Limit,
247
+ * side: OrderSide.Buy,
248
+ * size: 1,
249
+ * limitPrice: 5000.00,
250
+ * });
251
+ * ```
252
+ */
253
+ place(request: PlaceOrderRequest): Promise<PlaceOrderResponse>;
254
+ /**
255
+ * Cancel an existing order.
256
+ * @param request - Request containing accountId and orderId to cancel
257
+ * @returns Response indicating success or failure
258
+ */
259
+ cancel(request: CancelOrderRequest): Promise<CancelOrderResponse>;
260
+ /**
261
+ * Modify an existing order's size or price.
262
+ * @param request - Request containing orderId and fields to modify
263
+ * @returns Response indicating success or failure
264
+ */
265
+ modify(request: ModifyOrderRequest): Promise<ModifyOrderResponse>;
266
+ }
267
+
268
+ interface Position {
269
+ id: number;
270
+ accountId: number;
271
+ contractId: string;
272
+ creationTimestamp: string;
273
+ type: PositionType;
274
+ size: number;
275
+ averagePrice: number;
276
+ }
277
+ interface SearchOpenPositionsRequest {
278
+ accountId: number;
279
+ }
280
+ interface SearchOpenPositionsResponse {
281
+ positions: Position[];
282
+ success: boolean;
283
+ errorCode: number;
284
+ errorMessage: string | null;
285
+ }
286
+ interface ClosePositionRequest {
287
+ accountId: number;
288
+ contractId: string;
289
+ }
290
+ interface ClosePositionResponse {
291
+ success: boolean;
292
+ errorCode: number;
293
+ errorMessage: string | null;
294
+ }
295
+ interface PartialClosePositionRequest {
296
+ accountId: number;
297
+ contractId: string;
298
+ size: number;
299
+ }
300
+ interface PartialClosePositionResponse {
301
+ success: boolean;
302
+ errorCode: number;
303
+ errorMessage: string | null;
304
+ }
305
+
306
+ declare class PositionApi {
307
+ private readonly http;
308
+ constructor(http: HttpClient);
309
+ searchOpen(request: SearchOpenPositionsRequest): Promise<Position[]>;
310
+ close(request: ClosePositionRequest): Promise<ClosePositionResponse>;
311
+ partialClose(request: PartialClosePositionRequest): Promise<PartialClosePositionResponse>;
312
+ }
313
+
314
+ interface Trade {
315
+ id: number;
316
+ accountId: number;
317
+ contractId: string;
318
+ creationTimestamp: string;
319
+ price: number;
320
+ profitAndLoss: number | null;
321
+ fees: number;
322
+ side: OrderSide;
323
+ size: number;
324
+ voided: boolean;
325
+ orderId: number;
326
+ }
327
+ interface SearchTradesRequest {
328
+ accountId: number;
329
+ startTimestamp: string;
330
+ endTimestamp: string;
331
+ }
332
+ interface SearchTradesResponse {
333
+ trades: Trade[];
334
+ success: boolean;
335
+ errorCode: number;
336
+ errorMessage: string | null;
337
+ }
338
+
339
+ declare class TradeApi {
340
+ private readonly http;
341
+ constructor(http: HttpClient);
342
+ search(request: SearchTradesRequest): Promise<Trade[]>;
343
+ }
344
+
345
+ interface Contract {
346
+ id: string;
347
+ name: string;
348
+ description: string;
349
+ tickSize: number;
350
+ tickValue: number;
351
+ activeContract: boolean;
352
+ }
353
+ interface SearchContractsRequest {
354
+ searchText: string;
355
+ live: boolean;
356
+ }
357
+ interface SearchContractsResponse {
358
+ contracts: Contract[];
359
+ success: boolean;
360
+ errorCode: number;
361
+ errorMessage: string | null;
362
+ }
363
+ interface SearchContractByIdRequest {
364
+ contractId: string;
365
+ live: boolean;
366
+ }
367
+ interface SearchContractByIdResponse {
368
+ contract: Contract | null;
369
+ success: boolean;
370
+ errorCode: number;
371
+ errorMessage: string | null;
372
+ }
373
+
374
+ declare class ContractApi {
375
+ private readonly http;
376
+ constructor(http: HttpClient);
377
+ search(request: SearchContractsRequest): Promise<Contract[]>;
378
+ searchById(request: SearchContractByIdRequest): Promise<Contract | null>;
379
+ }
380
+
381
+ interface Bar {
382
+ t: string;
383
+ o: number;
384
+ h: number;
385
+ l: number;
386
+ c: number;
387
+ v: number;
388
+ }
389
+ interface RetrieveBarsRequest {
390
+ contractId: string;
391
+ live: boolean;
392
+ startTime: string;
393
+ endTime: string;
394
+ unit: BarUnit;
395
+ unitNumber: number;
396
+ limit: number;
397
+ includePartialBar: boolean;
398
+ }
399
+ interface RetrieveBarsResponse {
400
+ bars: Bar[];
401
+ success: boolean;
402
+ errorCode: number;
403
+ errorMessage: string | null;
404
+ }
405
+
406
+ declare class HistoryApi {
407
+ private readonly http;
408
+ constructor(http: HttpClient);
409
+ retrieveBars(request: RetrieveBarsRequest): Promise<Bar[]>;
410
+ }
411
+
412
+ interface AuthConfig {
413
+ username: string;
414
+ apiKey: string;
415
+ baseUrl?: string;
416
+ autoRefresh?: boolean;
417
+ tokenValidityHours?: number;
418
+ }
419
+ interface LoginRequest {
420
+ userName: string;
421
+ apiKey: string;
422
+ }
423
+ interface LoginResponse {
424
+ token: string;
425
+ success: boolean;
426
+ errorCode: number;
427
+ errorMessage: string | null;
428
+ }
429
+ interface ValidateResponse {
430
+ success: boolean;
431
+ errorCode: number;
432
+ errorMessage: string | null;
433
+ }
434
+
435
+ declare class AuthService {
436
+ private sessionToken;
437
+ private tokenExpiration;
438
+ private refreshTimer?;
439
+ private readonly config;
440
+ constructor(config: AuthConfig);
441
+ login(): Promise<void>;
442
+ validate(): Promise<boolean>;
443
+ getSessionToken(): Promise<string>;
444
+ get baseUrl(): string;
445
+ private setTokenExpiration;
446
+ private isTokenExpired;
447
+ private scheduleTokenRefresh;
448
+ destroy(): void;
449
+ }
450
+
451
+ interface ConnectionManagerConfig {
452
+ marketHubUrl: string;
453
+ userHubUrl: string;
454
+ auth: AuthService;
455
+ reconnectDelays?: number[];
456
+ }
457
+ declare class ConnectionManager {
458
+ private marketConn;
459
+ private userConn;
460
+ private readonly config;
461
+ private marketConnectionCallbacks;
462
+ private userConnectionCallbacks;
463
+ constructor(config: ConnectionManagerConfig);
464
+ connect(): Promise<void>;
465
+ disconnect(): Promise<void>;
466
+ get isConnected(): boolean;
467
+ get marketConnection(): HubConnection;
468
+ get userConnection(): HubConnection;
469
+ onMarketConnection(callback: (conn: HubConnection) => void): void;
470
+ onUserConnection(callback: (conn: HubConnection) => void): void;
471
+ }
472
+
473
+ type EventMap = {
474
+ [key: string]: any;
475
+ };
476
+ type EventCallback<T> = T extends void ? () => void : (data: T) => void;
477
+ declare class TypedEventEmitter<T extends EventMap = EventMap> {
478
+ private listeners;
479
+ on<K extends keyof T>(event: K, callback: EventCallback<T[K]>): this;
480
+ off<K extends keyof T>(event: K, callback: EventCallback<T[K]>): this;
481
+ once<K extends keyof T>(event: K, callback: EventCallback<T[K]>): this;
482
+ protected emit<K extends keyof T>(event: K, ...args: T[K] extends void ? [] : [T[K]]): boolean;
483
+ removeAllListeners<K extends keyof T>(event?: K): this;
484
+ }
485
+
486
+ interface Quote {
487
+ symbol: string;
488
+ lastPrice: number;
489
+ bestBid: number;
490
+ bestAsk: number;
491
+ change: number;
492
+ changePercent: number;
493
+ volume: number;
494
+ lastUpdated: string;
495
+ timestamp: string;
496
+ }
497
+ interface MarketTrade {
498
+ symbolId: string;
499
+ price: number;
500
+ timestamp: string;
501
+ type: 0 | 1;
502
+ volume: number;
503
+ }
504
+ interface MarketDepth {
505
+ price: number;
506
+ volume: number;
507
+ currentVolume: number;
508
+ type: number;
509
+ timestamp: string;
510
+ }
511
+ interface MarketEvent<T> {
512
+ contractId: string;
513
+ data: T[];
514
+ }
515
+ interface MarketHubEvents {
516
+ [key: string]: unknown;
517
+ quote: MarketEvent<Quote>;
518
+ trade: MarketEvent<MarketTrade>;
519
+ depth: MarketEvent<MarketDepth>;
520
+ }
521
+
522
+ declare class MarketHub extends TypedEventEmitter<MarketHubEvents> {
523
+ private readonly connectionManager;
524
+ private subscribedQuotes;
525
+ private subscribedTrades;
526
+ private subscribedDepth;
527
+ constructor(connectionManager: ConnectionManager);
528
+ private setupEventHandlers;
529
+ subscribe(contractId: string): Promise<void>;
530
+ unsubscribe(contractId: string): Promise<void>;
531
+ subscribeQuotes(contractId: string): Promise<void>;
532
+ unsubscribeQuotes(contractId: string): Promise<void>;
533
+ subscribeTrades(contractId: string): Promise<void>;
534
+ unsubscribeTrades(contractId: string): Promise<void>;
535
+ subscribeDepth(contractId: string): Promise<void>;
536
+ unsubscribeDepth(contractId: string): Promise<void>;
537
+ }
538
+
539
+ interface OrderUpdate {
540
+ id: number;
541
+ accountId: number;
542
+ contractId: string;
543
+ creationTimestamp: string;
544
+ updateTimestamp: string | null;
545
+ status: OrderStatus;
546
+ type: OrderType;
547
+ side: OrderSide;
548
+ size: number;
549
+ limitPrice: number | null;
550
+ stopPrice: number | null;
551
+ }
552
+ interface PositionUpdate {
553
+ id: number;
554
+ accountId: number;
555
+ contractId: string;
556
+ creationTimestamp: string;
557
+ type: PositionType;
558
+ size: number;
559
+ averagePrice: number;
560
+ }
561
+ interface TradeUpdate {
562
+ id: number;
563
+ accountId: number;
564
+ contractId: string;
565
+ creationTimestamp: string;
566
+ price: number;
567
+ profitAndLoss: number | null;
568
+ fees: number;
569
+ side: OrderSide;
570
+ size: number;
571
+ voided: boolean;
572
+ orderId: number;
573
+ }
574
+ interface AccountUpdate {
575
+ id: number;
576
+ name: string;
577
+ canTrade: boolean;
578
+ balance: number;
579
+ }
580
+ interface UserHubEvents {
581
+ [key: string]: unknown;
582
+ order: OrderUpdate;
583
+ position: PositionUpdate;
584
+ trade: TradeUpdate;
585
+ account: AccountUpdate;
586
+ }
587
+
588
+ declare class UserHub extends TypedEventEmitter<UserHubEvents> {
589
+ private readonly connectionManager;
590
+ private subscribedOrders;
591
+ private subscribedPositions;
592
+ private subscribedTrades;
593
+ constructor(connectionManager: ConnectionManager);
594
+ private setupEventHandlers;
595
+ subscribe(accountId: number): Promise<void>;
596
+ unsubscribe(accountId: number): Promise<void>;
597
+ subscribeOrders(accountId: number): Promise<void>;
598
+ unsubscribeOrders(accountId: number): Promise<void>;
599
+ subscribePositions(accountId: number): Promise<void>;
600
+ unsubscribePositions(accountId: number): Promise<void>;
601
+ subscribeTrades(accountId: number): Promise<void>;
602
+ unsubscribeTrades(accountId: number): Promise<void>;
603
+ }
604
+
605
+ interface ApiResponse<T = unknown> {
606
+ success: boolean;
607
+ errorCode: number;
608
+ errorMessage: string | null;
609
+ [key: string]: T | boolean | number | string | null | undefined;
610
+ }
611
+ interface TopstepXClientConfig {
612
+ username: string;
613
+ apiKey: string;
614
+ baseUrl?: string;
615
+ marketHubUrl?: string;
616
+ userHubUrl?: string;
617
+ autoRefresh?: boolean;
618
+ tokenValidityHours?: number;
619
+ }
620
+ interface TopstepXClientEvents {
621
+ [key: string]: unknown;
622
+ connected: void;
623
+ disconnected: void;
624
+ error: Error;
625
+ reconnecting: void;
626
+ reconnected: void;
627
+ }
628
+
629
+ /**
630
+ * Main client for interacting with the TopstepX trading API.
631
+ *
632
+ * Provides access to REST APIs for account management, order placement,
633
+ * position management, trade history, contract search, and historical data.
634
+ * Also provides real-time WebSocket connections for market data and account updates.
635
+ *
636
+ * @example
637
+ * ```typescript
638
+ * import { TopstepXClient, OrderType, OrderSide } from 'topstepx-api';
639
+ *
640
+ * const client = new TopstepXClient({
641
+ * username: process.env.TOPSTEP_USERNAME,
642
+ * apiKey: process.env.TOPSTEP_API_KEY,
643
+ * });
644
+ *
645
+ * await client.connect();
646
+ *
647
+ * // Get accounts
648
+ * const accounts = await client.accounts.search({ onlyActiveAccounts: true });
649
+ *
650
+ * // Place an order
651
+ * await client.orders.place({
652
+ * accountId: accounts[0].id,
653
+ * contractId: 'CON.F.US.ENQ.M25',
654
+ * type: OrderType.Market,
655
+ * side: OrderSide.Buy,
656
+ * size: 1,
657
+ * });
658
+ *
659
+ * // Subscribe to real-time quotes
660
+ * client.marketHub.on('quote', ({ contractId, data }) => {
661
+ * console.log('Quote:', data);
662
+ * });
663
+ * await client.marketHub.subscribe('CON.F.US.ENQ.M25');
664
+ *
665
+ * await client.disconnect();
666
+ * ```
667
+ *
668
+ * @category Client
669
+ */
670
+ declare class TopstepXClient extends TypedEventEmitter<TopstepXClientEvents> {
671
+ private readonly auth;
672
+ private readonly connectionManager;
673
+ private readonly httpClient;
674
+ /** Account management API */
675
+ readonly accounts: AccountApi;
676
+ /** Order management API (place, cancel, modify, search) */
677
+ readonly orders: OrderApi;
678
+ /** Position management API (search, close) */
679
+ readonly positions: PositionApi;
680
+ /** Trade history API */
681
+ readonly trades: TradeApi;
682
+ /** Contract/symbol search API */
683
+ readonly contracts: ContractApi;
684
+ /** Historical bars/candles API */
685
+ readonly history: HistoryApi;
686
+ /** Real-time market data hub (quotes, trades, depth) */
687
+ readonly marketHub: MarketHub;
688
+ /** Real-time account data hub (orders, positions, trades) */
689
+ readonly userHub: UserHub;
690
+ constructor(config: TopstepXClientConfig);
691
+ /**
692
+ * Connect to the TopstepX API.
693
+ * Authenticates and establishes WebSocket connections.
694
+ */
695
+ connect(): Promise<void>;
696
+ /**
697
+ * Disconnect from all services.
698
+ */
699
+ disconnect(): Promise<void>;
700
+ /**
701
+ * Check if client is connected.
702
+ */
703
+ get isConnected(): boolean;
704
+ /**
705
+ * Get the current auth token (for advanced use cases).
706
+ */
707
+ getToken(): Promise<string>;
708
+ }
709
+
710
+ declare abstract class TopstepXError extends Error {
711
+ readonly code?: number | undefined;
712
+ readonly timestamp: Date;
713
+ constructor(message: string, code?: number | undefined);
714
+ toJSON(): Record<string, unknown>;
715
+ }
716
+
717
+ declare class AuthenticationError extends TopstepXError {
718
+ constructor(message: string, code?: number);
719
+ }
720
+
721
+ declare class ApiError extends TopstepXError {
722
+ readonly endpoint: string;
723
+ constructor(message: string, code: number, endpoint: string);
724
+ toJSON(): Record<string, unknown>;
725
+ }
726
+
727
+ declare class ConnectionError extends TopstepXError {
728
+ constructor(message: string);
729
+ }
730
+
731
+ export { type Account, AccountApi, type AccountUpdate, ApiError, type ApiResponse, type AuthConfig, AuthService, AuthenticationError, type Bar, BarUnit, type CancelOrderRequest, type CancelOrderResponse, type ClosePositionRequest, type ClosePositionResponse, ConnectionError, ConnectionManager, type ConnectionManagerConfig, type Contract, ContractApi, HistoryApi, HttpClient, type HttpClientConfig, type LoginRequest, type LoginResponse, type MarketDepth, type MarketEvent, MarketHub, type MarketHubEvents, type MarketTrade, type ModifyOrderRequest, type ModifyOrderResponse, type Order, OrderApi, OrderSide, OrderStatus, OrderType, type OrderUpdate, type PartialClosePositionRequest, type PartialClosePositionResponse, type PlaceOrderRequest, type PlaceOrderResponse, type Position, PositionApi, PositionType, type PositionUpdate, type Quote, type RetrieveBarsRequest, type RetrieveBarsResponse, type SearchAccountsRequest, type SearchAccountsResponse, type SearchContractByIdRequest, type SearchContractByIdResponse, type SearchContractsRequest, type SearchContractsResponse, type SearchOpenOrdersRequest, type SearchOpenPositionsRequest, type SearchOpenPositionsResponse, type SearchOrdersRequest, type SearchOrdersResponse, type SearchTradesRequest, type SearchTradesResponse, TopstepXClient, type TopstepXClientConfig, type TopstepXClientEvents, TopstepXError, type Trade, TradeApi, TradeType, type TradeUpdate, TypedEventEmitter, UserHub, type UserHubEvents, type ValidateResponse };