@volare.finance/nestjs.plugins 1.1.3 → 1.1.6

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 (115) hide show
  1. package/README.md +68 -1
  2. package/dist/aws/aws.module.d.ts +1 -1
  3. package/dist/aws/aws.module.js +1 -2
  4. package/dist/aws/aws.module.js.map +1 -1
  5. package/dist/coingecko/coingecko.module.d.ts +1 -1
  6. package/dist/coingecko/coingecko.module.js +1 -2
  7. package/dist/coingecko/coingecko.module.js.map +1 -1
  8. package/dist/coingecko/coingecko.service.js +3 -3
  9. package/dist/coingecko/coingecko.service.js.map +1 -1
  10. package/dist/decorators/api.list.response.decorator.d.ts +6 -0
  11. package/dist/decorators/api.list.response.decorator.js +32 -0
  12. package/dist/decorators/api.list.response.decorator.js.map +1 -0
  13. package/dist/decorators/api.obj.response.decorator.d.ts +6 -0
  14. package/dist/decorators/api.obj.response.decorator.js +29 -0
  15. package/dist/decorators/api.obj.response.decorator.js.map +1 -0
  16. package/dist/decorators/index.d.ts +7 -0
  17. package/dist/decorators/index.js +11 -0
  18. package/dist/decorators/index.js.map +1 -0
  19. package/dist/decorators/response.dto.d.ts +15 -0
  20. package/dist/decorators/response.dto.js +34 -0
  21. package/dist/decorators/response.dto.js.map +1 -0
  22. package/dist/exchanges/binance/binance.config.d.ts +2 -2
  23. package/dist/exchanges/binance/binance.module.d.ts +1 -1
  24. package/dist/exchanges/binance/binance.module.js +1 -2
  25. package/dist/exchanges/binance/binance.module.js.map +1 -1
  26. package/dist/exchanges/binance/binance.service.d.ts +6 -3
  27. package/dist/exchanges/binance/binance.service.js +16 -16
  28. package/dist/exchanges/binance/binance.service.js.map +1 -1
  29. package/dist/exchanges/bingx/bingx.config.d.ts +10 -0
  30. package/dist/exchanges/bingx/bingx.config.js +7 -0
  31. package/dist/exchanges/bingx/bingx.config.js.map +1 -0
  32. package/dist/exchanges/bingx/bingx.module.d.ts +9 -0
  33. package/dist/exchanges/bingx/bingx.module.js +27 -0
  34. package/dist/exchanges/bingx/bingx.module.js.map +1 -0
  35. package/dist/exchanges/bingx/bingx.service.d.ts +73 -0
  36. package/dist/exchanges/bingx/bingx.service.js +68 -0
  37. package/dist/exchanges/bingx/bingx.service.js.map +1 -0
  38. package/dist/exchanges/bingx/index.d.ts +7 -0
  39. package/dist/exchanges/bingx/index.js +11 -0
  40. package/dist/exchanges/bingx/index.js.map +1 -0
  41. package/dist/exchanges/bybit/bybit.config.d.ts +10 -0
  42. package/dist/exchanges/bybit/bybit.config.js +7 -0
  43. package/dist/exchanges/bybit/bybit.config.js.map +1 -0
  44. package/dist/exchanges/bybit/bybit.module.d.ts +9 -0
  45. package/dist/exchanges/bybit/bybit.module.js +27 -0
  46. package/dist/exchanges/bybit/bybit.module.js.map +1 -0
  47. package/dist/exchanges/bybit/bybit.service.d.ts +103 -0
  48. package/dist/exchanges/bybit/bybit.service.js +67 -0
  49. package/dist/exchanges/bybit/bybit.service.js.map +1 -0
  50. package/dist/exchanges/bybit/index.d.ts +7 -0
  51. package/dist/exchanges/bybit/index.js +11 -0
  52. package/dist/exchanges/bybit/index.js.map +1 -0
  53. package/dist/exchanges/gate.io/gate.io.config.d.ts +10 -0
  54. package/dist/exchanges/gate.io/gate.io.config.js +7 -0
  55. package/dist/exchanges/gate.io/gate.io.config.js.map +1 -0
  56. package/dist/exchanges/gate.io/gate.io.module.d.ts +9 -0
  57. package/dist/exchanges/gate.io/gate.io.module.js +27 -0
  58. package/dist/exchanges/gate.io/gate.io.module.js.map +1 -0
  59. package/dist/exchanges/gate.io/gate.io.service.d.ts +57 -0
  60. package/dist/exchanges/gate.io/gate.io.service.js +65 -0
  61. package/dist/exchanges/gate.io/gate.io.service.js.map +1 -0
  62. package/dist/exchanges/gate.io/index.d.ts +7 -0
  63. package/dist/exchanges/gate.io/index.js +11 -0
  64. package/dist/exchanges/gate.io/index.js.map +1 -0
  65. package/dist/exchanges/index.d.ts +5 -0
  66. package/dist/exchanges/index.js +5 -0
  67. package/dist/exchanges/index.js.map +1 -1
  68. package/dist/exchanges/lbank/lbank.config.d.ts +2 -2
  69. package/dist/exchanges/lbank/lbank.module.d.ts +1 -1
  70. package/dist/exchanges/lbank/lbank.module.js +1 -2
  71. package/dist/exchanges/lbank/lbank.module.js.map +1 -1
  72. package/dist/exchanges/lbank/lbank.service.d.ts +44 -26
  73. package/dist/exchanges/lbank/lbank.service.js +25 -45
  74. package/dist/exchanges/lbank/lbank.service.js.map +1 -1
  75. package/dist/exchanges/mexc/mexc.config.d.ts +2 -2
  76. package/dist/exchanges/mexc/mexc.module.d.ts +1 -1
  77. package/dist/exchanges/mexc/mexc.module.js +1 -2
  78. package/dist/exchanges/mexc/mexc.module.js.map +1 -1
  79. package/dist/exchanges/mexc/mexc.service.d.ts +3 -2
  80. package/dist/exchanges/mexc/mexc.service.js +12 -13
  81. package/dist/exchanges/mexc/mexc.service.js.map +1 -1
  82. package/dist/exchanges/okx/index.d.ts +7 -0
  83. package/dist/exchanges/okx/index.js +11 -0
  84. package/dist/exchanges/okx/index.js.map +1 -0
  85. package/dist/exchanges/okx/okx.config.d.ts +10 -0
  86. package/dist/exchanges/okx/okx.config.js +7 -0
  87. package/dist/exchanges/okx/okx.config.js.map +1 -0
  88. package/dist/exchanges/okx/okx.module.d.ts +9 -0
  89. package/dist/exchanges/okx/okx.module.js +27 -0
  90. package/dist/exchanges/okx/okx.module.js.map +1 -0
  91. package/dist/exchanges/okx/okx.service.d.ts +72 -0
  92. package/dist/exchanges/okx/okx.service.js +64 -0
  93. package/dist/exchanges/okx/okx.service.js.map +1 -0
  94. package/dist/exchanges/venkate/index.d.ts +7 -0
  95. package/dist/exchanges/venkate/index.js +11 -0
  96. package/dist/exchanges/venkate/index.js.map +1 -0
  97. package/dist/exchanges/venkate/venkate.config.d.ts +10 -0
  98. package/dist/exchanges/venkate/venkate.config.js +7 -0
  99. package/dist/exchanges/venkate/venkate.config.js.map +1 -0
  100. package/dist/exchanges/venkate/venkate.module.d.ts +9 -0
  101. package/dist/exchanges/venkate/venkate.module.js +27 -0
  102. package/dist/exchanges/venkate/venkate.module.js.map +1 -0
  103. package/dist/exchanges/venkate/venkate.service.d.ts +56 -0
  104. package/dist/exchanges/venkate/venkate.service.js +62 -0
  105. package/dist/exchanges/venkate/venkate.service.js.map +1 -0
  106. package/dist/index.d.ts +1 -0
  107. package/dist/index.js +1 -0
  108. package/dist/index.js.map +1 -1
  109. package/dist/logger/logger.module.d.ts +1 -1
  110. package/dist/logger/logger.module.js +1 -2
  111. package/dist/logger/logger.module.js.map +1 -1
  112. package/dist/viabtc/viabtc.module.d.ts +1 -1
  113. package/dist/viabtc/viabtc.module.js +1 -2
  114. package/dist/viabtc/viabtc.module.js.map +1 -1
  115. package/package.json +3 -3
@@ -8,10 +8,9 @@ exports.LBankModule = void 0;
8
8
  const config_1 = require("../../config");
9
9
  const lbank_service_1 = require("./lbank.service");
10
10
  class LBankModule {
11
- static forRoot(options) {
11
+ static forRoot(_options) {
12
12
  return {
13
13
  module: LBankModule,
14
- imports: [config_1.ConfigModule.forRoot(options)],
15
14
  exports: [lbank_service_1.LBankService],
16
15
  providers: [
17
16
  {
@@ -1 +1 @@
1
- {"version":3,"file":"lbank.module.js","sourceRoot":"","sources":["../../../src/exchanges/lbank/lbank.module.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAA0E;AAE1E,mDAA+C;AAE/C,MAAa,WAAW;IACtB,MAAM,CAAC,OAAO,CAAC,OAAuB;QACpC,OAAO;YACL,MAAM,EAAE,WAAW;YACnB,OAAO,EAAE,CAAC,qBAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACxC,OAAO,EAAE,CAAC,4BAAY,CAAC;YACvB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,eAAe;oBACxB,UAAU,EAAE,CAAC,QAAoC,EAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE;oBAC5E,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,4BAAY;aACb;SACF,CAAC;IACJ,CAAC;CACF;AAhBD,kCAgBC"}
1
+ {"version":3,"file":"lbank.module.js","sourceRoot":"","sources":["../../../src/exchanges/lbank/lbank.module.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAA4D;AAE5D,mDAA+C;AAE/C,MAAa,WAAW;IACtB,MAAM,CAAC,OAAO,CAAC,QAAwB;QACrC,OAAO;YACL,MAAM,EAAE,WAAW;YACnB,OAAO,EAAE,CAAC,4BAAY,CAAC;YACvB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,eAAe;oBACxB,UAAU,EAAE,CAAC,QAAoC,EAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE;oBAC5E,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,4BAAY;aACb;SACF,CAAC;IACJ,CAAC;CACF;AAfD,kCAeC"}
@@ -8,41 +8,59 @@ export declare class LBankService {
8
8
  private readonly constant;
9
9
  private readonly instance;
10
10
  constructor(constant: LBankConfig);
11
+ checkConstant(): void;
11
12
  /**
12
- * Common - Query current Market Data (new)
13
- * @param symbol e.g. btc_usdt
14
- * @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
13
+ * 24hr Ticker
14
+ * @param symbol Pair. e.g. btc_usdt
15
+ * @see https://www.lbank.com/en-US/docs/index.html#24hr-ticker
15
16
  */
16
17
  ticker(symbol: string): Promise<{
17
- symbol: string;
18
- ticker: {
19
- high: string;
20
- vol: string;
21
- low: string;
22
- change: string;
23
- turnover: string;
24
- latest: string;
25
- };
26
- timestamp: number;
18
+ msg: string;
19
+ result: string;
20
+ data: {
21
+ symbol: string;
22
+ ticker: {
23
+ high: string;
24
+ vol: string;
25
+ low: string;
26
+ change: string;
27
+ turnover: string;
28
+ latest: string;
29
+ };
30
+ timestamp: number;
31
+ }[];
32
+ error_code: number;
33
+ ts: number;
27
34
  }>;
28
35
  /**
29
- * Common - Query K Bar Data
30
- * @param symbol e.g. btc_usdt
36
+ * Query K Bar Data
37
+ * @param symbol Trading Pair. e.g. btc_usdt
31
38
  * @param type e.g. hour1
32
- * @param time e.g. 1696089600
33
- * @param size e.g. 500
39
+ * @param time Timestamp (of Seconds). e.g. 1696089600
40
+ * @param size Count of the bars. e.g. 500
34
41
  * @see https://www.lbank.com/en-US/docs/index.html#query-k-bar-data
35
42
  */
36
- klines(symbol: string, type: 'minute1' | 'minute5' | 'minut15' | 'minute30' | 'hour1' | 'hour4' | 'hour8' | 'hour12' | 'day1' | 'week1', time: string | number, size: number): Promise<[number, number, number, number, number, number][]>;
43
+ klines(symbol: string, type: 'minute1' | 'minute5' | 'minute15' | 'minute30' | 'hour1' | 'hour4' | 'hour8' | 'hour12' | 'day1' | 'week1' | 'month1', time: string | number, size: string | number): Promise<{
44
+ msg: string;
45
+ result: string;
46
+ data: [number, number, number, number, number, number][];
47
+ error_code: number;
48
+ ts: number;
49
+ }>;
37
50
  /**
38
- * Common - Query Market Depth
39
- * @param symbol e.g. btc_usdt
40
- * @param size e.g. 500
41
- * @see https://www.lbank.com/en-US/docs/index.html#query-market-depth
51
+ * Depth information
52
+ * @param symbol Trading Pair. e.g. btc_usdt
53
+ * @param size The count of returned items. e.g. 200
54
+ * @see https://www.lbank.com/en-US/docs/index.html#depth-information
42
55
  */
43
- depth(symbol: string, size: number): Promise<{
44
- asks: [string, string][];
45
- bids: [string, string][];
46
- timestamp: number;
56
+ depth(symbol: string, size: string | number): Promise<{
57
+ result: string;
58
+ data: {
59
+ asks: [string, string][];
60
+ bids: [string, string][];
61
+ timestamp: number;
62
+ };
63
+ error_code: number;
64
+ ts: number;
47
65
  }>;
48
66
  }
@@ -12,65 +12,45 @@ const axios_1 = tslib_1.__importDefault(require("axios"));
12
12
  let LBankService = class LBankService {
13
13
  constructor(constant) {
14
14
  this.constant = constant;
15
- this.instance = axios_1.default.create({ baseURL: this.constant.lbank.url });
15
+ if (constant.lbank?.enabled) {
16
+ this.instance = axios_1.default.create({ baseURL: constant.lbank.url });
17
+ }
16
18
  }
17
- /**
18
- * Common - Query current Market Data (new)
19
- * @param symbol e.g. btc_usdt
20
- * @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
21
- */
22
- async ticker(symbol) {
19
+ checkConstant() {
23
20
  if (!this.constant.lbank?.enabled) {
24
21
  throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
25
22
  }
26
- const response = await this.instance.get('/v2/ticker/24hr.do', { params: { symbol } });
27
- if (response.status === common_1.HttpStatus.OK) {
28
- if (response.data?.result === 'true' && response.data?.data?.length > 0) {
29
- return response.data.data[0];
30
- }
31
- throw new common_1.HttpException(response.data.result, common_1.HttpStatus.BAD_REQUEST);
32
- }
33
- throw new common_1.HttpException(response.statusText, response.status);
34
23
  }
35
24
  /**
36
- * Common - Query K Bar Data
37
- * @param symbol e.g. btc_usdt
25
+ * 24hr Ticker
26
+ * @param symbol Pair. e.g. btc_usdt
27
+ * @see https://www.lbank.com/en-US/docs/index.html#24hr-ticker
28
+ */
29
+ async ticker(symbol) {
30
+ this.checkConstant();
31
+ return (await this.instance.get('/v2/ticker/24hr.do', { params: { symbol } })).data;
32
+ }
33
+ /**
34
+ * Query K Bar Data
35
+ * @param symbol Trading Pair. e.g. btc_usdt
38
36
  * @param type e.g. hour1
39
- * @param time e.g. 1696089600
40
- * @param size e.g. 500
37
+ * @param time Timestamp (of Seconds). e.g. 1696089600
38
+ * @param size Count of the bars. e.g. 500
41
39
  * @see https://www.lbank.com/en-US/docs/index.html#query-k-bar-data
42
40
  */
43
41
  async klines(symbol, type, time, size) {
44
- if (!this.constant.lbank?.enabled) {
45
- throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
46
- }
47
- const response = await this.instance.get('/v2/kline.do', { params: { symbol, type, time, size } });
48
- if (response.status === common_1.HttpStatus.OK) {
49
- if (response.data?.result === 'true') {
50
- return response.data.data;
51
- }
52
- throw new common_1.HttpException(response.data.result, common_1.HttpStatus.BAD_REQUEST);
53
- }
54
- throw new common_1.HttpException(response.statusText, response.status);
42
+ this.checkConstant();
43
+ return (await this.instance.get('/v2/kline.do', { params: { symbol, type, time, size } })).data;
55
44
  }
56
45
  /**
57
- * Common - Query Market Depth
58
- * @param symbol e.g. btc_usdt
59
- * @param size e.g. 500
60
- * @see https://www.lbank.com/en-US/docs/index.html#query-market-depth
46
+ * Depth information
47
+ * @param symbol Trading Pair. e.g. btc_usdt
48
+ * @param size The count of returned items. e.g. 200
49
+ * @see https://www.lbank.com/en-US/docs/index.html#depth-information
61
50
  */
62
51
  async depth(symbol, size) {
63
- if (!this.constant.lbank?.enabled) {
64
- throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
65
- }
66
- const response = await this.instance.get('/v2/depth.do', { params: { symbol, size } });
67
- if (response.status === common_1.HttpStatus.OK) {
68
- if (response.data?.result === 'true') {
69
- return response.data.data;
70
- }
71
- throw new common_1.HttpException(response.data.result, common_1.HttpStatus.BAD_REQUEST);
72
- }
73
- throw new common_1.HttpException(response.statusText, response.status);
52
+ this.checkConstant();
53
+ return (await this.instance.get('/v2/depth.do', { params: { symbol, size } })).data;
74
54
  }
75
55
  };
76
56
  exports.LBankService = LBankService;
@@ -1 +1 @@
1
- {"version":3,"file":"lbank.service.js","sourceRoot":"","sources":["../../../src/exchanges/lbank/lbank.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,2CAA+E;AAC/E,0DAA6C;AAItC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEvB,YAAsD,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;QACzE,IAAI,CAAC,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,MAAc;QAKzB,IAAI,CAAC,IAAI,CAAC,QAAQ,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H,KAAK,CAAC,KAAK,CACT,MAAc,EACd,IAAqB;QAOrB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACtF,CAAC;CACF,CAAA;AA7EY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAIE,mBAAA,IAAA,eAAM,EAAC,eAAe,CAAC,CAAA;GAHzB,YAAY,CA6ExB"}
@@ -3,8 +3,8 @@
3
3
  * @date 2023
4
4
  */
5
5
  export interface MexcConfig {
6
- mexc: {
6
+ mexc?: {
7
7
  enabled: boolean;
8
- url?: string;
8
+ url: string;
9
9
  };
10
10
  }
@@ -5,5 +5,5 @@
5
5
  import { DynamicModule } from '@nestjs/common';
6
6
  import { ConfigOptions } from '../../config';
7
7
  export declare class MexcModule {
8
- static forRoot(options?: ConfigOptions): DynamicModule;
8
+ static forRoot(_options?: ConfigOptions): DynamicModule;
9
9
  }
@@ -8,10 +8,9 @@ exports.MexcModule = void 0;
8
8
  const config_1 = require("../../config");
9
9
  const mexc_service_1 = require("./mexc.service");
10
10
  class MexcModule {
11
- static forRoot(options) {
11
+ static forRoot(_options) {
12
12
  return {
13
13
  module: MexcModule,
14
- imports: [config_1.ConfigModule.forRoot(options)],
15
14
  exports: [mexc_service_1.MexcService],
16
15
  providers: [
17
16
  {
@@ -1 +1 @@
1
- {"version":3,"file":"mexc.module.js","sourceRoot":"","sources":["../../../src/exchanges/mexc/mexc.module.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAA0E;AAE1E,iDAA6C;AAE7C,MAAa,UAAU;IACrB,MAAM,CAAC,OAAO,CAAC,OAAuB;QACpC,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,OAAO,EAAE,CAAC,qBAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACxC,OAAO,EAAE,CAAC,0BAAW,CAAC;YACtB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,cAAc;oBACvB,UAAU,EAAE,CAAC,QAAmC,EAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE;oBAC3E,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,0BAAW;aACZ;SACF,CAAC;IACJ,CAAC;CACF;AAhBD,gCAgBC"}
1
+ {"version":3,"file":"mexc.module.js","sourceRoot":"","sources":["../../../src/exchanges/mexc/mexc.module.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAA4D;AAE5D,iDAA6C;AAE7C,MAAa,UAAU;IACrB,MAAM,CAAC,OAAO,CAAC,QAAwB;QACrC,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,OAAO,EAAE,CAAC,0BAAW,CAAC;YACtB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,cAAc;oBACvB,UAAU,EAAE,CAAC,QAAmC,EAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE;oBAC3E,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,0BAAW;aACZ;SACF,CAAC;IACJ,CAAC;CACF;AAfD,gCAeC"}
@@ -8,6 +8,7 @@ export declare class MexcService {
8
8
  private readonly constant;
9
9
  private readonly instance;
10
10
  constructor(constant: MexcConfig);
11
+ checkConstant(): void;
11
12
  /**
12
13
  * Market Data - Current Average Price
13
14
  * @param symbol e.g. BTCUSDT
@@ -50,14 +51,14 @@ export declare class MexcService {
50
51
  * @param limit e.g. 500
51
52
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#kline-candlestick-data
52
53
  */
53
- klines(symbol: string, interval: '1m' | '5m' | '15m' | '30m' | '60m' | '4h' | '1d' | '1M', startTime?: string | number, endTime?: string | number, limit?: number): Promise<[number, string, string, string, string, string, number, string][]>;
54
+ klines(symbol: string, interval: '1m' | '5m' | '15m' | '30m' | '60m' | '4h' | '1d' | '1w' | '1M', startTime?: string | number, endTime?: string | number, limit?: string | number): Promise<[number, string, string, string, string, string, number, string][]>;
54
55
  /**
55
56
  * Market Data - Order Book
56
57
  * @param symbol e.g. BTCUSDT
57
58
  * @param limit e.g. 500
58
59
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#order-book
59
60
  */
60
- depth(symbol: string, limit?: number): Promise<{
61
+ depth(symbol: string, limit?: string | number): Promise<{
61
62
  lastUpdateId: number;
62
63
  bids: [string, string][];
63
64
  asks: [string, string][];
@@ -12,7 +12,14 @@ const axios_1 = tslib_1.__importDefault(require("axios"));
12
12
  let MexcService = class MexcService {
13
13
  constructor(constant) {
14
14
  this.constant = constant;
15
- this.instance = axios_1.default.create({ baseURL: this.constant.mexc.url });
15
+ if (constant.mexc?.enabled) {
16
+ this.instance = axios_1.default.create({ baseURL: constant.mexc.url });
17
+ }
18
+ }
19
+ checkConstant() {
20
+ if (!this.constant.mexc?.enabled) {
21
+ throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
22
+ }
16
23
  }
17
24
  /**
18
25
  * Market Data - Current Average Price
@@ -20,9 +27,7 @@ let MexcService = class MexcService {
20
27
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#current-average-price
21
28
  */
22
29
  async avgPrice(symbol) {
23
- if (!this.constant.mexc?.enabled) {
24
- throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
25
- }
30
+ this.checkConstant();
26
31
  return (await this.instance.get('/api/v3/avgPrice', { params: { symbol } })).data;
27
32
  }
28
33
  /**
@@ -31,9 +36,7 @@ let MexcService = class MexcService {
31
36
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#24hr-ticker-price-change-statistics
32
37
  */
33
38
  async ticker(symbol) {
34
- if (!this.constant.mexc?.enabled) {
35
- throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
36
- }
39
+ this.checkConstant();
37
40
  return (await this.instance.get('/api/v3/ticker/24hr', { params: { symbol } })).data;
38
41
  }
39
42
  /**
@@ -46,9 +49,7 @@ let MexcService = class MexcService {
46
49
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#kline-candlestick-data
47
50
  */
48
51
  async klines(symbol, interval, startTime, endTime, limit) {
49
- if (!this.constant.mexc?.enabled) {
50
- throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
51
- }
52
+ this.checkConstant();
52
53
  return (await this.instance.get('/api/v3/klines', { params: { symbol, interval, startTime, endTime, limit } })).data;
53
54
  }
54
55
  /**
@@ -58,9 +59,7 @@ let MexcService = class MexcService {
58
59
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#order-book
59
60
  */
60
61
  async depth(symbol, limit) {
61
- if (!this.constant.mexc?.enabled) {
62
- throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
63
- }
62
+ this.checkConstant();
64
63
  return (await this.instance.get('/api/v3/depth', { params: { symbol, limit } })).data;
65
64
  }
66
65
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mexc.service.js","sourceRoot":"","sources":["../../../src/exchanges/mexc/mexc.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,2CAA+E;AAC/E,0DAA6C;AAItC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAEtB,YAAqD,QAAoB;QAApB,aAAQ,GAAR,QAAQ,CAAY;QACvE,IAAI,CAAC,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;YACjC,MAAM,IAAI,sBAAa,CAAC,+BAA+B,EAAE,mBAAU,CAAC,WAAW,CAA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AmBzB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,qBAAqB,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACvF,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,MAAM,CACV,MAAc,EACd,QAAyE,EACzE,SAA2B,EAC3B,OAAyB,EACzB,KAAuB;QAEvB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACvH,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CACT,MAAc,EACd,KAAuB;QAEvB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACxF,CAAC;CACF,CAAA;AAtFY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAIE,mBAAA,IAAA,eAAM,EAAC,cAAc,CAAC,CAAA;GAHxB,WAAW,CAsFvB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @file index.ts
3
+ * @date 2024
4
+ */
5
+ export * from './okx.config';
6
+ export * from './okx.module';
7
+ export * from './okx.service';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * @file index.ts
4
+ * @date 2024
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const tslib_1 = require("tslib");
8
+ tslib_1.__exportStar(require("./okx.config"), exports);
9
+ tslib_1.__exportStar(require("./okx.module"), exports);
10
+ tslib_1.__exportStar(require("./okx.service"), exports);
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exchanges/okx/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAA6B;AAC7B,uDAA6B;AAC7B,wDAA8B"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @file okx.config.ts
3
+ * @date 2024
4
+ */
5
+ export interface OkxConfig {
6
+ okx?: {
7
+ enabled: boolean;
8
+ url: string;
9
+ };
10
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @file okx.config.ts
4
+ * @date 2024
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=okx.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"okx.config.js","sourceRoot":"","sources":["../../../src/exchanges/okx/okx.config.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file okx.module.ts
3
+ * @date 2024
4
+ */
5
+ import { DynamicModule } from '@nestjs/common';
6
+ import { ConfigOptions } from '../../config';
7
+ export declare class OkxModule {
8
+ static forRoot(_options?: ConfigOptions): DynamicModule;
9
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * @file okx.module.ts
4
+ * @date 2024
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.OkxModule = void 0;
8
+ const config_1 = require("../../config");
9
+ const okx_service_1 = require("./okx.service");
10
+ class OkxModule {
11
+ static forRoot(_options) {
12
+ return {
13
+ module: OkxModule,
14
+ exports: [okx_service_1.OkxService],
15
+ providers: [
16
+ {
17
+ provide: 'OkxConstant',
18
+ useFactory: (constant) => constant.config(),
19
+ inject: [config_1.ConfigService],
20
+ },
21
+ okx_service_1.OkxService,
22
+ ],
23
+ };
24
+ }
25
+ }
26
+ exports.OkxModule = OkxModule;
27
+ //# sourceMappingURL=okx.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"okx.module.js","sourceRoot":"","sources":["../../../src/exchanges/okx/okx.module.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAA4D;AAE5D,+CAA2C;AAE3C,MAAa,SAAS;IACpB,MAAM,CAAC,OAAO,CAAC,QAAwB;QACrC,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,CAAC,wBAAU,CAAC;YACrB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,aAAa;oBACtB,UAAU,EAAE,CAAC,QAAkC,EAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE;oBAC1E,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,wBAAU;aACX;SACF,CAAC;IACJ,CAAC;CACF;AAfD,8BAeC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @file okx.service.ts
3
+ * @date 2024
4
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data
5
+ */
6
+ import { OkxConfig } from './okx.config';
7
+ export declare class OkxService {
8
+ private readonly constant;
9
+ private readonly instance;
10
+ constructor(constant: OkxConfig);
11
+ checkConstant(): void;
12
+ /**
13
+ * GET Tickers
14
+ * @param instType Instrument type. e.g. SWAP
15
+ * @param uly Underlying e.g. BTC-USDT
16
+ * @param instFamily Instrument family.
17
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
18
+ */
19
+ ticker(instType: 'SPOT' | 'SWAP' | 'FUTURES' | 'OPTION', uly: string, instFamily?: string): Promise<{
20
+ code: string;
21
+ msg: string;
22
+ data: {
23
+ instType: string;
24
+ instId: string;
25
+ last: string;
26
+ lastSz: string;
27
+ askPx: string;
28
+ askSz: string;
29
+ bidPx: string;
30
+ bidSz: string;
31
+ open24h: string;
32
+ high24h: string;
33
+ low24h: string;
34
+ volCcy24h: string;
35
+ vol24h: string;
36
+ ts: string;
37
+ sodUtc0: string;
38
+ sodUtc8: string;
39
+ }[];
40
+ }>;
41
+ /**
42
+ * GET Candlesticks
43
+ * @param instId Instrument ID. e.g. BTC-USDT
44
+ * @param bar Bar size. e.g. 1m
45
+ * @param after Pagination of data to return records earlier than the requested ts. e.g. 1622548800000
46
+ * @param before Pagination of data to return records newer than the requested ts. e.g. 1622548800000
47
+ * @param limit Number of results per request. The maximum is 300. e.g. 100
48
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-candlesticks
49
+ */
50
+ klines(instId: string, bar?: '1m' | '3m' | '5m' | '15m' | '30m' | '1H' | '2H' | '4H' | '6H' | '12H' | '1D' | '2D' | '3D' | '1W' | '1M' | '3M', after?: string | number, before?: string | number, limit?: string | number): Promise<{
51
+ code: string;
52
+ msg: string;
53
+ data: [string, string, string, string, string, string, string, string, string][];
54
+ }>;
55
+ /**
56
+ * GET Order book
57
+ * @param instId Instrument ID. e.g. BTC-USDT
58
+ * @param sz Order book depth per side. Maximum 400. e.g. 1
59
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-order-book
60
+ */
61
+ depth(instId: string, sz?: string | number): Promise<{
62
+ code: string;
63
+ msg: string;
64
+ data: [
65
+ {
66
+ asks: [string, string, string, string][];
67
+ bids: [string, string, string, string][];
68
+ ts: string;
69
+ }
70
+ ];
71
+ }>;
72
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /**
3
+ * @file okx.service.ts
4
+ * @date 2024
5
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.OkxService = void 0;
9
+ const tslib_1 = require("tslib");
10
+ const common_1 = require("@nestjs/common");
11
+ const axios_1 = tslib_1.__importDefault(require("axios"));
12
+ let OkxService = class OkxService {
13
+ constructor(constant) {
14
+ this.constant = constant;
15
+ if (constant.okx?.enabled) {
16
+ this.instance = axios_1.default.create({ baseURL: constant.okx.url });
17
+ }
18
+ }
19
+ checkConstant() {
20
+ if (!this.constant.okx?.enabled) {
21
+ throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
22
+ }
23
+ }
24
+ /**
25
+ * GET Tickers
26
+ * @param instType Instrument type. e.g. SWAP
27
+ * @param uly Underlying e.g. BTC-USDT
28
+ * @param instFamily Instrument family.
29
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
30
+ */
31
+ async ticker(instType, uly, instFamily) {
32
+ this.checkConstant();
33
+ return (await this.instance.get('/api/v5/market/tickers', { params: { instType, uly, instFamily } })).data;
34
+ }
35
+ /**
36
+ * GET Candlesticks
37
+ * @param instId Instrument ID. e.g. BTC-USDT
38
+ * @param bar Bar size. e.g. 1m
39
+ * @param after Pagination of data to return records earlier than the requested ts. e.g. 1622548800000
40
+ * @param before Pagination of data to return records newer than the requested ts. e.g. 1622548800000
41
+ * @param limit Number of results per request. The maximum is 300. e.g. 100
42
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-candlesticks
43
+ */
44
+ async klines(instId, bar, after, before, limit) {
45
+ this.checkConstant();
46
+ return (await this.instance.get('/api/v5/market/candles', { params: { instId, bar, after, before, limit } })).data;
47
+ }
48
+ /**
49
+ * GET Order book
50
+ * @param instId Instrument ID. e.g. BTC-USDT
51
+ * @param sz Order book depth per side. Maximum 400. e.g. 1
52
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-order-book
53
+ */
54
+ async depth(instId, sz) {
55
+ this.checkConstant();
56
+ return (await this.instance.get('/api/v5/market/books', { params: { instId, sz } })).data;
57
+ }
58
+ };
59
+ exports.OkxService = OkxService;
60
+ exports.OkxService = OkxService = tslib_1.__decorate([
61
+ (0, common_1.Injectable)(),
62
+ tslib_1.__param(0, (0, common_1.Inject)('OkxConstant'))
63
+ ], OkxService);
64
+ //# sourceMappingURL=okx.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"okx.service.js","sourceRoot":"","s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OAKG;IACH,KAAK,CAAC,KAAK,CACT,MAAc,EACd,EAAoB;QAYpB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5F,CAAC;CACF,CAAA;AAnGY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;IAIE,mBAAA,IAAA,eAAM,EAAC,aAAa,CAAC,CAAA;GAHvB,UAAU,CAmGtB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @file index.ts
3
+ * @date 2024
4
+ */
5
+ export * from './venkate.config';
6
+ export * from './venkate.module';
7
+ export * from './venkate.service';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * @file index.ts
4
+ * @date 2024
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const tslib_1 = require("tslib");
8
+ tslib_1.__exportStar(require("./venkate.config"), exports);
9
+ tslib_1.__exportStar(require("./venkate.module"), exports);
10
+ tslib_1.__exportStar(require("./venkate.service"), exports);
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exchanges/venkate/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAiC;AACjC,2DAAiC;AACjC,4DAAkC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @file venkate.config.ts
3
+ * @date 2024
4
+ */
5
+ export interface VenkateConfig {
6
+ venkate?: {
7
+ enabled: boolean;
8
+ url: string;
9
+ };
10
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @file venkate.config.ts
4
+ * @date 2024
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=venkate.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"venkate.config.js","sourceRoot":"","sources":["../../../src/exchanges/venkate/venkate.config.ts"],"names":[],"mappings":";AAAA;;;GAGG"}