pub fn parse_trade_confirmation(xml: &str) -> Result<TradeConfirmationStatement>Expand description
Parse a Trade Confirmation FLEX XML statement
Parses Interactive Brokers Trade Confirmation FLEX XML into a structured Rust type with real-time trade execution data.
§Arguments
xml- XML string from IB FLEX query (Trade Confirmation type)
§Returns
Ok(TradeConfirmationStatement)- Successfully parsed statementErr(ParseError)- Parse error with detailed context
§Errors
Returns ParseError if:
- XML is malformed or invalid
- Required fields are missing
- Date/decimal formats are invalid
§Example
use ib_flex::parse_trade_confirmation;
let xml = std::fs::read_to_string("trade_conf.xml")?;
let statement = parse_trade_confirmation(&xml)?;
println!("Trade executions: {}", statement.trades.items.len());