pmxt-core 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/BaseExchange.d.ts +38 -0
  2. package/dist/BaseExchange.js +51 -2
  3. package/dist/errors.d.ts +6 -0
  4. package/dist/errors.js +21 -1
  5. package/dist/exchanges/baozi/auth.d.ts +14 -0
  6. package/dist/exchanges/baozi/auth.js +33 -0
  7. package/dist/exchanges/baozi/errors.d.ts +11 -0
  8. package/dist/exchanges/baozi/errors.js +70 -0
  9. package/dist/exchanges/baozi/fetchEvents.d.ts +8 -0
  10. package/dist/exchanges/baozi/fetchEvents.js +34 -0
  11. package/dist/exchanges/baozi/fetchMarkets.d.ts +5 -0
  12. package/dist/exchanges/baozi/fetchMarkets.js +160 -0
  13. package/dist/exchanges/baozi/fetchOHLCV.d.ts +6 -0
  14. package/dist/exchanges/baozi/fetchOHLCV.js +10 -0
  15. package/dist/exchanges/baozi/fetchOrderBook.d.ts +12 -0
  16. package/dist/exchanges/baozi/fetchOrderBook.js +36 -0
  17. package/dist/exchanges/baozi/fetchTrades.d.ts +6 -0
  18. package/dist/exchanges/baozi/fetchTrades.js +10 -0
  19. package/dist/exchanges/baozi/index.d.ts +28 -0
  20. package/dist/exchanges/baozi/index.js +404 -0
  21. package/dist/exchanges/baozi/utils.d.ts +112 -0
  22. package/dist/exchanges/baozi/utils.js +446 -0
  23. package/dist/exchanges/baozi/websocket.d.ts +14 -0
  24. package/dist/exchanges/baozi/websocket.js +78 -0
  25. package/dist/exchanges/kalshi/auth.js +1 -0
  26. package/dist/exchanges/kalshi/fetchEvents.js +39 -0
  27. package/dist/exchanges/kalshi/fetchMarkets.js +13 -0
  28. package/dist/exchanges/kalshi/index.js +6 -0
  29. package/dist/exchanges/kalshi/websocket.js +14 -9
  30. package/dist/exchanges/limitless/auth.js +4 -0
  31. package/dist/exchanges/limitless/client.js +5 -1
  32. package/dist/exchanges/limitless/fetchEvents.js +69 -0
  33. package/dist/exchanges/limitless/fetchMarkets.js +13 -0
  34. package/dist/exchanges/limitless/index.js +8 -1
  35. package/dist/exchanges/limitless/websocket.js +7 -5
  36. package/dist/exchanges/myriad/auth.d.ts +8 -0
  37. package/dist/exchanges/myriad/auth.js +25 -0
  38. package/dist/exchanges/myriad/errors.d.ts +8 -0
  39. package/dist/exchanges/myriad/errors.js +33 -0
  40. package/dist/exchanges/myriad/fetchEvents.d.ts +3 -0
  41. package/dist/exchanges/myriad/fetchEvents.js +48 -0
  42. package/dist/exchanges/myriad/fetchMarkets.d.ts +3 -0
  43. package/dist/exchanges/myriad/fetchMarkets.js +102 -0
  44. package/dist/exchanges/myriad/fetchOHLCV.d.ts +3 -0
  45. package/dist/exchanges/myriad/fetchOHLCV.js +91 -0
  46. package/dist/exchanges/myriad/fetchOrderBook.d.ts +2 -0
  47. package/dist/exchanges/myriad/fetchOrderBook.js +47 -0
  48. package/dist/exchanges/myriad/fetchTrades.d.ts +3 -0
  49. package/dist/exchanges/myriad/fetchTrades.js +62 -0
  50. package/dist/exchanges/myriad/index.d.ts +24 -0
  51. package/dist/exchanges/myriad/index.js +209 -0
  52. package/dist/exchanges/myriad/utils.d.ts +15 -0
  53. package/dist/exchanges/myriad/utils.js +99 -0
  54. package/dist/exchanges/myriad/websocket.d.ts +17 -0
  55. package/dist/exchanges/myriad/websocket.js +105 -0
  56. package/dist/exchanges/polymarket/auth.js +6 -0
  57. package/dist/exchanges/polymarket/fetchEvents.js +72 -3
  58. package/dist/exchanges/polymarket/fetchMarkets.js +52 -0
  59. package/dist/exchanges/polymarket/index.js +6 -0
  60. package/dist/exchanges/polymarket/websocket.js +6 -3
  61. package/dist/exchanges/probable/auth.d.ts +14 -0
  62. package/dist/exchanges/probable/auth.js +67 -0
  63. package/dist/exchanges/probable/errors.d.ts +8 -0
  64. package/dist/exchanges/probable/errors.js +61 -0
  65. package/dist/exchanges/probable/fetchEvents.d.ts +5 -0
  66. package/dist/exchanges/probable/fetchEvents.js +148 -0
  67. package/dist/exchanges/probable/fetchMarkets.d.ts +3 -0
  68. package/dist/exchanges/probable/fetchMarkets.js +235 -0
  69. package/dist/exchanges/probable/fetchOHLCV.d.ts +3 -0
  70. package/dist/exchanges/probable/fetchOHLCV.js +83 -0
  71. package/dist/exchanges/probable/fetchOrderBook.d.ts +2 -0
  72. package/dist/exchanges/probable/fetchOrderBook.js +37 -0
  73. package/dist/exchanges/probable/fetchPositions.d.ts +2 -0
  74. package/dist/exchanges/probable/fetchPositions.js +33 -0
  75. package/dist/exchanges/probable/fetchTrades.d.ts +10 -0
  76. package/dist/exchanges/probable/fetchTrades.js +36 -0
  77. package/dist/exchanges/probable/index.d.ts +35 -0
  78. package/dist/exchanges/probable/index.js +317 -0
  79. package/dist/exchanges/probable/utils.d.ts +9 -0
  80. package/dist/exchanges/probable/utils.js +106 -0
  81. package/dist/exchanges/probable/websocket.d.ts +27 -0
  82. package/dist/exchanges/probable/websocket.js +102 -0
  83. package/dist/index.d.ts +12 -0
  84. package/dist/index.js +14 -2
  85. package/dist/server/app.js +23 -1
  86. package/dist/server/utils/lock-file.d.ts +1 -0
  87. package/dist/server/utils/lock-file.js +29 -8
  88. package/dist/utils/error-mapper.js +1 -0
  89. package/package.json +6 -3
package/dist/index.d.ts CHANGED
@@ -5,18 +5,30 @@ export * from './errors';
5
5
  export * from './exchanges/polymarket';
6
6
  export * from './exchanges/limitless';
7
7
  export * from './exchanges/kalshi';
8
+ export * from './exchanges/probable';
9
+ export * from './exchanges/baozi';
10
+ export * from './exchanges/myriad';
8
11
  export * from './server/app';
9
12
  export * from './server/utils/port-manager';
10
13
  export * from './server/utils/lock-file';
11
14
  import { PolymarketExchange } from './exchanges/polymarket';
12
15
  import { LimitlessExchange } from './exchanges/limitless';
13
16
  import { KalshiExchange } from './exchanges/kalshi';
17
+ import { ProbableExchange } from './exchanges/probable';
18
+ import { BaoziExchange } from './exchanges/baozi';
19
+ import { MyriadExchange } from './exchanges/myriad';
14
20
  declare const pmxt: {
15
21
  Polymarket: typeof PolymarketExchange;
16
22
  Limitless: typeof LimitlessExchange;
17
23
  Kalshi: typeof KalshiExchange;
24
+ Probable: typeof ProbableExchange;
25
+ Baozi: typeof BaoziExchange;
26
+ Myriad: typeof MyriadExchange;
18
27
  };
19
28
  export declare const Polymarket: typeof PolymarketExchange;
20
29
  export declare const Limitless: typeof LimitlessExchange;
21
30
  export declare const Kalshi: typeof KalshiExchange;
31
+ export declare const Probable: typeof ProbableExchange;
32
+ export declare const Baozi: typeof BaoziExchange;
33
+ export declare const Myriad: typeof MyriadExchange;
22
34
  export default pmxt;
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Kalshi = exports.Limitless = exports.Polymarket = void 0;
17
+ exports.Myriad = exports.Baozi = exports.Probable = exports.Kalshi = exports.Limitless = exports.Polymarket = void 0;
18
18
  __exportStar(require("./BaseExchange"), exports);
19
19
  __exportStar(require("./types"), exports);
20
20
  __exportStar(require("./utils/math"), exports);
@@ -22,18 +22,30 @@ __exportStar(require("./errors"), exports);
22
22
  __exportStar(require("./exchanges/polymarket"), exports);
23
23
  __exportStar(require("./exchanges/limitless"), exports);
24
24
  __exportStar(require("./exchanges/kalshi"), exports);
25
+ __exportStar(require("./exchanges/probable"), exports);
26
+ __exportStar(require("./exchanges/baozi"), exports);
27
+ __exportStar(require("./exchanges/myriad"), exports);
25
28
  __exportStar(require("./server/app"), exports);
26
29
  __exportStar(require("./server/utils/port-manager"), exports);
27
30
  __exportStar(require("./server/utils/lock-file"), exports);
28
31
  const polymarket_1 = require("./exchanges/polymarket");
29
32
  const limitless_1 = require("./exchanges/limitless");
30
33
  const kalshi_1 = require("./exchanges/kalshi");
34
+ const probable_1 = require("./exchanges/probable");
35
+ const baozi_1 = require("./exchanges/baozi");
36
+ const myriad_1 = require("./exchanges/myriad");
31
37
  const pmxt = {
32
38
  Polymarket: polymarket_1.PolymarketExchange,
33
39
  Limitless: limitless_1.LimitlessExchange,
34
- Kalshi: kalshi_1.KalshiExchange
40
+ Kalshi: kalshi_1.KalshiExchange,
41
+ Probable: probable_1.ProbableExchange,
42
+ Baozi: baozi_1.BaoziExchange,
43
+ Myriad: myriad_1.MyriadExchange
35
44
  };
36
45
  exports.Polymarket = polymarket_1.PolymarketExchange;
37
46
  exports.Limitless = limitless_1.LimitlessExchange;
38
47
  exports.Kalshi = kalshi_1.KalshiExchange;
48
+ exports.Probable = probable_1.ProbableExchange;
49
+ exports.Baozi = baozi_1.BaoziExchange;
50
+ exports.Myriad = myriad_1.MyriadExchange;
39
51
  exports.default = pmxt;
@@ -9,12 +9,18 @@ const cors_1 = __importDefault(require("cors"));
9
9
  const polymarket_1 = require("../exchanges/polymarket");
10
10
  const limitless_1 = require("../exchanges/limitless");
11
11
  const kalshi_1 = require("../exchanges/kalshi");
12
+ const probable_1 = require("../exchanges/probable");
13
+ const baozi_1 = require("../exchanges/baozi");
14
+ const myriad_1 = require("../exchanges/myriad");
12
15
  const errors_1 = require("../errors");
13
16
  // Singleton instances for local usage (when no credentials provided)
14
17
  const defaultExchanges = {
15
18
  polymarket: null,
16
19
  limitless: null,
17
- kalshi: null
20
+ kalshi: null,
21
+ probable: null,
22
+ baozi: null,
23
+ myriad: null
18
24
  };
19
25
  async function startServer(port, accessToken) {
20
26
  const app = (0, express_1.default)();
@@ -132,6 +138,22 @@ function createExchange(name, credentials) {
132
138
  apiKey: credentials?.apiKey || process.env.KALSHI_API_KEY,
133
139
  privateKey: credentials?.privateKey || process.env.KALSHI_PRIVATE_KEY
134
140
  });
141
+ case 'probable':
142
+ return new probable_1.ProbableExchange({
143
+ apiKey: credentials?.apiKey || process.env.PROBABLE_API_KEY,
144
+ apiSecret: credentials?.apiSecret || process.env.PROBABLE_API_SECRET,
145
+ passphrase: credentials?.passphrase || process.env.PROBABLE_PASSPHRASE,
146
+ privateKey: credentials?.privateKey || process.env.PROBABLE_PRIVATE_KEY,
147
+ });
148
+ case 'baozi':
149
+ return new baozi_1.BaoziExchange({
150
+ privateKey: credentials?.privateKey || process.env.BAOZI_PRIVATE_KEY,
151
+ });
152
+ case 'myriad':
153
+ return new myriad_1.MyriadExchange({
154
+ apiKey: credentials?.apiKey || process.env.MYRIAD_API_KEY || process.env.MYRIAD_PROD,
155
+ privateKey: credentials?.privateKey || process.env.MYRIAD_WALLET_ADDRESS,
156
+ });
135
157
  default:
136
158
  throw new Error(`Unknown exchange: ${name}`);
137
159
  }
@@ -10,5 +10,6 @@ export declare class LockFile {
10
10
  timestamp: number;
11
11
  } | null>;
12
12
  remove(): Promise<void>;
13
+ private isProcessRunning;
13
14
  isServerRunning(): Promise<boolean>;
14
15
  }
@@ -37,7 +37,9 @@ exports.LockFile = void 0;
37
37
  const fs = __importStar(require("fs/promises"));
38
38
  const path = __importStar(require("path"));
39
39
  const os = __importStar(require("os"));
40
+ const child_process_1 = require("child_process");
40
41
  class LockFile {
42
+ lockPath;
41
43
  constructor() {
42
44
  this.lockPath = path.join(os.homedir(), '.pmxt', 'server.lock');
43
45
  }
@@ -62,20 +64,39 @@ class LockFile {
62
64
  // Ignore errors if file doesn't exist
63
65
  }
64
66
  }
65
- async isServerRunning() {
66
- const lock = await this.read();
67
- if (!lock)
68
- return false;
69
- // Check if process is still alive
67
+ isProcessRunning(pid) {
68
+ if (process.platform === 'win32') {
69
+ // process.kill(pid, 0) is unreliable on Windows
70
+ try {
71
+ const output = (0, child_process_1.execSync)(`tasklist /FI "PID eq ${pid}" /NH`, {
72
+ encoding: 'utf-8',
73
+ timeout: 5000,
74
+ stdio: ['pipe', 'pipe', 'pipe'],
75
+ });
76
+ return output.includes(String(pid));
77
+ }
78
+ catch {
79
+ return false;
80
+ }
81
+ }
70
82
  try {
71
- process.kill(lock.pid, 0); // Signal 0 checks existence without killing
83
+ process.kill(pid, 0);
72
84
  return true;
73
85
  }
74
86
  catch {
75
- // Process doesn't exist, remove stale lock file
76
- await this.remove();
77
87
  return false;
78
88
  }
79
89
  }
90
+ async isServerRunning() {
91
+ const lock = await this.read();
92
+ if (!lock)
93
+ return false;
94
+ if (this.isProcessRunning(lock.pid)) {
95
+ return true;
96
+ }
97
+ // Process doesn't exist, remove stale lock file
98
+ await this.remove();
99
+ return false;
100
+ }
80
101
  }
81
102
  exports.LockFile = LockFile;
@@ -13,6 +13,7 @@ const errors_1 = require("../errors");
13
13
  * Can be extended by exchange-specific error mappers for custom error patterns.
14
14
  */
15
15
  class ErrorMapper {
16
+ exchangeName;
16
17
  constructor(exchangeName) {
17
18
  this.exchangeName = exchangeName;
18
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxt-core",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "pmxt is a unified prediction market data API. The ccxt for prediction markets.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,8 +29,8 @@
29
29
  "test": "jest -c jest.config.js",
30
30
  "server": "tsx watch src/server/index.ts",
31
31
  "server:prod": "node dist/server/index.js",
32
- "generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.3.0,library=urllib3",
33
- "generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.3.0,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
32
+ "generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.5.0,library=urllib3",
33
+ "generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.5.0,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
34
34
  "extract:jsdoc": "node ../scripts/extract-jsdoc.js",
35
35
  "generate:docs": "npm run extract:jsdoc && node ../scripts/generate-api-docs.js",
36
36
  "generate:sdk:all": "npm run generate:sdk:python && npm run generate:sdk:typescript && npm run generate:docs"
@@ -42,8 +42,11 @@
42
42
  "dependencies": {
43
43
  "@limitless-exchange/sdk": "^1.0.2",
44
44
  "@polymarket/clob-client": "^5.2.0",
45
+ "@prob/clob": "0.5.0",
46
+ "@solana/web3.js": "^1.98.4",
45
47
  "@types/express": "^5.0.6",
46
48
  "axios": "^1.7.9",
49
+ "bs58": "^6.0.0",
47
50
  "cors": "^2.8.5",
48
51
  "dotenv": "^17.2.3",
49
52
  "ethers": "^5.8.0",