Skip to content

Implement Advanced Order Types (Limit, Stop-Loss, Trailing Stop) #31

Description

@akargi

Overview

Extend the marketplace service to support advanced order types beyond simple market orders, enabling traders to execute sophisticated trading strategies with conditional execution.

Description

Currently the system supports basic market orders. This feature adds support for limit orders, stop-loss orders, and trailing stop orders that execute conditionally based on price thresholds.

Requirements

  • Limit orders: Execute only at specified price or better
  • Stop-loss orders: Trigger market order when price reaches threshold
  • Trailing stop orders: Automatically adjust stop price as market price moves favorably
  • Order state machine with proper lifecycle management (pending → triggered → filled/cancelled)
  • Real-time price monitoring against active orders
  • Background job processing for order execution
  • Order modification and cancellation before execution
  • Execution history and audit trail

Acceptance Criteria

  • Advanced order types entity models created in database
  • POST /api/marketplace/orders supports order_type parameter (market, limit, stop_loss, trailing_stop)
  • Limit orders execute when price conditions are met
  • Stop-loss orders trigger within 5 seconds of threshold breach
  • Trailing stop orders correctly adjust based on favorable price movement
  • Bull queue configured for order monitoring background jobs
  • Order state transitions validated with comprehensive unit tests (>80% coverage)
  • GET /api/marketplace/orders/:id returns complete order state and execution history
  • E2E tests validate order execution across different market conditions
  • Swagger docs include all advanced order type examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions