@riocrypto/common-server 1.0.2157 → 1.0.2159

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.
@@ -1,4 +1,4 @@
1
- import { Quote, Fiat, Crypto, BitsoBankAccount, Side, Country, Order, CryptoAddress, BankAccount, ChainedQuote, AuthRole, Auth, ImportOrderData, TreasuryProvider, FXProvider, EmarketsFXTrade, ExternalTradingAlgorithm, ExternalTrade } from "@riocrypto/common";
1
+ import { Quote, Fiat, Crypto, BitsoBankAccount, Side, Country, Order, CryptoAddress, BankAccount, ChainedQuote, AuthRole, Auth, ImportOrderData, TreasuryProvider, FXProvider, EmarketsFXTrade, ExternalTradingAlgorithm, ExternalTrade, ExternalTradeType, ExternalTradingProvider, ExternalTradingAlgorithmType } from "@riocrypto/common";
2
2
  declare class ClusterClient {
3
3
  private baseUrl;
4
4
  private clusterApiKey;
@@ -69,10 +69,28 @@ declare class ClusterClient {
69
69
  }): Promise<EmarketsFXTrade>;
70
70
  getEmarketsTrade(id: string): Promise<EmarketsFXTrade>;
71
71
  updateExternalTradingAlgorithmLimitPrice(id: string, limitPrice: number): Promise<void>;
72
- startExternalTradingAlgorithm(id: string): Promise<ExternalTradingAlgorithm>;
72
+ startExternalTradingAlgorithm({ type, provider, originCurrency, destinationCurrency, maxOriginAmount, maxDestinationAmount, limitPrice, }: {
73
+ type: ExternalTradingAlgorithmType;
74
+ provider: ExternalTradingProvider;
75
+ originCurrency: Crypto | Fiat;
76
+ destinationCurrency: Crypto | Fiat;
77
+ maxOriginAmount?: number;
78
+ maxDestinationAmount?: number;
79
+ limitPrice?: number;
80
+ }): Promise<ExternalTradingAlgorithm>;
73
81
  stopExternalTradingAlgorithm(id: string): Promise<ExternalTradingAlgorithm>;
74
82
  getExternalTradingAlgorithm(id: string): Promise<ExternalTradingAlgorithm>;
75
83
  getExternalTrade(id: string): Promise<ExternalTrade>;
84
+ placeExternalTrade({ provider, type, originCurrency, destinationCurrency, originAmount, destinationAmount, limitPrice, emarketsOrderType, }: {
85
+ provider: ExternalTradingProvider;
86
+ type: ExternalTradeType;
87
+ originCurrency: Crypto | Fiat;
88
+ destinationCurrency: Crypto | Fiat;
89
+ originAmount: number;
90
+ destinationAmount: number;
91
+ limitPrice: number;
92
+ emarketsOrderType: "TOD" | "TOM" | "SPT";
93
+ }): Promise<ExternalTrade>;
76
94
  }
77
95
  export declare const buildClusterClient: () => Promise<ClusterClient>;
78
96
  export {};
@@ -430,9 +430,17 @@ class ClusterClient {
430
430
  });
431
431
  });
432
432
  }
433
- startExternalTradingAlgorithm(id) {
433
+ startExternalTradingAlgorithm({ type, provider, originCurrency, destinationCurrency, maxOriginAmount, maxDestinationAmount, limitPrice, }) {
434
434
  return __awaiter(this, void 0, void 0, function* () {
435
- const response = yield this.axios.post(`${this.baseUrl}/api/trading/external/algorithms/${id}/start`, {}, {
435
+ const response = yield this.axios.post(`${this.baseUrl}/api/trading/external/algorithms/start`, {
436
+ type,
437
+ provider,
438
+ originCurrency,
439
+ destinationCurrency,
440
+ maxOriginAmount,
441
+ maxDestinationAmount,
442
+ limitPrice,
443
+ }, {
436
444
  headers: {
437
445
  "x-cluster-api-key": this.clusterApiKey,
438
446
  },
@@ -470,6 +478,25 @@ class ClusterClient {
470
478
  return response.data;
471
479
  });
472
480
  }
481
+ placeExternalTrade({ provider, type, originCurrency, destinationCurrency, originAmount, destinationAmount, limitPrice, emarketsOrderType, }) {
482
+ return __awaiter(this, void 0, void 0, function* () {
483
+ const response = yield this.axios.post(`${this.baseUrl}/api/trading/external/trades`, {
484
+ provider,
485
+ type,
486
+ originCurrency,
487
+ destinationCurrency,
488
+ originAmount,
489
+ destinationAmount,
490
+ limitPrice,
491
+ emarketsOrderType,
492
+ }, {
493
+ headers: {
494
+ "x-cluster-api-key": this.clusterApiKey,
495
+ },
496
+ });
497
+ return response.data;
498
+ });
499
+ }
473
500
  }
474
501
  const buildClusterClient = () => __awaiter(void 0, void 0, void 0, function* () {
475
502
  // Retrieve secrets asynchronously
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2157",
3
+ "version": "1.0.2159",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",