Skip to content

Implement batch trade endpoint for multi-key order submission #981

Description

@Chucks1093

Summary

Build a batch trade endpoint that accepts multiple buy or sell orders, validates each against current key state, and constructs a single batch transaction for the client to sign and submit.

Scope

  • POST /trade/batch — accepts orders array with key_id, direction, amount, max_slippage_bps
  • Each order validated against current price, slippage, cap, cooldown, and freeze state
  • Per-order validation errors returned before transaction construction
  • Unsigned batch transaction returned for client signing
  • Estimated total fee and cost included in response

Acceptance Criteria

  • Per-order validation catches all constraint violations with clear errors
  • Unsigned batch transaction constructed correctly for valid orders
  • Total fee and cost estimates accurate across all orders
  • Mixed valid/invalid order sets return per-order error detail
  • Endpoint rejects empty order arrays with 400

ETA

12 hours

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions