Skip to main content

Module moex

Module moex 

Source
Expand description

The format the broker docs call the Moscow Exchange format: yyyy-MM-dd'T'HH:mm:ss.SSSX.

In the code it is the same text as the main module (UTC, milliseconds, Z). It is a separate module because the order search request names its period fields in this format. Use it with #[serde(with = "...::moex")].

§Examples

use brokapi_bcs_protocol::utils::date_format;
use chrono::{DateTime, TimeZone, Utc};
use serde::Serialize;

#[derive(Serialize)]
struct Period {
    #[serde(with = "date_format::moex")]
    from: DateTime<Utc>,
}

let p = Period { from: Utc.with_ymd_and_hms(2026, 1, 26, 0, 0, 0).unwrap() };
assert_eq!(serde_json::to_string(&p)?, r#"{"from":"2026-01-26T00:00:00.000Z"}"#);

Functions§

deserialize
Reads an RFC 3339 text or the plain YYYY-MM-DDTHH:MM:SS.mmmZ text into a UTC date-time.
serialize
Writes a UTC date-time as 2026-10-19T07:05:00.000Z.