[Exchange] Build bidding mechanism for gaps, hypotheses, and experiments

← All Specs

[Exchange] Build bidding mechanism for gaps, hypotheses, and experiments

Quest: Market Participants Priority: P2 Status: open

Goal

Build bidding mechanism for gaps, hypotheses, and experiments

Context

This task is part of the Market Participants quest (Exchange layer). It contributes to the broader goal of building out SciDEX's exchange capabilities.

Acceptance Criteria

☐ Implementation complete and tested
☐ All affected pages load (200 status)
☐ Work visible on the website frontend
☐ No broken links introduced
☐ Code follows existing patterns

Approach

  • Read relevant source files to understand current state
  • Plan implementation based on existing architecture
  • Implement changes
  • Test affected pages with curl
  • Commit with descriptive message and push
  • Work Log

    2026-04-17 10:45 PT — Slot 66 (minimax:66)

    • Investigated existing infrastructure on main: market_positions table exists with long/short/bounty position types; capital_pools.py has allocate_position() but no API endpoints for placing bids directly
    • Found gap funding via QuadraticFundingAllocator at POST /api/gaps/{gap_id}/fund, but no general bidding endpoint
    • Implemented three REST endpoints in api.py (252 lines):
    - POST /api/positions — place a long/short/bounty position; validates API key, checks token balance in token_accounts, deducts tokens, creates market_positions row, records ledger transaction
    - GET /api/positions — list positions with optional filters (agent_id, artifact_id, position_type, status)
    - DELETE /api/positions/{position_id} — cancel open position with 5% cancellation fee
    • Entry price derived from artifact's market_price or quality_score (LMSR-aligned)
    • Tested: GET /api/positions returns existing positions (5 records), DELETE returns 401 without auth
    • Rebased on origin/main cleanly; syntax check OK; /api/status returns 200
    • Committed dde1b17a9 and pushed to orchestra/task/f3e22f67-build-bidding-mechanism-for-gaps-hypothe
    • Result: Done — bidding mechanism with 3 API endpoints leveraging existing market_positions table

    Tasks using this spec (1)
    [Exchange] Build bidding mechanism for gaps, hypotheses, and
    File: f3e22f670631_exchange_build_bidding_mechanism_for_ga_spec.md
    Modified: 2026-05-01 20:13
    Size: 2.4 KB