Skip to content

[Epic 7.1] Define IAutoTradeAdapter interface #121

@ooples

Description

@ooples

User Story

As a library maintainer, I want a clean trading adapter interface so that new broker integrations can be easily added.

Acceptance Criteria

  • IAutoTradeAdapter interface with order methods
  • TradeOrder record with order details:
    • Symbol
    • Side (Buy/Sell)
    • OrderType (Market/Limit/Stop)
    • Quantity
    • LimitPrice (optional)
    • StopPrice (optional)
    • TimeInForce
  • TradeResult for order status
  • Async-first design
  • Position tracking interface

Interface Design

public interface IAutoTradeAdapter : IAsyncDisposable
{
    string AdapterType { get; }
    bool IsLiveTradingEnabled { get; }
    
    Task<TradeResult> SubmitOrderAsync(TradeOrder order, CancellationToken ct = default);
    Task<Position?> GetPositionAsync(SymbolId symbol, CancellationToken ct = default);
    Task<IReadOnlyList<TradeOrder>> GetOpenOrdersAsync(CancellationToken ct = default);
    Task<bool> CancelOrderAsync(string orderId, CancellationToken ct = default);
}

public record TradeOrder(
    SymbolId Symbol,
    OrderSide Side,
    OrderType Type,
    decimal Quantity,
    decimal? LimitPrice = null,
    decimal? StopPrice = null,
    TimeInForce TimeInForce = TimeInForce.Day);

Dependencies

  • [Epic 5.1] Create SignalCatalog

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestepic:tradingEpic: AutoTrading Adaptersv2.0Target: v2.0 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions