pub fn map_trading_status(
ticker: &str,
class_code: &str,
resp: &TradingStatusResponse,
) -> TradingStatusExpand description
Maps the trading status of a board.
OPEN is [TradingAvailability::Open], CLOSE is Closed (any letter case), any other text is
Unknown. The reason is the session type text from the broker. The status carries no timestamp.
§Examples
use brokapi_bcs_protocol::http::models::TradingStatusResponse;
use brokapi_bcs::map::instrument::map_trading_status;
use brokapi_core::TradingAvailability;
let resp: TradingStatusResponse = serde_json::from_str(
r#"{"tradingSessionTypeId":1,"tradingSessionType":"Main","tradingSessionStatus":"OPEN",
"nextSessionDate":"2026-10-20T07:00:00Z"}"#,
)
.unwrap();
let status = map_trading_status("SBER", "TQBR", &resp);
assert_eq!(status.availability, TradingAvailability::Open);