Skip to main content

detect_statement_type

Function detect_statement_type 

Source
pub fn detect_statement_type(xml: &str) -> Result<StatementType>
Expand description

Detect FLEX statement type from XML

Examines the XML structure to determine whether it’s an Activity FLEX or Trade Confirmation FLEX statement.

§Arguments

  • xml - XML string from IB FLEX query

§Returns

  • Ok(StatementType) - Detected statement type
  • Err(ParseError) - If type cannot be determined

§Example

use ib_flex::{detect_statement_type, StatementType};

let xml = std::fs::read_to_string("statement.xml")?;

match detect_statement_type(&xml)? {
    StatementType::Activity => println!("Activity FLEX"),
    StatementType::TradeConfirmation => println!("Trade Confirmation"),
}