Skip to content

Brokers & Datafeeds

AQE keeps execution and market data behind broker/datafeed traits so strategy code can run against the same runtime surface in backtests, paper workflows, and live operation.

AQE currently exposes these concrete runtime integrations:

  • execution brokers: PaperBroker, Mt5Broker
  • datafeeds: YahooFinanceDataFeed, Mt5DataFeed

Start with the focused integration pages:

They are composed through UnifiedBroker, which gives the strategy runtime one consistent broker-facing surface.

aq-engine/src/core/broker/mod.rs
pub trait Broker {
async fn connect(&self) -> Result<bool, BrokerError>;
async fn disconnect(&self) -> Result<bool, BrokerError>;
fn is_connected(&self) -> bool;
fn get_name(&self) -> String;
fn get_account_type(&self) -> Result<AccountType, BrokerError>;
}
pub trait OrderManagementProvider: Broker {
async fn submit_order(&self, insight: Insight) -> Result<Order, BrokerError>;
async fn cancel_order(&self, order_id: &str) -> Result<bool, BrokerError>;
async fn close_position(&self, order_id: &str, qty: f64, price: Option<f64>) -> Result<bool, BrokerError>;
async fn get_account(&self) -> Result<Account, BrokerError>;
fn drain_trade_events(&self) -> Vec<(Order, TradeUpdateEvent)>;
}
aq-engine/src/core/broker/mod.rs
pub trait DataFeed {
async fn connect(&self) -> Result<bool, BrokerError>;
async fn disconnect(&self) -> Result<bool, BrokerError>;
fn is_connected(&self) -> bool;
}
pub trait DataProvider: DataFeed {
async fn get_ticker_info(&self, symbol: &str) -> Result<Asset, BrokerError>;
async fn get_history(
&self,
symbol: &str,
start: DateTime<Utc>,
end: DateTime<Utc>,
time_frame: TimeFrame,
) -> Result<DataFrame, BrokerError>;
async fn get_latest_quote(&self, symbol: &str) -> Result<Quote, BrokerError>;
async fn get_latest_bar(&self, symbol: &str) -> Result<Bar, BrokerError>;
}
let execution = PaperBroker::new(AccountType::Paper, 100_000.0, 1);
let data = YahooFinanceDataFeed::new();
let broker = UnifiedBroker::new_backtest(execution, data);

For live operation, the same pattern applies, but the runtime uses the live path instead of new_backtest(...).

When live sync is enabled, AQE publishes broker/runtime state into session-scoped tables used by AQS:

  • insights
  • strategy_accounts
  • strategy_equity_points
  • strategy_live_metrics
  • strategy_events

That means broker/datafeed behaviour directly shapes what the operator sees in the desktop UI.

  • aq-engine/src/core/broker/mod.rs
  • aq-engine/src/core/broker/types/mod.rs
  • aq-engine/src/core/broker/paper_broker.rs
  • aq-engine/src/core/broker/mt5_broker.rs
  • aq-engine/src/core/broker/data_feeds/yahoo.rs