Commit 090cd34
committed
fix(polymarket): correct NO-side Kelly sizing + gate live orders on owner address
Two correctness fixes flagged by Codex review on PR #57.
P1 — polymarketAutonomy.ts NO-side sizing:
estimateSizeForRiskBudget() expects the win probability of the
*purchased* token, but the autonomy loop was always passing
`best.fairValueEstimate` which is the YES probability. For
`best.side === "no"` candidates that reverses Kelly: a contrarian
NO on a 93% YES market got sized as if NO had ~80% win probability,
producing wildly oversized live orders. Flip the probability for
NO before sizing.
P2 — polymarketAuth.ts placement gate:
When POLYMARKET_OWNER_ADDRESS is unset, syncPolymarketPositions()
silently no-ops. Live orders still went through, but the exit
monitor never saw the resulting positions — no auto-close, no
trailing stop, no drift-close. Block live placement until the env
var is set. Failing closed beats trading positions we can't
reconcile.
https://claude.ai/code/session_01To82bdNQsUtCeAyGJFLQc31 parent ee95d47 commit 090cd34
2 files changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
216 | 232 | | |
217 | 233 | | |
218 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
619 | 626 | | |
620 | 627 | | |
621 | | - | |
| 628 | + | |
622 | 629 | | |
623 | 630 | | |
624 | 631 | | |
| |||
0 commit comments