Skip to content

[Epic 7.4] Implement trading safety: EnableLiveTrading flag #124

@ooples

Description

@ooples

User Story

As a trader, I want live trading disabled by default so that I don't accidentally execute real trades.

Acceptance Criteria

  • TradeExecutionOptions.EnableLiveTrading default = false
  • All adapters check this flag before submitting real orders
  • Clear warning logged when live trading is enabled
  • Require explicit opt-in: EnableLiveTrading = true
  • Paper trading always allowed regardless of flag
  • Exception thrown if live trade attempted without flag

Safety Layers

  1. Adapter level: UsePaper = true (broker-specific)
  2. Global level: EnableLiveTrading = false (library-wide)
  3. Confirmation: Optional confirmation callback before orders

Usage

.ConfigureAutoTrading(trade => {
    // This will throw if EnableLiveTrading is false
    trade.Alpaca(new AlpacaOptions { UsePaper = false })
        .OnSignal(buySignal)
        .MarketBuy(quantity: 10);
}, new TradeExecutionOptions {
    EnableLiveTrading = true,  // Explicit opt-in required
    ConfirmBeforeOrder = true  // Optional extra safety
});

Dependencies

  • [Epic 7.1] Define IAutoTradeAdapter interface

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