@3rd-eye-labs/openmm 0.0.1

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 (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +70 -0
  3. package/dist/cli/cli.d.ts +3 -0
  4. package/dist/cli/cli.d.ts.map +1 -0
  5. package/dist/cli/cli.js +43 -0
  6. package/dist/cli/cli.js.map +1 -0
  7. package/dist/cli/commands/balance.d.ts +3 -0
  8. package/dist/cli/commands/balance.d.ts.map +1 -0
  9. package/dist/cli/commands/balance.js +51 -0
  10. package/dist/cli/commands/balance.js.map +1 -0
  11. package/dist/cli/commands/orderbook.d.ts +3 -0
  12. package/dist/cli/commands/orderbook.d.ts.map +1 -0
  13. package/dist/cli/commands/orderbook.js +83 -0
  14. package/dist/cli/commands/orderbook.js.map +1 -0
  15. package/dist/cli/commands/orders.d.ts +3 -0
  16. package/dist/cli/commands/orders.d.ts.map +1 -0
  17. package/dist/cli/commands/orders.js +196 -0
  18. package/dist/cli/commands/orders.js.map +1 -0
  19. package/dist/cli/commands/pool-discovery.d.ts +3 -0
  20. package/dist/cli/commands/pool-discovery.d.ts.map +1 -0
  21. package/dist/cli/commands/pool-discovery.js +60 -0
  22. package/dist/cli/commands/pool-discovery.js.map +1 -0
  23. package/dist/cli/commands/ticker.d.ts +3 -0
  24. package/dist/cli/commands/ticker.d.ts.map +1 -0
  25. package/dist/cli/commands/ticker.js +51 -0
  26. package/dist/cli/commands/ticker.js.map +1 -0
  27. package/dist/cli/commands/trade.d.ts +3 -0
  28. package/dist/cli/commands/trade.d.ts.map +1 -0
  29. package/dist/cli/commands/trade.js +110 -0
  30. package/dist/cli/commands/trade.js.map +1 -0
  31. package/dist/cli/commands/trades.d.ts +3 -0
  32. package/dist/cli/commands/trades.d.ts.map +1 -0
  33. package/dist/cli/commands/trades.js +73 -0
  34. package/dist/cli/commands/trades.js.map +1 -0
  35. package/dist/cli/exchange-factory.d.ts +40 -0
  36. package/dist/cli/exchange-factory.d.ts.map +1 -0
  37. package/dist/cli/exchange-factory.js +77 -0
  38. package/dist/cli/exchange-factory.js.map +1 -0
  39. package/dist/cli/pool-discovery-core.d.ts +54 -0
  40. package/dist/cli/pool-discovery-core.d.ts.map +1 -0
  41. package/dist/cli/pool-discovery-core.js +193 -0
  42. package/dist/cli/pool-discovery-core.js.map +1 -0
  43. package/dist/cli/utils/error-handler.d.ts +40 -0
  44. package/dist/cli/utils/error-handler.d.ts.map +1 -0
  45. package/dist/cli/utils/error-handler.js +117 -0
  46. package/dist/cli/utils/error-handler.js.map +1 -0
  47. package/dist/cli/utils/validation.d.ts +45 -0
  48. package/dist/cli/utils/validation.d.ts.map +1 -0
  49. package/dist/cli/utils/validation.js +118 -0
  50. package/dist/cli/utils/validation.js.map +1 -0
  51. package/dist/config/environment.d.ts +25 -0
  52. package/dist/config/environment.d.ts.map +1 -0
  53. package/dist/config/environment.js +72 -0
  54. package/dist/config/environment.js.map +1 -0
  55. package/dist/config/index.d.ts +3 -0
  56. package/dist/config/index.d.ts.map +1 -0
  57. package/dist/config/index.js +21 -0
  58. package/dist/config/index.js.map +1 -0
  59. package/dist/config/launcher-config.d.ts +17 -0
  60. package/dist/config/launcher-config.d.ts.map +1 -0
  61. package/dist/config/launcher-config.js +14 -0
  62. package/dist/config/launcher-config.js.map +1 -0
  63. package/dist/config/price-aggregation.d.ts +49 -0
  64. package/dist/config/price-aggregation.d.ts.map +1 -0
  65. package/dist/config/price-aggregation.js +89 -0
  66. package/dist/config/price-aggregation.js.map +1 -0
  67. package/dist/core/exchange/base-exchange-connector.d.ts +45 -0
  68. package/dist/core/exchange/base-exchange-connector.d.ts.map +1 -0
  69. package/dist/core/exchange/base-exchange-connector.js +43 -0
  70. package/dist/core/exchange/base-exchange-connector.js.map +1 -0
  71. package/dist/core/exchange/base-exchange-data-mapper.d.ts +58 -0
  72. package/dist/core/exchange/base-exchange-data-mapper.d.ts.map +1 -0
  73. package/dist/core/exchange/base-exchange-data-mapper.js +60 -0
  74. package/dist/core/exchange/base-exchange-data-mapper.js.map +1 -0
  75. package/dist/core/price-aggregation/cardano-price-service.d.ts +31 -0
  76. package/dist/core/price-aggregation/cardano-price-service.d.ts.map +1 -0
  77. package/dist/core/price-aggregation/cardano-price-service.js +157 -0
  78. package/dist/core/price-aggregation/cardano-price-service.js.map +1 -0
  79. package/dist/core/price-aggregation/index.d.ts +11 -0
  80. package/dist/core/price-aggregation/index.d.ts.map +1 -0
  81. package/dist/core/price-aggregation/index.js +21 -0
  82. package/dist/core/price-aggregation/index.js.map +1 -0
  83. package/dist/core/price-aggregation/iris-api-client.d.ts +16 -0
  84. package/dist/core/price-aggregation/iris-api-client.d.ts.map +1 -0
  85. package/dist/core/price-aggregation/iris-api-client.js +62 -0
  86. package/dist/core/price-aggregation/iris-api-client.js.map +1 -0
  87. package/dist/core/price-aggregation/iris-pool-discovery.d.ts +37 -0
  88. package/dist/core/price-aggregation/iris-pool-discovery.d.ts.map +1 -0
  89. package/dist/core/price-aggregation/iris-pool-discovery.js +123 -0
  90. package/dist/core/price-aggregation/iris-pool-discovery.js.map +1 -0
  91. package/dist/core/price-aggregation/price-calculator.d.ts +27 -0
  92. package/dist/core/price-aggregation/price-calculator.d.ts.map +1 -0
  93. package/dist/core/price-aggregation/price-calculator.js +84 -0
  94. package/dist/core/price-aggregation/price-calculator.js.map +1 -0
  95. package/dist/core/risk-management/risk-manager.d.ts +14 -0
  96. package/dist/core/risk-management/risk-manager.d.ts.map +1 -0
  97. package/dist/core/risk-management/risk-manager.js +40 -0
  98. package/dist/core/risk-management/risk-manager.js.map +1 -0
  99. package/dist/core/strategy/base-strategy.d.ts +26 -0
  100. package/dist/core/strategy/base-strategy.d.ts.map +1 -0
  101. package/dist/core/strategy/base-strategy.js +46 -0
  102. package/dist/core/strategy/base-strategy.js.map +1 -0
  103. package/dist/core/strategy/strategy-factory.d.ts +7 -0
  104. package/dist/core/strategy/strategy-factory.d.ts.map +1 -0
  105. package/dist/core/strategy/strategy-factory.js +64 -0
  106. package/dist/core/strategy/strategy-factory.js.map +1 -0
  107. package/dist/exchanges/mexc/mexc-auth.d.ts +42 -0
  108. package/dist/exchanges/mexc/mexc-auth.d.ts.map +1 -0
  109. package/dist/exchanges/mexc/mexc-auth.js +122 -0
  110. package/dist/exchanges/mexc/mexc-auth.js.map +1 -0
  111. package/dist/exchanges/mexc/mexc-connector.d.ts +125 -0
  112. package/dist/exchanges/mexc/mexc-connector.d.ts.map +1 -0
  113. package/dist/exchanges/mexc/mexc-connector.js +422 -0
  114. package/dist/exchanges/mexc/mexc-connector.js.map +1 -0
  115. package/dist/exchanges/mexc/mexc-data-mapper.d.ts +50 -0
  116. package/dist/exchanges/mexc/mexc-data-mapper.d.ts.map +1 -0
  117. package/dist/exchanges/mexc/mexc-data-mapper.js +127 -0
  118. package/dist/exchanges/mexc/mexc-data-mapper.js.map +1 -0
  119. package/dist/exchanges/mexc/mexc-protobuf-decoder.d.ts +43 -0
  120. package/dist/exchanges/mexc/mexc-protobuf-decoder.d.ts.map +1 -0
  121. package/dist/exchanges/mexc/mexc-protobuf-decoder.js +235 -0
  122. package/dist/exchanges/mexc/mexc-protobuf-decoder.js.map +1 -0
  123. package/dist/exchanges/mexc/mexc-user-stream.d.ts +81 -0
  124. package/dist/exchanges/mexc/mexc-user-stream.d.ts.map +1 -0
  125. package/dist/exchanges/mexc/mexc-user-stream.js +253 -0
  126. package/dist/exchanges/mexc/mexc-user-stream.js.map +1 -0
  127. package/dist/exchanges/mexc/mexc-utils.d.ts +31 -0
  128. package/dist/exchanges/mexc/mexc-utils.d.ts.map +1 -0
  129. package/dist/exchanges/mexc/mexc-utils.js +186 -0
  130. package/dist/exchanges/mexc/mexc-utils.js.map +1 -0
  131. package/dist/exchanges/mexc/mexc-websocket.d.ts +124 -0
  132. package/dist/exchanges/mexc/mexc-websocket.d.ts.map +1 -0
  133. package/dist/exchanges/mexc/mexc-websocket.js +496 -0
  134. package/dist/exchanges/mexc/mexc-websocket.js.map +1 -0
  135. package/dist/index.d.ts +12 -0
  136. package/dist/index.d.ts.map +1 -0
  137. package/dist/index.js +42 -0
  138. package/dist/index.js.map +1 -0
  139. package/dist/strategies/grid/grid-calculator.d.ts +7 -0
  140. package/dist/strategies/grid/grid-calculator.d.ts.map +1 -0
  141. package/dist/strategies/grid/grid-calculator.js +34 -0
  142. package/dist/strategies/grid/grid-calculator.js.map +1 -0
  143. package/dist/strategies/grid/grid-order-manager.d.ts +23 -0
  144. package/dist/strategies/grid/grid-order-manager.d.ts.map +1 -0
  145. package/dist/strategies/grid/grid-order-manager.js +99 -0
  146. package/dist/strategies/grid/grid-order-manager.js.map +1 -0
  147. package/dist/strategies/grid/grid-strategy.d.ts +29 -0
  148. package/dist/strategies/grid/grid-strategy.d.ts.map +1 -0
  149. package/dist/strategies/grid/grid-strategy.js +185 -0
  150. package/dist/strategies/grid/grid-strategy.js.map +1 -0
  151. package/dist/types/account.d.ts +21 -0
  152. package/dist/types/account.d.ts.map +1 -0
  153. package/dist/types/account.js +3 -0
  154. package/dist/types/account.js.map +1 -0
  155. package/dist/types/exchange.d.ts +67 -0
  156. package/dist/types/exchange.d.ts.map +1 -0
  157. package/dist/types/exchange.js +3 -0
  158. package/dist/types/exchange.js.map +1 -0
  159. package/dist/types/grid.d.ts +10 -0
  160. package/dist/types/grid.d.ts.map +1 -0
  161. package/dist/types/grid.js +3 -0
  162. package/dist/types/grid.js.map +1 -0
  163. package/dist/types/index.d.ts +11 -0
  164. package/dist/types/index.d.ts.map +1 -0
  165. package/dist/types/index.js +27 -0
  166. package/dist/types/index.js.map +1 -0
  167. package/dist/types/iris.d.ts +58 -0
  168. package/dist/types/iris.d.ts.map +1 -0
  169. package/dist/types/iris.js +7 -0
  170. package/dist/types/iris.js.map +1 -0
  171. package/dist/types/market.d.ts +16 -0
  172. package/dist/types/market.d.ts.map +1 -0
  173. package/dist/types/market.js +3 -0
  174. package/dist/types/market.js.map +1 -0
  175. package/dist/types/mexc-raw.d.ts +87 -0
  176. package/dist/types/mexc-raw.d.ts.map +1 -0
  177. package/dist/types/mexc-raw.js +7 -0
  178. package/dist/types/mexc-raw.js.map +1 -0
  179. package/dist/types/mexc.d.ts +57 -0
  180. package/dist/types/mexc.d.ts.map +1 -0
  181. package/dist/types/mexc.js +8 -0
  182. package/dist/types/mexc.js.map +1 -0
  183. package/dist/types/price.d.ts +37 -0
  184. package/dist/types/price.d.ts.map +1 -0
  185. package/dist/types/price.js +7 -0
  186. package/dist/types/price.js.map +1 -0
  187. package/dist/types/risk.d.ts +22 -0
  188. package/dist/types/risk.d.ts.map +1 -0
  189. package/dist/types/risk.js +6 -0
  190. package/dist/types/risk.js.map +1 -0
  191. package/dist/types/strategy.d.ts +46 -0
  192. package/dist/types/strategy.d.ts.map +1 -0
  193. package/dist/types/strategy.js +3 -0
  194. package/dist/types/strategy.js.map +1 -0
  195. package/dist/utils/index.d.ts +2 -0
  196. package/dist/utils/index.d.ts.map +1 -0
  197. package/dist/utils/index.js +8 -0
  198. package/dist/utils/index.js.map +1 -0
  199. package/dist/utils/logger.d.ts +29 -0
  200. package/dist/utils/logger.d.ts.map +1 -0
  201. package/dist/utils/logger.js +108 -0
  202. package/dist/utils/logger.js.map +1 -0
  203. package/dist/utils/symbol-utils.d.ts +17 -0
  204. package/dist/utils/symbol-utils.d.ts.map +1 -0
  205. package/dist/utils/symbol-utils.js +41 -0
  206. package/dist/utils/symbol-utils.js.map +1 -0
  207. package/package.json +53 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/config/environment.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,oCAAwC;AAExC,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,MAAM,GAAG,IAAA,oBAAY,EAAC,uBAAuB,CAAC,CAAC;AA8BrD,MAAM,oBAAoB;IAChB,MAAM,CAAC,gBAAgB,CAAC,GAAW,EAAE,KAAyB;QACpE,IAAI,CAAC,KAA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AAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;YACvE,MAAM,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;YACtF,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF;AAEY,QAAA,MAAM,GAAG,oBAAoB,CAAC,QAAQ,EAAE,CAAC;AACtD,kBAAe,cAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './environment.js';
2
+ export { config as default } from './environment.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.default = void 0;
18
+ __exportStar(require("./environment.js"), exports);
19
+ var environment_js_1 = require("./environment.js");
20
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return environment_js_1.config; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAqD;AAA5C,yGAAA,MAAM,OAAW"}
@@ -0,0 +1,17 @@
1
+ export interface LauncherConfig {
2
+ exchange: string;
3
+ strategy: string;
4
+ symbol: string;
5
+ }
6
+ export interface GridLauncherParams {
7
+ gridLevels?: number;
8
+ gridSpacing?: number;
9
+ orderSize?: number;
10
+ minConfidence?: number;
11
+ priceDeviationThreshold?: number;
12
+ adjustmentDebounce?: number;
13
+ maxPositionSize?: number;
14
+ safetyReservePercentage?: number;
15
+ }
16
+ export declare const DEFAULT_GRID_PARAMS: GridLauncherParams;
17
+ //# sourceMappingURL=launcher-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher-config.d.ts","sourceRoot":"","sources":["../../src/config/launcher-config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,eAAO,MAAM,mBAAmB,EAAE,kBASjC,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_GRID_PARAMS = void 0;
4
+ exports.DEFAULT_GRID_PARAMS = {
5
+ gridLevels: 5,
6
+ gridSpacing: 0.02,
7
+ orderSize: 50,
8
+ minConfidence: 0.6,
9
+ priceDeviationThreshold: 0.015,
10
+ adjustmentDebounce: 2000,
11
+ maxPositionSize: 0.8,
12
+ safetyReservePercentage: 0.2
13
+ };
14
+ //# sourceMappingURL=launcher-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher-config.js","sourceRoot":"","sources":["../../src/config/launcher-config.ts"],"names":[],"mappings":";;;AAiBa,QAAA,mBAAmB,GAAuB;IACrD,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,EAAE;IACb,aAAa,EAAE,GAAG;IAClB,uBAAuB,EAAE,KAAK;IAC9B,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,GAAG;IACpB,uBAAuB,EAAE,GAAG;CAC7B,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Price Aggregation Configuration
3
+ * All endpoints and settings for price services
4
+ */
5
+ import { CardanoTokenConfig } from '../types/price';
6
+ export declare const CEX_API_CONFIG: {
7
+ BINANCE: {
8
+ BASE_URL: string;
9
+ ENDPOINTS: {
10
+ TICKER_PRICE: string;
11
+ };
12
+ };
13
+ MEXC: {
14
+ BASE_URL: string;
15
+ ENDPOINTS: {
16
+ TICKER_PRICE: string;
17
+ };
18
+ };
19
+ COINGECKO: {
20
+ BASE_URL: string;
21
+ ENDPOINTS: {
22
+ SIMPLE_PRICE: string;
23
+ };
24
+ };
25
+ KRAKEN: {
26
+ BASE_URL: string;
27
+ ENDPOINTS: {
28
+ TICKER: string;
29
+ };
30
+ };
31
+ };
32
+ export declare const IRIS_CONFIG: {
33
+ BASE_URL: string;
34
+ TIMEOUT: number;
35
+ };
36
+ export declare const SUPPORTED_TOKENS: Record<string, CardanoTokenConfig>;
37
+ /**
38
+ * Get token configuration by symbol
39
+ */
40
+ export declare function getTokenConfig(symbol: string): CardanoTokenConfig;
41
+ /**
42
+ * Check if token is supported
43
+ */
44
+ export declare function isTokenSupported(symbol: string): boolean;
45
+ /**
46
+ * Get all supported token symbols
47
+ */
48
+ export declare function getSupportedTokens(): string[];
49
+ //# sourceMappingURL=price-aggregation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-aggregation.d.ts","sourceRoot":"","sources":["../../src/config/price-aggregation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CAyB1B,CAAC;AAEF,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAyB/D,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,CAMjE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAE7C"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /**
3
+ * Price Aggregation Configuration
4
+ * All endpoints and settings for price services
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SUPPORTED_TOKENS = exports.IRIS_CONFIG = exports.CEX_API_CONFIG = void 0;
8
+ exports.getTokenConfig = getTokenConfig;
9
+ exports.isTokenSupported = isTokenSupported;
10
+ exports.getSupportedTokens = getSupportedTokens;
11
+ exports.CEX_API_CONFIG = {
12
+ BINANCE: {
13
+ BASE_URL: 'https://api.binance.com/api/v3',
14
+ ENDPOINTS: {
15
+ TICKER_PRICE: '/ticker/price'
16
+ }
17
+ },
18
+ MEXC: {
19
+ BASE_URL: 'https://api.mexc.com/api/v3',
20
+ ENDPOINTS: {
21
+ TICKER_PRICE: '/ticker/price'
22
+ }
23
+ },
24
+ COINGECKO: {
25
+ BASE_URL: 'https://api.coingecko.com/api/v3',
26
+ ENDPOINTS: {
27
+ SIMPLE_PRICE: '/simple/price'
28
+ }
29
+ },
30
+ KRAKEN: {
31
+ BASE_URL: 'https://api.kraken.com/0/public',
32
+ ENDPOINTS: {
33
+ TICKER: '/Ticker'
34
+ }
35
+ }
36
+ };
37
+ exports.IRIS_CONFIG = {
38
+ BASE_URL: 'https://iris.indigoprotocol.io',
39
+ TIMEOUT: 10000
40
+ };
41
+ exports.SUPPORTED_TOKENS = {
42
+ 'INDY': {
43
+ symbol: 'INDY',
44
+ policyId: '533bb94a8850ee3ccbe483106489399112b74c905342cb1792a797a0',
45
+ assetName: '494e4459',
46
+ minLiquidityThreshold: 100000
47
+ },
48
+ 'SNEK': {
49
+ symbol: 'SNEK',
50
+ policyId: '279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f',
51
+ assetName: '534e454b',
52
+ minLiquidityThreshold: 50000
53
+ },
54
+ 'NIGHT': {
55
+ symbol: 'NIGHT',
56
+ policyId: '0691b2fecca1ac4f53cb6dfb00b7013e561d1f34403b957cbb5af1fa4e49474854',
57
+ assetName: '4e49474854',
58
+ minLiquidityThreshold: 25000
59
+ },
60
+ 'MIN': {
61
+ symbol: 'MIN',
62
+ policyId: '29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c6',
63
+ assetName: '4d494e',
64
+ minLiquidityThreshold: 100000
65
+ }
66
+ };
67
+ /**
68
+ * Get token configuration by symbol
69
+ */
70
+ function getTokenConfig(symbol) {
71
+ const config = exports.SUPPORTED_TOKENS[symbol.toUpperCase()];
72
+ if (!config) {
73
+ throw new Error(`Unsupported token: ${symbol}`);
74
+ }
75
+ return config;
76
+ }
77
+ /**
78
+ * Check if token is supported
79
+ */
80
+ function isTokenSupported(symbol) {
81
+ return symbol.toUpperCase() in exports.SUPPORTED_TOKENS;
82
+ }
83
+ /**
84
+ * Get all supported token symbols
85
+ */
86
+ function getSupportedTokens() {
87
+ return Object.keys(exports.SUPPORTED_TOKENS);
88
+ }
89
+ //# sourceMappingURL=price-aggregation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-aggregation.js","sourceRoot":"","sources":["../../src/config/price-aggregation.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkEH,wCAMC;AAKD,4CAEC;AAKD,gDAEC;AAlFY,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE;QACP,QAAQ,EAAE,gCAAgC;QAC1C,SAAS,EAAE;YACT,YAAY,EAAE,eAAe;SAC9B;KACF;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,6BAA6B;QACvC,SAAS,EAAE;YACT,YAAY,EAAE,eAAe;SAC9B;KACF;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,kCAAkC;QAC5C,SAAS,EAAE;YACT,YAAY,EAAE,eAAe;SAC9B;KACF;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,iCAAiC;QAC3C,SAAS,EAAE;YACT,MAAM,EAAE,SAAS;SAClB;KACF;CACF,CAAC;AAEW,QAAA,WAAW,GAAG;IACzB,QAAQ,EAAE,gCAAgC;IAC1C,OAAO,EAAE,KAAK;CACf,CAAC;AAEW,QAAA,gBAAgB,GAAuC;IAClE,MAAM,EAAE;QACN,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,0DAA0D;QACpE,SAAS,EAAE,UAAU;QACrB,qBAAqB,EAAE,MAAM;KAC9B;IACD,MAAM,EAAE;QACN,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,0DAA0D;QACpE,SAAS,EAAE,UAAU;QACrB,qBAAqB,EAAE,KAAK;KAC7B;IACD,OAAO,EAAE;QACP,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,oEAAoE;QAC9E,SAAS,EAAE,YAAY;QACvB,qBAAqB,EAAE,KAAK;KAC7B;IACD,KAAK,EAAE;QACL,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,0DAA0D;QACpE,SAAS,EAAE,QAAQ;QACnB,qBAAqB,EAAE,MAAM;KAC9B;CACF,CAAC;AAEF;;GAEG;AACH,SAAgB,cAAc,CAAC,MAAc;IAC3C,MAAM,MAAM,GAAG,wBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IACtD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,MAAc;IAC7C,OAAO,MAAM,CAAC,WAAW,EAAE,IAAI,wBAAgB,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,wBAAgB,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Order, OrderBook, Ticker, Trade, OrderType, OrderSide } from '../../types';
2
+ import { Balance, ExchangeCredentials, WebSocketStatus } from '../../types';
3
+ /**
4
+ * Abstract base class for all exchange connectors
5
+ * Provides common functionality and defines the interface that all exchanges must implement
6
+ */
7
+ export declare abstract class BaseExchangeConnector {
8
+ protected readonly exchangeId: string;
9
+ protected readonly exchangeName: string;
10
+ protected credentials?: ExchangeCredentials;
11
+ protected connected: boolean;
12
+ constructor(exchangeId: string, exchangeName: string);
13
+ get id(): string;
14
+ get name(): string;
15
+ isConnected(): boolean;
16
+ setCredentials(credentials: ExchangeCredentials): void;
17
+ protected getCredentials(): ExchangeCredentials;
18
+ abstract connect(): Promise<void>;
19
+ abstract disconnect(): Promise<void>;
20
+ abstract getBalance(): Promise<Record<string, Balance>>;
21
+ abstract createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number): Promise<Order>;
22
+ abstract cancelOrder(orderId: string, symbol: string): Promise<void>;
23
+ abstract cancelAllOrders(symbol: string): Promise<void>;
24
+ abstract getOrder(orderId: string, symbol: string): Promise<Order>;
25
+ abstract getOpenOrders(symbol?: string): Promise<Order[]>;
26
+ abstract getTicker(symbol: string): Promise<Ticker>;
27
+ abstract getOrderBook(symbol: string): Promise<OrderBook>;
28
+ abstract getRecentTrades(symbol: string): Promise<Trade[]>;
29
+ abstract connectWebSocket(): Promise<void>;
30
+ abstract disconnectWebSocket(): Promise<void>;
31
+ abstract subscribeTicker(symbol: string, callback: (ticker: Ticker) => void): Promise<string>;
32
+ abstract subscribeOrderBook(symbol: string, callback: (orderbook: OrderBook) => void): Promise<string>;
33
+ abstract subscribeTrades(symbol: string, callback: (trade: Trade) => void): Promise<string>;
34
+ abstract subscribeOrders(callback: (order: Order) => void): Promise<string>;
35
+ abstract unsubscribe(subscriptionId: string): Promise<void>;
36
+ abstract isWebSocketConnected(): boolean;
37
+ abstract getWebSocketStatus(): WebSocketStatus;
38
+ abstract connectUserDataStream(): Promise<void>;
39
+ abstract disconnectUserDataStream(): Promise<void>;
40
+ abstract subscribeUserOrders(callback: (order: Order) => void): Promise<string>;
41
+ abstract subscribeUserTrades(callback: (trade: Trade) => void): Promise<string>;
42
+ abstract isUserDataStreamConnected(): boolean;
43
+ protected handleError(error: unknown, operation: string): never;
44
+ }
45
+ //# sourceMappingURL=base-exchange-connector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-exchange-connector.d.ts","sourceRoot":"","sources":["../../../src/core/exchange/base-exchange-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE5E;;;GAGG;AACH,8BAAsB,qBAAqB;IACzC,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IACxC,SAAS,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAC5C,SAA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AAS,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK;CAQhE"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseExchangeConnector = void 0;
4
+ /**
5
+ * Abstract base class for all exchange connectors
6
+ * Provides common functionality and defines the interface that all exchanges must implement
7
+ */
8
+ class BaseExchangeConnector {
9
+ constructor(exchangeId, exchangeName) {
10
+ this.connected = false;
11
+ this.exchangeId = exchangeId;
12
+ this.exchangeName = exchangeName;
13
+ }
14
+ get id() {
15
+ return this.exchangeId;
16
+ }
17
+ get name() {
18
+ return this.exchangeName;
19
+ }
20
+ isConnected() {
21
+ return this.connected;
22
+ }
23
+ setCredentials(credentials) {
24
+ this.credentials = credentials;
25
+ }
26
+ getCredentials() {
27
+ if (!this.credentials) {
28
+ throw new Error(`No credentials set for ${this.exchangeName}`);
29
+ }
30
+ return this.credentials;
31
+ }
32
+ // Error handling helper
33
+ handleError(error, operation) {
34
+ const message = error instanceof Error
35
+ ? error.message
36
+ : typeof error === 'string'
37
+ ? error
38
+ : 'Unknown error';
39
+ throw new Error(`${this.exchangeName} ${operation} failed: ${message}`);
40
+ }
41
+ }
42
+ exports.BaseExchangeConnector = BaseExchangeConnector;
43
+ //# sourceMappingURL=base-exchange-connector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-exchange-connector.js","sourceRoot":"","sources":["../../../src/core/exchange/base-exchange-connector.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH,MAAsB,qBAAqB;IAMzC,YAAY,UAAkB,EAAE,YAAoB;QAF1C,cAAS,GAAY,KAAK,CAAC;QAGnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,cAAc,CAAC,WAAgC;QAC7C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAES,cAAc;QACtB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IA6CD,wBAAwB;IACd,WAAW,CAAC,KAAc,EAAE,SAAiB;QACrD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK;YACpC,CAAC,CAAC,KAAK,CAAC,OAAO;YACf,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;gBACzB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,eAAe,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,YAAY,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF;AAtFD,sDAsFC"}
@@ -0,0 +1,58 @@
1
+ import { Order, OrderBook, Ticker, Trade } from '../../types';
2
+ import { Balance } from '../../types';
3
+ /**
4
+ * Abstract base class for exchange data mappers
5
+ * Maps exchange-specific data formats to OpenMM standard format
6
+ *
7
+ */
8
+ export declare abstract class BaseExchangeDataMapper<TRawOrder = unknown, TRawBalance = unknown, TRawTicker = unknown, TRawOrderBook = unknown, TRawTrade = unknown, TRawAccount = unknown> {
9
+ /**
10
+ * Map exchange-specific order format to OpenMM Order
11
+ */
12
+ abstract mapOrder(exchangeOrder: TRawOrder): Order;
13
+ /**
14
+ * Map exchange-specific balance format to OpenMM Balance
15
+ */
16
+ abstract mapBalance(exchangeBalance: TRawBalance): Balance;
17
+ /**
18
+ * Map exchange-specific ticker format to OpenMM Ticker
19
+ */
20
+ abstract mapTicker(exchangeTicker: TRawTicker): Ticker;
21
+ /**
22
+ * Map exchange-specific order book format to OpenMM OrderBook
23
+ */
24
+ abstract mapOrderBook(exchangeOrderBook: TRawOrderBook, symbol: string): OrderBook;
25
+ /**
26
+ * Map exchange-specific trade format to OpenMM Trade
27
+ */
28
+ abstract mapTrade(exchangeTrade: TRawTrade, symbol: string): Trade;
29
+ /**
30
+ * Map exchange-specific account format to OpenMM Balance records
31
+ * Used when getting all balances from account endpoint
32
+ */
33
+ abstract mapAccountBalances(exchangeAccount: TRawAccount): Record<string, Balance>;
34
+ /**
35
+ * Parse timestamp from various formats to number
36
+ */
37
+ protected parseTimestamp(timestamp: string | number | undefined | null): number;
38
+ /**
39
+ * Parse price from string to number
40
+ */
41
+ protected parsePrice(price: string | number | undefined | null): number;
42
+ /**
43
+ * Parse amount/quantity from string to number
44
+ */
45
+ protected parseAmount(amount: string | number | undefined | null): number;
46
+ /**
47
+ * Normalize symbol format to OpenMM standard
48
+ */
49
+ protected normalizeSymbol(symbol: string): string;
50
+ /**
51
+ * Parse order book entries from exchange format
52
+ */
53
+ protected parseOrderBookEntries(entries: [string, string][]): Array<{
54
+ price: number;
55
+ amount: number;
56
+ }>;
57
+ }
58
+ //# sourceMappingURL=base-exchange-data-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-exchange-data-mapper.d.ts","sourceRoot":"","sources":["../../../src/core/exchange/base-exchange-data-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC;;;;GAIG;AACH,8BAAsB,sBAAsB,CAC1C,SAAS,GAAG,OAAO,EACnB,WAAW,GAAG,OAAO,EACrB,UAAU,GAAG,OAAO,EACpB,aAAa,GAAG,OAAO,EACvB,SAAS,GAAG,OAAO,EACnB,WAAW,GAAG,OAAO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 * Abstract base class for exchange data mappers
6
+ * Maps exchange-specific data formats to OpenMM standard format
7
+ *
8
+ */
9
+ class BaseExchangeDataMapper {
10
+ /**
11
+ * Parse timestamp from various formats to number
12
+ */
13
+ parseTimestamp(timestamp) {
14
+ if (!timestamp)
15
+ return Date.now();
16
+ if (typeof timestamp === 'number')
17
+ return timestamp;
18
+ const parsed = parseInt(timestamp, 10);
19
+ return isNaN(parsed) ? Date.now() : parsed;
20
+ }
21
+ /**
22
+ * Parse price from string to number
23
+ */
24
+ parsePrice(price) {
25
+ if (!price)
26
+ return 0;
27
+ if (typeof price === 'number')
28
+ return price;
29
+ const parsed = parseFloat(price);
30
+ return isNaN(parsed) ? 0 : parsed;
31
+ }
32
+ /**
33
+ * Parse amount/quantity from string to number
34
+ */
35
+ parseAmount(amount) {
36
+ if (!amount)
37
+ return 0;
38
+ if (typeof amount === 'number')
39
+ return amount;
40
+ const parsed = parseFloat(amount);
41
+ return isNaN(parsed) ? 0 : parsed;
42
+ }
43
+ /**
44
+ * Normalize symbol format to OpenMM standard
45
+ */
46
+ normalizeSymbol(symbol) {
47
+ return symbol.toUpperCase();
48
+ }
49
+ /**
50
+ * Parse order book entries from exchange format
51
+ */
52
+ parseOrderBookEntries(entries) {
53
+ return entries.map(([price, amount]) => ({
54
+ price: this.parsePrice(price),
55
+ amount: this.parseAmount(amount)
56
+ }));
57
+ }
58
+ }
59
+ exports.BaseExchangeDataMapper = BaseExchangeDataMapper;
60
+ //# sourceMappingURL=base-exchange-data-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-exchange-data-mapper.js","sourceRoot":"","sources":["../../../src/core/exchange/base-exchange-data-mapper.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACH,MAAsB,sBAAsB;IAuC1C;;OAEG;IACO,cAAc,CAAC,SAA6C;QACpE,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;QAClC,IAAI,OAAO,SAAS,KAAK,QAAQ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
1
+ /**
2
+ * Cardano Price Service
3
+ * Main service orchestrating price aggregation for Cardano native tokens
4
+ * Following Phase 1 Iris-only approach with fail-fast error handling
5
+ */
6
+ import { AggregatedPrice } from '../../types';
7
+ export declare class CardanoPriceService {
8
+ private poolDiscovery;
9
+ private irisClient;
10
+ private priceCalculator;
11
+ constructor();
12
+ /**
13
+ * Main price fetching method - follows buyback bot approach
14
+ * Gets TOKEN/USDT price via ADA bridge: ADA/USDT × TOKEN/ADA
15
+ */
16
+ getTokenPrice(symbol: string): Promise<AggregatedPrice>;
17
+ /**
18
+ * Get TOKEN/ADA price using Iris prices API (correct approach)
19
+ */
20
+ private getTokenADAPrice;
21
+ /**
22
+ * Get ADA/USDT price from multiple CEX sources with fallback
23
+ * Uses Binance, MEXC, Coingecko, and Kraken for robust pricing
24
+ */
25
+ private getADAUSDTPrice;
26
+ /**
27
+ * Fetch ADA/USDT price from specified exchange
28
+ */
29
+ private fetchADAUSDT;
30
+ }
31
+ //# sourceMappingURL=cardano-price-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cardano-price-service.d.ts","sourceRoot":"","sources":["../../../src/core/price-aggregation/cardano-price-service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,eAAe,EAAY,MAAM,aAAa,CAAC;AAQvD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,aAAa,CAAoB;IACzC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,eAAe,CAAkB;;IAQzC;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IA4C7D;;OAEG;YACW,gBAAgB;IAgC9B;;;OAGG;YACW,eAAe;IA6B7B;;OAEG;YACW,YAAY;CAyC3B"}
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ /**
3
+ * Cardano Price Service
4
+ * Main service orchestrating price aggregation for Cardano native tokens
5
+ * Following Phase 1 Iris-only approach with fail-fast error handling
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.CardanoPriceService = void 0;
9
+ const iris_pool_discovery_1 = require("./iris-pool-discovery");
10
+ const iris_api_client_1 = require("./iris-api-client");
11
+ const price_calculator_1 = require("./price-calculator");
12
+ const price_aggregation_1 = require("../../config/price-aggregation");
13
+ const utils_1 = require("../../utils");
14
+ class CardanoPriceService {
15
+ constructor() {
16
+ this.poolDiscovery = new iris_pool_discovery_1.IrisPoolDiscovery();
17
+ this.irisClient = new iris_api_client_1.IrisApiClient();
18
+ this.priceCalculator = new price_calculator_1.PriceCalculator();
19
+ }
20
+ /**
21
+ * Main price fetching method - follows buyback bot approach
22
+ * Gets TOKEN/USDT price via ADA bridge: ADA/USDT × TOKEN/ADA
23
+ */
24
+ async getTokenPrice(symbol) {
25
+ if (!(0, price_aggregation_1.isTokenSupported)(symbol)) {
26
+ throw new Error(`Unsupported token: ${symbol}`);
27
+ }
28
+ try {
29
+ const [adaUsdtPrice, tokenAdaResult] = await Promise.all([
30
+ this.getADAUSDTPrice(),
31
+ this.getTokenADAPrice(symbol)
32
+ ]);
33
+ const finalPrice = adaUsdtPrice.price * tokenAdaResult.price;
34
+ utils_1.logger.info(`Final ${symbol}/USDT price: ${finalPrice.toFixed(8)}`);
35
+ return {
36
+ symbol: `${symbol}/USDT`,
37
+ price: finalPrice,
38
+ confidence: tokenAdaResult.confidence,
39
+ timestamp: new Date(),
40
+ sources: [
41
+ {
42
+ id: 'iris-dex',
43
+ name: 'Iris DEX Aggregator',
44
+ exchange: 'cardano',
45
+ reliability: 0.9,
46
+ latency: 0,
47
+ isActive: true
48
+ },
49
+ {
50
+ id: 'cex-ada',
51
+ name: 'CEX ADA/USDT',
52
+ exchange: adaUsdtPrice.source,
53
+ reliability: 0.95,
54
+ latency: 0,
55
+ isActive: true
56
+ }
57
+ ]
58
+ };
59
+ }
60
+ catch (error) {
61
+ throw new Error(`Price aggregation failed for ${symbol}: ${error}`);
62
+ }
63
+ }
64
+ /**
65
+ * Get TOKEN/ADA price using Iris prices API (correct approach)
66
+ */
67
+ async getTokenADAPrice(symbol) {
68
+ const tokenConfig = (0, price_aggregation_1.getTokenConfig)(symbol);
69
+ try {
70
+ const pools = await this.poolDiscovery.discoverPools('lovelace', tokenConfig);
71
+ if (pools.length === 0) {
72
+ throw new Error(`No pools found for ${symbol}`);
73
+ }
74
+ const topPools = pools
75
+ .filter(pool => pool.identifier && pool.state?.tvl)
76
+ .sort((a, b) => Number(b.state.tvl) - Number(a.state.tvl))
77
+ .slice(0, 3);
78
+ if (topPools.length === 0) {
79
+ throw new Error(`No valid pools with liquidity found for ${symbol}`);
80
+ }
81
+ const identifiers = topPools.map(pool => pool.identifier);
82
+ const prices = await this.irisClient.fetchPrices(identifiers, 'OpenMM-CardanoPriceService/1.0');
83
+ const result = this.priceCalculator.calculateLiquidityWeightedPrice(topPools, prices);
84
+ utils_1.logger.info(`${symbol}/ADA price: ${result.price.toFixed(8)} from ${result.poolsUsed} pools (Iris API)`);
85
+ return result;
86
+ }
87
+ catch (error) {
88
+ throw new Error(`Failed to get ${symbol}/ADA price from Iris: ${error}`);
89
+ }
90
+ }
91
+ /**
92
+ * Get ADA/USDT price from multiple CEX sources with fallback
93
+ * Uses Binance, MEXC, Coingecko, and Kraken for robust pricing
94
+ */
95
+ async getADAUSDTPrice() {
96
+ try {
97
+ const prices = await Promise.all([
98
+ this.fetchADAUSDT('binance').catch(() => null),
99
+ this.fetchADAUSDT('mexc').catch(() => null),
100
+ this.fetchADAUSDT('coingecko').catch(() => null),
101
+ this.fetchADAUSDT('kraken').catch(() => null)
102
+ ]);
103
+ const validPrices = prices.filter(price => price !== null && price > 0 && !isNaN(price));
104
+ if (validPrices.length === 0) {
105
+ throw new Error('No valid ADA/USDT price from any source');
106
+ }
107
+ const averagePrice = validPrices.reduce((sum, price) => sum + price, 0) / validPrices.length;
108
+ return {
109
+ symbol: 'ADA/USDT',
110
+ price: averagePrice,
111
+ timestamp: new Date(),
112
+ source: `multi-cex-${validPrices.length}`,
113
+ volume24h: 1000000
114
+ };
115
+ }
116
+ catch (error) {
117
+ throw new Error(`Failed to get ADA/USDT price: ${error}`);
118
+ }
119
+ }
120
+ /**
121
+ * Fetch ADA/USDT price from specified exchange
122
+ */
123
+ async fetchADAUSDT(exchange) {
124
+ let url;
125
+ let priceExtractor;
126
+ switch (exchange) {
127
+ case 'binance':
128
+ url = `${price_aggregation_1.CEX_API_CONFIG.BINANCE.BASE_URL}${price_aggregation_1.CEX_API_CONFIG.BINANCE.ENDPOINTS.TICKER_PRICE}?symbol=ADAUSDT`;
129
+ priceExtractor = (data) => parseFloat(data.price);
130
+ break;
131
+ case 'mexc':
132
+ url = `${price_aggregation_1.CEX_API_CONFIG.MEXC.BASE_URL}${price_aggregation_1.CEX_API_CONFIG.MEXC.ENDPOINTS.TICKER_PRICE}?symbol=ADAUSDT`;
133
+ priceExtractor = (data) => parseFloat(data.price);
134
+ break;
135
+ case 'coingecko':
136
+ url = `${price_aggregation_1.CEX_API_CONFIG.COINGECKO.BASE_URL}${price_aggregation_1.CEX_API_CONFIG.COINGECKO.ENDPOINTS.SIMPLE_PRICE}?ids=cardano&vs_currencies=usd`;
137
+ priceExtractor = (data) => data?.cardano?.usd;
138
+ break;
139
+ case 'kraken':
140
+ url = `${price_aggregation_1.CEX_API_CONFIG.KRAKEN.BASE_URL}${price_aggregation_1.CEX_API_CONFIG.KRAKEN.ENDPOINTS.TICKER}?pair=ADAUSD`;
141
+ priceExtractor = (data) => parseFloat(data?.result?.ADAUSD?.c?.[0]);
142
+ break;
143
+ }
144
+ const response = await fetch(url);
145
+ if (!response.ok) {
146
+ throw new Error(`${exchange} API error: ${response.status}`);
147
+ }
148
+ const data = await response.json();
149
+ const price = priceExtractor(data);
150
+ if (isNaN(price) || price <= 0 || price == null) {
151
+ throw new Error(`Invalid price from ${exchange}`);
152
+ }
153
+ return price;
154
+ }
155
+ }
156
+ exports.CardanoPriceService = CardanoPriceService;
157
+ //# sourceMappingURL=cardano-price-service.js.map