pmxtjs 2.19.3 → 2.19.5

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.
@@ -44,6 +44,7 @@ export declare abstract class Exchange {
44
44
  private initializeServer;
45
45
  protected handleResponse(response: any): any;
46
46
  protected getCredentials(): ExchangeCredentials | undefined;
47
+ protected getAuthHeaders(): Record<string, string>;
47
48
  /**
48
49
  * Call an exchange-specific REST endpoint by its operationId.
49
50
  * This provides direct access to all implicit API methods defined in
@@ -183,15 +183,9 @@ export class Exchange {
183
183
  // (may differ from default if default port was busy)
184
184
  const actualPort = this.serverManager.getRunningPort();
185
185
  const newBaseUrl = `http://localhost:${actualPort}`;
186
- const accessToken = this.serverManager.getAccessToken();
187
- const headers = {};
188
- if (accessToken) {
189
- headers['x-pmxt-access-token'] = accessToken;
190
- }
191
186
  // Update API client with actual base URL
192
187
  this.config = new Configuration({
193
188
  basePath: newBaseUrl,
194
- headers
195
189
  });
196
190
  this.api = new DefaultApi(this.config);
197
191
  }
@@ -220,6 +214,14 @@ export class Exchange {
220
214
  signatureType: this.signatureType,
221
215
  };
222
216
  }
217
+ getAuthHeaders() {
218
+ const headers = { ...this.config.headers };
219
+ const accessToken = this.serverManager.getAccessToken();
220
+ if (accessToken) {
221
+ headers['x-pmxt-access-token'] = accessToken;
222
+ }
223
+ return headers;
224
+ }
223
225
  // Low-Level API Access
224
226
  /**
225
227
  * Call an exchange-specific REST endpoint by its operationId.
@@ -248,7 +250,7 @@ export class Exchange {
248
250
  method: 'POST',
249
251
  headers: {
250
252
  'Content-Type': 'application/json',
251
- ...this.config.headers
253
+ ...this.getAuthHeaders()
252
254
  },
253
255
  body: JSON.stringify(requestBody)
254
256
  });
@@ -271,7 +273,7 @@ export class Exchange {
271
273
  args.push(reload);
272
274
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/loadMarkets`, {
273
275
  method: 'POST',
274
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
276
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
275
277
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
276
278
  });
277
279
  if (!response.ok) {
@@ -298,7 +300,7 @@ export class Exchange {
298
300
  args.push(params);
299
301
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarkets`, {
300
302
  method: 'POST',
301
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
303
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
302
304
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
303
305
  });
304
306
  if (!response.ok) {
@@ -321,7 +323,7 @@ export class Exchange {
321
323
  args.push(params);
322
324
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarketsPaginated`, {
323
325
  method: 'POST',
324
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
326
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
325
327
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
326
328
  });
327
329
  if (!response.ok) {
@@ -348,7 +350,7 @@ export class Exchange {
348
350
  args.push(params);
349
351
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchEvents`, {
350
352
  method: 'POST',
351
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
353
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
352
354
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
353
355
  });
354
356
  if (!response.ok) {
@@ -371,7 +373,7 @@ export class Exchange {
371
373
  args.push(params);
372
374
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarket`, {
373
375
  method: 'POST',
374
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
376
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
375
377
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
376
378
  });
377
379
  if (!response.ok) {
@@ -394,7 +396,7 @@ export class Exchange {
394
396
  args.push(params);
395
397
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchEvent`, {
396
398
  method: 'POST',
397
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
399
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
398
400
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
399
401
  });
400
402
  if (!response.ok) {
@@ -416,7 +418,7 @@ export class Exchange {
416
418
  args.push(id);
417
419
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOrderBook`, {
418
420
  method: 'POST',
419
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
421
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
420
422
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
421
423
  });
422
424
  if (!response.ok) {
@@ -438,7 +440,7 @@ export class Exchange {
438
440
  args.push(orderId);
439
441
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/cancelOrder`, {
440
442
  method: 'POST',
441
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
443
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
442
444
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
443
445
  });
444
446
  if (!response.ok) {
@@ -460,7 +462,7 @@ export class Exchange {
460
462
  args.push(orderId);
461
463
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOrder`, {
462
464
  method: 'POST',
463
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
465
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
464
466
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
465
467
  });
466
468
  if (!response.ok) {
@@ -483,7 +485,7 @@ export class Exchange {
483
485
  args.push(marketId);
484
486
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOpenOrders`, {
485
487
  method: 'POST',
486
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
488
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
487
489
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
488
490
  });
489
491
  if (!response.ok) {
@@ -506,7 +508,7 @@ export class Exchange {
506
508
  args.push(params);
507
509
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMyTrades`, {
508
510
  method: 'POST',
509
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
511
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
510
512
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
511
513
  });
512
514
  if (!response.ok) {
@@ -529,7 +531,7 @@ export class Exchange {
529
531
  args.push(params);
530
532
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchClosedOrders`, {
531
533
  method: 'POST',
532
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
534
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
533
535
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
534
536
  });
535
537
  if (!response.ok) {
@@ -552,7 +554,7 @@ export class Exchange {
552
554
  args.push(params);
553
555
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchAllOrders`, {
554
556
  method: 'POST',
555
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
557
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
556
558
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
557
559
  });
558
560
  if (!response.ok) {
@@ -573,7 +575,7 @@ export class Exchange {
573
575
  const args = [];
574
576
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchPositions`, {
575
577
  method: 'POST',
576
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
578
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
577
579
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
578
580
  });
579
581
  if (!response.ok) {
@@ -594,7 +596,7 @@ export class Exchange {
594
596
  const args = [];
595
597
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchBalance`, {
596
598
  method: 'POST',
597
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
599
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
598
600
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
599
601
  });
600
602
  if (!response.ok) {
@@ -615,7 +617,7 @@ export class Exchange {
615
617
  const args = [];
616
618
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/close`, {
617
619
  method: 'POST',
618
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
620
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
619
621
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
620
622
  });
621
623
  if (!response.ok) {
@@ -667,7 +669,7 @@ export class Exchange {
667
669
  const response = await this.api.fetchOHLCV({
668
670
  exchange: this.exchangeName,
669
671
  fetchOHLCVRequest: requestBody,
670
- });
672
+ }, { headers: this.getAuthHeaders() });
671
673
  const data = this.handleResponse(response);
672
674
  return data.map(convertCandle);
673
675
  }
@@ -698,7 +700,7 @@ export class Exchange {
698
700
  const response = await this.api.fetchTrades({
699
701
  exchange: this.exchangeName,
700
702
  fetchTradesRequest: requestBody,
701
- });
703
+ }, { headers: this.getAuthHeaders() });
702
704
  const data = this.handleResponse(response);
703
705
  return data.map(convertTrade);
704
706
  }
@@ -44,6 +44,7 @@ export declare abstract class Exchange {
44
44
  private initializeServer;
45
45
  protected handleResponse(response: any): any;
46
46
  protected getCredentials(): ExchangeCredentials | undefined;
47
+ protected getAuthHeaders(): Record<string, string>;
47
48
  /**
48
49
  * Call an exchange-specific REST endpoint by its operationId.
49
50
  * This provides direct access to all implicit API methods defined in
@@ -186,15 +186,9 @@ class Exchange {
186
186
  // (may differ from default if default port was busy)
187
187
  const actualPort = this.serverManager.getRunningPort();
188
188
  const newBaseUrl = `http://localhost:${actualPort}`;
189
- const accessToken = this.serverManager.getAccessToken();
190
- const headers = {};
191
- if (accessToken) {
192
- headers['x-pmxt-access-token'] = accessToken;
193
- }
194
189
  // Update API client with actual base URL
195
190
  this.config = new index_js_1.Configuration({
196
191
  basePath: newBaseUrl,
197
- headers
198
192
  });
199
193
  this.api = new index_js_1.DefaultApi(this.config);
200
194
  }
@@ -223,6 +217,14 @@ class Exchange {
223
217
  signatureType: this.signatureType,
224
218
  };
225
219
  }
220
+ getAuthHeaders() {
221
+ const headers = { ...this.config.headers };
222
+ const accessToken = this.serverManager.getAccessToken();
223
+ if (accessToken) {
224
+ headers['x-pmxt-access-token'] = accessToken;
225
+ }
226
+ return headers;
227
+ }
226
228
  // Low-Level API Access
227
229
  /**
228
230
  * Call an exchange-specific REST endpoint by its operationId.
@@ -251,7 +253,7 @@ class Exchange {
251
253
  method: 'POST',
252
254
  headers: {
253
255
  'Content-Type': 'application/json',
254
- ...this.config.headers
256
+ ...this.getAuthHeaders()
255
257
  },
256
258
  body: JSON.stringify(requestBody)
257
259
  });
@@ -274,7 +276,7 @@ class Exchange {
274
276
  args.push(reload);
275
277
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/loadMarkets`, {
276
278
  method: 'POST',
277
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
279
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
278
280
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
279
281
  });
280
282
  if (!response.ok) {
@@ -301,7 +303,7 @@ class Exchange {
301
303
  args.push(params);
302
304
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarkets`, {
303
305
  method: 'POST',
304
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
306
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
305
307
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
306
308
  });
307
309
  if (!response.ok) {
@@ -324,7 +326,7 @@ class Exchange {
324
326
  args.push(params);
325
327
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarketsPaginated`, {
326
328
  method: 'POST',
327
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
329
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
328
330
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
329
331
  });
330
332
  if (!response.ok) {
@@ -351,7 +353,7 @@ class Exchange {
351
353
  args.push(params);
352
354
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchEvents`, {
353
355
  method: 'POST',
354
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
356
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
355
357
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
356
358
  });
357
359
  if (!response.ok) {
@@ -374,7 +376,7 @@ class Exchange {
374
376
  args.push(params);
375
377
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarket`, {
376
378
  method: 'POST',
377
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
379
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
378
380
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
379
381
  });
380
382
  if (!response.ok) {
@@ -397,7 +399,7 @@ class Exchange {
397
399
  args.push(params);
398
400
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchEvent`, {
399
401
  method: 'POST',
400
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
402
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
401
403
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
402
404
  });
403
405
  if (!response.ok) {
@@ -419,7 +421,7 @@ class Exchange {
419
421
  args.push(id);
420
422
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOrderBook`, {
421
423
  method: 'POST',
422
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
424
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
423
425
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
424
426
  });
425
427
  if (!response.ok) {
@@ -441,7 +443,7 @@ class Exchange {
441
443
  args.push(orderId);
442
444
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/cancelOrder`, {
443
445
  method: 'POST',
444
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
446
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
445
447
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
446
448
  });
447
449
  if (!response.ok) {
@@ -463,7 +465,7 @@ class Exchange {
463
465
  args.push(orderId);
464
466
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOrder`, {
465
467
  method: 'POST',
466
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
468
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
467
469
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
468
470
  });
469
471
  if (!response.ok) {
@@ -486,7 +488,7 @@ class Exchange {
486
488
  args.push(marketId);
487
489
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOpenOrders`, {
488
490
  method: 'POST',
489
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
491
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
490
492
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
491
493
  });
492
494
  if (!response.ok) {
@@ -509,7 +511,7 @@ class Exchange {
509
511
  args.push(params);
510
512
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMyTrades`, {
511
513
  method: 'POST',
512
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
514
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
513
515
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
514
516
  });
515
517
  if (!response.ok) {
@@ -532,7 +534,7 @@ class Exchange {
532
534
  args.push(params);
533
535
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchClosedOrders`, {
534
536
  method: 'POST',
535
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
537
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
536
538
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
537
539
  });
538
540
  if (!response.ok) {
@@ -555,7 +557,7 @@ class Exchange {
555
557
  args.push(params);
556
558
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchAllOrders`, {
557
559
  method: 'POST',
558
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
560
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
559
561
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
560
562
  });
561
563
  if (!response.ok) {
@@ -576,7 +578,7 @@ class Exchange {
576
578
  const args = [];
577
579
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchPositions`, {
578
580
  method: 'POST',
579
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
581
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
580
582
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
581
583
  });
582
584
  if (!response.ok) {
@@ -597,7 +599,7 @@ class Exchange {
597
599
  const args = [];
598
600
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchBalance`, {
599
601
  method: 'POST',
600
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
602
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
601
603
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
602
604
  });
603
605
  if (!response.ok) {
@@ -618,7 +620,7 @@ class Exchange {
618
620
  const args = [];
619
621
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/close`, {
620
622
  method: 'POST',
621
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
623
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
622
624
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
623
625
  });
624
626
  if (!response.ok) {
@@ -670,7 +672,7 @@ class Exchange {
670
672
  const response = await this.api.fetchOHLCV({
671
673
  exchange: this.exchangeName,
672
674
  fetchOHLCVRequest: requestBody,
673
- });
675
+ }, { headers: this.getAuthHeaders() });
674
676
  const data = this.handleResponse(response);
675
677
  return data.map(convertCandle);
676
678
  }
@@ -701,7 +703,7 @@ class Exchange {
701
703
  const response = await this.api.fetchTrades({
702
704
  exchange: this.exchangeName,
703
705
  fetchTradesRequest: requestBody,
704
- });
706
+ }, { headers: this.getAuthHeaders() });
705
707
  const data = this.handleResponse(response);
706
708
  return data.map(convertTrade);
707
709
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.19.3",
3
+ "version": "2.19.5",
4
4
  "description": "OpenAPI client for pmxtjs",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.19.3",
3
+ "version": "2.19.5",
4
4
  "description": "Unified prediction market data API - The ccxt for prediction markets",
5
5
  "author": "PMXT Contributors",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "unified"
44
44
  ],
45
45
  "dependencies": {
46
- "pmxt-core": "2.19.3"
46
+ "pmxt-core": "2.19.5"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/jest": "^30.0.0",
package/pmxt/client.ts CHANGED
@@ -261,16 +261,9 @@ export abstract class Exchange {
261
261
  const actualPort = this.serverManager.getRunningPort();
262
262
  const newBaseUrl = `http://localhost:${actualPort}`;
263
263
 
264
- const accessToken = this.serverManager.getAccessToken();
265
- const headers: any = {};
266
- if (accessToken) {
267
- headers['x-pmxt-access-token'] = accessToken;
268
- }
269
-
270
264
  // Update API client with actual base URL
271
265
  this.config = new Configuration({
272
266
  basePath: newBaseUrl,
273
- headers
274
267
  });
275
268
  this.api = new DefaultApi(this.config);
276
269
  } catch (error) {
@@ -303,6 +296,15 @@ export abstract class Exchange {
303
296
  };
304
297
  }
305
298
 
299
+ protected getAuthHeaders(): Record<string, string> {
300
+ const headers: Record<string, string> = { ...(this.config.headers as Record<string, string>) };
301
+ const accessToken = this.serverManager.getAccessToken();
302
+ if (accessToken) {
303
+ headers['x-pmxt-access-token'] = accessToken;
304
+ }
305
+ return headers;
306
+ }
307
+
306
308
  // Low-Level API Access
307
309
 
308
310
  /**
@@ -334,7 +336,7 @@ export abstract class Exchange {
334
336
  method: 'POST',
335
337
  headers: {
336
338
  'Content-Type': 'application/json',
337
- ...this.config.headers
339
+ ...this.getAuthHeaders()
338
340
  },
339
341
  body: JSON.stringify(requestBody)
340
342
  });
@@ -360,7 +362,7 @@ export abstract class Exchange {
360
362
  args.push(reload);
361
363
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/loadMarkets`, {
362
364
  method: 'POST',
363
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
365
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
364
366
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
365
367
  });
366
368
  if (!response.ok) {
@@ -386,7 +388,7 @@ export abstract class Exchange {
386
388
  if (params !== undefined) args.push(params);
387
389
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarkets`, {
388
390
  method: 'POST',
389
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
391
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
390
392
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
391
393
  });
392
394
  if (!response.ok) {
@@ -408,7 +410,7 @@ export abstract class Exchange {
408
410
  if (params !== undefined) args.push(params);
409
411
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarketsPaginated`, {
410
412
  method: 'POST',
411
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
413
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
412
414
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
413
415
  });
414
416
  if (!response.ok) {
@@ -434,7 +436,7 @@ export abstract class Exchange {
434
436
  if (params !== undefined) args.push(params);
435
437
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchEvents`, {
436
438
  method: 'POST',
437
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
439
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
438
440
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
439
441
  });
440
442
  if (!response.ok) {
@@ -456,7 +458,7 @@ export abstract class Exchange {
456
458
  if (params !== undefined) args.push(params);
457
459
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarket`, {
458
460
  method: 'POST',
459
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
461
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
460
462
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
461
463
  });
462
464
  if (!response.ok) {
@@ -478,7 +480,7 @@ export abstract class Exchange {
478
480
  if (params !== undefined) args.push(params);
479
481
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchEvent`, {
480
482
  method: 'POST',
481
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
483
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
482
484
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
483
485
  });
484
486
  if (!response.ok) {
@@ -500,7 +502,7 @@ export abstract class Exchange {
500
502
  args.push(id);
501
503
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOrderBook`, {
502
504
  method: 'POST',
503
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
505
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
504
506
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
505
507
  });
506
508
  if (!response.ok) {
@@ -522,7 +524,7 @@ export abstract class Exchange {
522
524
  args.push(orderId);
523
525
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/cancelOrder`, {
524
526
  method: 'POST',
525
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
527
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
526
528
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
527
529
  });
528
530
  if (!response.ok) {
@@ -544,7 +546,7 @@ export abstract class Exchange {
544
546
  args.push(orderId);
545
547
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOrder`, {
546
548
  method: 'POST',
547
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
549
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
548
550
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
549
551
  });
550
552
  if (!response.ok) {
@@ -566,7 +568,7 @@ export abstract class Exchange {
566
568
  if (marketId !== undefined) args.push(marketId);
567
569
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOpenOrders`, {
568
570
  method: 'POST',
569
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
571
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
570
572
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
571
573
  });
572
574
  if (!response.ok) {
@@ -588,7 +590,7 @@ export abstract class Exchange {
588
590
  if (params !== undefined) args.push(params);
589
591
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMyTrades`, {
590
592
  method: 'POST',
591
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
593
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
592
594
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
593
595
  });
594
596
  if (!response.ok) {
@@ -610,7 +612,7 @@ export abstract class Exchange {
610
612
  if (params !== undefined) args.push(params);
611
613
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchClosedOrders`, {
612
614
  method: 'POST',
613
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
615
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
614
616
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
615
617
  });
616
618
  if (!response.ok) {
@@ -632,7 +634,7 @@ export abstract class Exchange {
632
634
  if (params !== undefined) args.push(params);
633
635
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchAllOrders`, {
634
636
  method: 'POST',
635
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
637
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
636
638
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
637
639
  });
638
640
  if (!response.ok) {
@@ -653,7 +655,7 @@ export abstract class Exchange {
653
655
  const args: any[] = [];
654
656
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchPositions`, {
655
657
  method: 'POST',
656
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
658
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
657
659
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
658
660
  });
659
661
  if (!response.ok) {
@@ -674,7 +676,7 @@ export abstract class Exchange {
674
676
  const args: any[] = [];
675
677
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchBalance`, {
676
678
  method: 'POST',
677
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
679
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
678
680
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
679
681
  });
680
682
  if (!response.ok) {
@@ -695,7 +697,7 @@ export abstract class Exchange {
695
697
  const args: any[] = [];
696
698
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/close`, {
697
699
  method: 'POST',
698
- headers: { 'Content-Type': 'application/json', ...this.config.headers },
700
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
699
701
  body: JSON.stringify({ args, credentials: this.getCredentials() }),
700
702
  });
701
703
  if (!response.ok) {
@@ -753,7 +755,7 @@ export abstract class Exchange {
753
755
  const response = await this.api.fetchOHLCV({
754
756
  exchange: this.exchangeName as any,
755
757
  fetchOHLCVRequest: requestBody,
756
- });
758
+ }, { headers: this.getAuthHeaders() });
757
759
 
758
760
  const data = this.handleResponse(response);
759
761
  return data.map(convertCandle);
@@ -790,7 +792,7 @@ export abstract class Exchange {
790
792
  const response = await this.api.fetchTrades({
791
793
  exchange: this.exchangeName as any,
792
794
  fetchTradesRequest: requestBody,
793
- });
795
+ }, { headers: this.getAuthHeaders() });
794
796
 
795
797
  const data = this.handleResponse(response);
796
798
  return data.map(convertTrade);