pandora-cli-skills 1.1.5 → 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.
- package/README_FOR_SHARING.md +8 -0
- package/SKILL.md +2 -0
- package/cli/lib/mirror_sync_service.cjs +14 -3
- package/cli/pandora.cjs +15 -3
- package/package.json +1 -1
- package/scripts/.env.example +8 -0
package/README_FOR_SHARING.md
CHANGED
|
@@ -35,6 +35,13 @@ Prerequisite: Node.js `>=18`.
|
|
|
35
35
|
- `ORACLE`
|
|
36
36
|
- `FACTORY`
|
|
37
37
|
- `USDC`
|
|
38
|
+
- optional for live mirror hedging:
|
|
39
|
+
- `POLYMARKET_PRIVATE_KEY`
|
|
40
|
+
- `POLYMARKET_FUNDER`
|
|
41
|
+
- `POLYMARKET_API_KEY`
|
|
42
|
+
- `POLYMARKET_API_SECRET`
|
|
43
|
+
- `POLYMARKET_API_PASSPHRASE`
|
|
44
|
+
- `POLYMARKET_HOST`
|
|
38
45
|
4. Validate and build:
|
|
39
46
|
- `npm run doctor`
|
|
40
47
|
- `npm run build`
|
|
@@ -188,6 +195,7 @@ Prerequisite: Node.js `>=18`.
|
|
|
188
195
|
- `mirror sync`:
|
|
189
196
|
- envelope is `ok=true`, `command="mirror.sync"`, with `data.strategyHash`, `data.stateFile`, `data.parameters`, `data.snapshots[]`, and `data.actions[]`.
|
|
190
197
|
- hedge controls: `--hedge-trigger-usdc`, `--max-hedge-usdc`, `--hedge-ratio <n>` (default `1`), and `--no-hedge` to disable hedge execution while keeping drift rebalancing active.
|
|
198
|
+
- rebalance sizing is pool-aware: drift notional scales with `reserveYes + reserveNo`, then bounded by `--max-rebalance-usdc`.
|
|
191
199
|
- `mirror status`:
|
|
192
200
|
- envelope is `ok=true`, `command="mirror.status"`, with `data.stateFile`, `data.strategyHash`, and persisted `data.state`.
|
|
193
201
|
- `webhook test`:
|
package/SKILL.md
CHANGED
|
@@ -165,6 +165,8 @@ pandora --output json suggest --wallet <0x...> --risk medium --budget 50 --inclu
|
|
|
165
165
|
- `mirror deploy`: dry-run/execute Pandora AMM deployment from mirror plan inputs.
|
|
166
166
|
- `mirror verify`: explicit question/rules similarity endpoint for AI-subagent validation.
|
|
167
167
|
- `mirror sync`: paper-first delta-neutral loop with strict gates, state persistence, and optional live hedging (`--hedge-ratio <n>`, `--no-hedge`).
|
|
168
|
+
- live hedge env: `POLYMARKET_PRIVATE_KEY`, `POLYMARKET_FUNDER`, `POLYMARKET_API_KEY`, `POLYMARKET_API_SECRET`, `POLYMARKET_API_PASSPHRASE`, `POLYMARKET_HOST`.
|
|
169
|
+
- rebalance sizing is pool-aware and bounded by `--max-rebalance-usdc`.
|
|
168
170
|
- `mirror status`: local mirror state inspection (no network side effects).
|
|
169
171
|
- `webhook test`: channel validation for generic, Telegram, and Discord payload delivery.
|
|
170
172
|
- `leaderboard`: ranked user aggregates by profit/volume/win-rate.
|
|
@@ -56,6 +56,7 @@ function evaluateSnapshot(verifyPayload, options) {
|
|
|
56
56
|
|
|
57
57
|
const reserveYes = toNumber(pandora.reserveYes);
|
|
58
58
|
const reserveNo = toNumber(pandora.reserveNo);
|
|
59
|
+
const reserveTotalUsdc = reserveYes !== null && reserveNo !== null ? round(reserveYes + reserveNo, 6) : null;
|
|
59
60
|
const deltaLpUsdc = reserveYes !== null && reserveNo !== null ? round(reserveYes - reserveNo, 6) : null;
|
|
60
61
|
const targetHedgeUsdc = deltaLpUsdc === null ? null : round(-deltaLpUsdc, 6);
|
|
61
62
|
|
|
@@ -64,6 +65,9 @@ function evaluateSnapshot(verifyPayload, options) {
|
|
|
64
65
|
pandoraYesPct: pandoraYes,
|
|
65
66
|
driftBps,
|
|
66
67
|
driftTriggered,
|
|
68
|
+
reserveYesUsdc: reserveYes,
|
|
69
|
+
reserveNoUsdc: reserveNo,
|
|
70
|
+
reserveTotalUsdc,
|
|
67
71
|
deltaLpUsdc,
|
|
68
72
|
targetHedgeUsdc,
|
|
69
73
|
};
|
|
@@ -217,9 +221,14 @@ async function runMirrorSync(options, deps = {}) {
|
|
|
217
221
|
const scaledHedgeUsdc = rawHedgeTriggered ? Math.abs(gapUsdc) * options.hedgeRatio : 0;
|
|
218
222
|
const plannedHedgeUsdc = hedgeTriggered ? Math.min(scaledHedgeUsdc, options.maxHedgeUsdc) : 0;
|
|
219
223
|
|
|
220
|
-
const
|
|
224
|
+
const driftFraction = snapshotMetrics.driftBps === null ? 0 : snapshotMetrics.driftBps / 10_000;
|
|
225
|
+
const rebalanceFromPoolUsdc =
|
|
226
|
+
snapshotMetrics.reserveTotalUsdc === null ? null : snapshotMetrics.reserveTotalUsdc * driftFraction;
|
|
227
|
+
const rebalanceFromDriftPointsUsdc = snapshotMetrics.driftBps === null ? 0 : snapshotMetrics.driftBps / 100;
|
|
228
|
+
const rebalanceSizingBasis = rebalanceFromPoolUsdc === null ? 'drift-points-fallback' : 'pool-size-drift';
|
|
229
|
+
const rebalanceCandidateUsdc = rebalanceFromPoolUsdc === null ? rebalanceFromDriftPointsUsdc : rebalanceFromPoolUsdc;
|
|
221
230
|
const plannedRebalanceUsdc = snapshotMetrics.driftTriggered
|
|
222
|
-
? Math.min(options.maxRebalanceUsdc, Math.max(1,
|
|
231
|
+
? Math.min(options.maxRebalanceUsdc, Math.max(1, rebalanceCandidateUsdc))
|
|
223
232
|
: 0;
|
|
224
233
|
|
|
225
234
|
const plannedSpendUsdc = round(plannedHedgeUsdc + plannedRebalanceUsdc, 6) || 0;
|
|
@@ -257,6 +266,8 @@ async function runMirrorSync(options, deps = {}) {
|
|
|
257
266
|
hedgeRatio: options.hedgeRatio,
|
|
258
267
|
hedgeSuppressed: rawHedgeTriggered && !options.hedgeEnabled,
|
|
259
268
|
plannedHedgeUsdc,
|
|
269
|
+
rebalanceSizingBasis,
|
|
270
|
+
rebalanceCandidateUsdc: round(rebalanceCandidateUsdc, 6),
|
|
260
271
|
plannedRebalanceUsdc,
|
|
261
272
|
plannedSpendUsdc,
|
|
262
273
|
depthWithinSlippageUsd: depth.depthWithinSlippageUsd,
|
|
@@ -320,7 +331,7 @@ async function runMirrorSync(options, deps = {}) {
|
|
|
320
331
|
}
|
|
321
332
|
|
|
322
333
|
if (hedgeTriggered && plannedHedgeUsdc > 0) {
|
|
323
|
-
const hedgeSide =
|
|
334
|
+
const hedgeSide = 'buy';
|
|
324
335
|
const tokenId = gapUsdc >= 0 ? verifyPayload.sourceMarket.yesTokenId : verifyPayload.sourceMarket.noTokenId;
|
|
325
336
|
|
|
326
337
|
if (options.executeLive) {
|
package/cli/pandora.cjs
CHANGED
|
@@ -6630,14 +6630,26 @@ async function runMirrorCommand(args, context) {
|
|
|
6630
6630
|
emitSuccess(
|
|
6631
6631
|
context.outputMode,
|
|
6632
6632
|
'mirror.sync.help',
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6633
|
+
{
|
|
6634
|
+
usage:
|
|
6635
|
+
'pandora [--output table|json] mirror sync run|once --pandora-market-address <address> --polymarket-market-id <id>|--polymarket-slug <slug> [--paper|--execute-live] [--interval-ms <ms>] [--drift-trigger-bps <n>] [--hedge-trigger-usdc <n>] [--hedge-ratio <n>] [--no-hedge] [--max-rebalance-usdc <n>] [--max-hedge-usdc <n>] [--max-open-exposure-usdc <n>] [--max-trades-per-day <n>] [--cooldown-ms <ms>] [--state-file <path>] [--kill-switch-file <path>]',
|
|
6636
|
+
liveHedgeEnv: [
|
|
6637
|
+
'POLYMARKET_PRIVATE_KEY',
|
|
6638
|
+
'POLYMARKET_FUNDER',
|
|
6639
|
+
'POLYMARKET_API_KEY',
|
|
6640
|
+
'POLYMARKET_API_SECRET',
|
|
6641
|
+
'POLYMARKET_API_PASSPHRASE',
|
|
6642
|
+
'POLYMARKET_HOST',
|
|
6643
|
+
],
|
|
6644
|
+
},
|
|
6636
6645
|
);
|
|
6637
6646
|
} else {
|
|
6638
6647
|
console.log(
|
|
6639
6648
|
'Usage: pandora [--output table|json] mirror sync run|once --pandora-market-address <address> --polymarket-market-id <id>|--polymarket-slug <slug> [--paper|--execute-live] [--interval-ms <ms>] [--drift-trigger-bps <n>] [--hedge-trigger-usdc <n>] [--hedge-ratio <n>] [--no-hedge] [--max-rebalance-usdc <n>] [--max-hedge-usdc <n>] [--max-open-exposure-usdc <n>] [--max-trades-per-day <n>] [--cooldown-ms <ms>] [--state-file <path>] [--kill-switch-file <path>]',
|
|
6640
6649
|
);
|
|
6650
|
+
console.log(
|
|
6651
|
+
'Live hedge env: POLYMARKET_PRIVATE_KEY, POLYMARKET_FUNDER, POLYMARKET_API_KEY, POLYMARKET_API_SECRET, POLYMARKET_API_PASSPHRASE, POLYMARKET_HOST.',
|
|
6652
|
+
);
|
|
6641
6653
|
}
|
|
6642
6654
|
return;
|
|
6643
6655
|
}
|
package/package.json
CHANGED
package/scripts/.env.example
CHANGED
|
@@ -5,3 +5,11 @@ PRIVATE_KEY=0x...
|
|
|
5
5
|
ORACLE=0x259308E7d8557e4Ba192De1aB8Cf7e0E21896442
|
|
6
6
|
FACTORY=0xaB120F1FD31FB1EC39893B75d80a3822b1Cd8d0c
|
|
7
7
|
USDC=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
|
|
8
|
+
|
|
9
|
+
# Optional: Polymarket live hedging credentials for `pandora mirror sync --execute-live`
|
|
10
|
+
POLYMARKET_HOST=https://clob.polymarket.com
|
|
11
|
+
POLYMARKET_PRIVATE_KEY=0x...
|
|
12
|
+
POLYMARKET_FUNDER=
|
|
13
|
+
POLYMARKET_API_KEY=
|
|
14
|
+
POLYMARKET_API_SECRET=
|
|
15
|
+
POLYMARKET_API_PASSPHRASE=
|