# TradeOnce

- **Event:** [AIE Code Summit 2026 Hackathon](https://cerebralvalley.ai/e/aie-code-2026-hackathon)
- **When:** Sat, Nov 7 at 9:00 AM – 10:00 PM (PST)
- **Where:** San Francisco, CA
- **Team:** [Geetesh Challur](https://cerebralvalley.ai/u/geeteshc10), [Shreya Hiremath](https://cerebralvalley.ai/u/shrhir), [Anush Harish](https://cerebralvalley.ai/u/anush_harish), [Rahul Sridhar](https://cerebralvalley.ai/u/rahul_sridhar)
- **GitHub:** https://github.com/geeteshCh/tradeOnce/tree/main
- **Demo video:** https://youtu.be/3tIXI4vbVVU
- **Gallery:** https://cerebralvalley.ai/e/aie-code-2026-hackathon/hackathon/gallery
- **Page:** https://cerebralvalley.ai/e/aie-code-2026-hackathon/hackathon/gallery/50

Imagine giving an AI agent access to your money and telling it to make trades on your behalf. You trust it to make decisions, but what happens when it makes a mistake? What if it accidentally executes the same trade twice because of a network timeout? What if it buys more shares than you can afford? These aren't just hypothetical problems. Alpaca, a brokerage platform, has explicitly warned that retrying an order after an error can result in duplicate trades. Delayed fill updates and partial fills make this an even bigger challenge. That's why we're building TradeOnce. TradeOnce repairs the code, independently verifies the trades, and remembers what worked.

Repair: Google Research Harness² proposes better instructions, probes them by running Gemini 4 Argon's Python fixes, then composes improved guidance (Propose-Probe-Compose).
Verify: patches use typed Pydantic contracts and run in a macOS sandbox against a fault-injecting broker simulator. A fixed Python Auditor checks the broker ledger, regressions, and private tests. The Builder cannot edit the Judge or its hidden cases.
Remember: Git versions the approved code. MongoDB saves verified Builder guidance with revision checks; rejection keeps the previous state. The next task starts with broken code and reloads the approved lesson through a fresh database connection.

Measured results:
Recorded coding run: timeout repair took 3 proposals / 147 seconds; a related server-error repair with the saved lesson took 1 proposal / 36 seconds. Both passed 5/5 hidden checks. Different tasks: observed lesson transfer, not a controlled speedup.
Six matched Alpaca paper-broker scenarios: the original Executor made 3 duplicate orders; the Gemini-written version made 0 and completed 6/6 safely by our checks. The unmodified ai-hedge-fund pipeline runs through our adapter. These use fake money, real broker APIs, injected faults, and cached stand-in analyst signals.

## More from AIE Code Summit 2026 Hackathon

- [Second Grader](https://cerebralvalley.ai/e/aie-code-2026-hackathon/hackathon/gallery/47)
- [firefighters](https://cerebralvalley.ai/e/aie-code-2026-hackathon/hackathon/gallery/48)
- [mission mars](https://cerebralvalley.ai/e/aie-code-2026-hackathon/hackathon/gallery/49)
- [icomppower](https://cerebralvalley.ai/e/aie-code-2026-hackathon/hackathon/gallery/51)
- [Better](https://cerebralvalley.ai/e/aie-code-2026-hackathon/hackathon/gallery/52)
- [Frankenstein](https://cerebralvalley.ai/e/aie-code-2026-hackathon/hackathon/gallery/53)

---

Markdown version of https://cerebralvalley.ai/e/aie-code-2026-hackathon/hackathon/gallery/50. Site index for agents: https://cerebralvalley.ai/llms.txt · full text: https://cerebralvalley.ai/llms-full.txt
