pub struct FixMessage {
pub message_type: MessageType,
pub fields: HashMap<u32, FieldValue>,
pub seq_num: Option<u32>,
pub sender_comp_id: Option<String>,
pub target_comp_id: Option<String>,
pub sending_time: Option<u64>,
}Expand description
FIX message representation optimized for Protocol Buffers encoding.
Fields§
§message_type: MessageTypeMessage type
fields: HashMap<u32, FieldValue>FIX fields as tag-value pairs
seq_num: Option<u32>Sequence number
sender_comp_id: Option<String>Sender CompID
target_comp_id: Option<String>Target CompID
sending_time: Option<u64>Sending timestamp (nanoseconds since epoch)
Implementations§
Source§impl FixMessage
impl FixMessage
Sourcepub fn new(message_type: MessageType) -> Self
pub fn new(message_type: MessageType) -> Self
Create a new FIX message.
Sourcepub fn new_order_single(
symbol: String,
price: f64,
quantity: f64,
side: String,
) -> Self
pub fn new_order_single( symbol: String, price: f64, quantity: f64, side: String, ) -> Self
Create a New Order Single message (MessageType D).
Sourcepub fn execution_report(
order_id: String,
exec_id: String,
exec_type: String,
ord_status: String,
symbol: String,
side: String,
exec_qty: f64,
exec_price: f64,
) -> Self
pub fn execution_report( order_id: String, exec_id: String, exec_type: String, ord_status: String, symbol: String, side: String, exec_qty: f64, exec_price: f64, ) -> Self
Create an Execution Report message.
Sourcepub fn market_data_request(
md_req_id: String,
subscription_type: String,
market_depth: u32,
symbols: Vec<String>,
) -> Self
pub fn market_data_request( md_req_id: String, subscription_type: String, market_depth: u32, symbols: Vec<String>, ) -> Self
Create a Market Data Request message.
Sourcepub fn set_field(&mut self, tag: u32, value: FieldValue)
pub fn set_field(&mut self, tag: u32, value: FieldValue)
Set a field value.
Sourcepub fn get_field(&self, tag: u32) -> Option<&FieldValue>
pub fn get_field(&self, tag: u32) -> Option<&FieldValue>
Get a field value.
Sourcepub fn remove_field(&mut self, tag: u32) -> Option<FieldValue>
pub fn remove_field(&mut self, tag: u32) -> Option<FieldValue>
Remove a field.
Get all field tags.
Sourcepub fn with_seq_num(self, seq_num: u32) -> Self
pub fn with_seq_num(self, seq_num: u32) -> Self
Set sequence number.
Sourcepub fn with_sender_comp_id(self, sender_comp_id: String) -> Self
pub fn with_sender_comp_id(self, sender_comp_id: String) -> Self
Set sender CompID.
Sourcepub fn with_target_comp_id(self, target_comp_id: String) -> Self
pub fn with_target_comp_id(self, target_comp_id: String) -> Self
Set target CompID.
Sourcepub fn with_sending_time(self, sending_time: u64) -> Self
pub fn with_sending_time(self, sending_time: u64) -> Self
Set sending time.
Sourcepub fn validate(&self) -> Result<(), EncodeError>
pub fn validate(&self) -> Result<(), EncodeError>
Validate required fields for the message type.
Sourcepub fn estimated_size(&self) -> usize
pub fn estimated_size(&self) -> usize
Calculate approximate message size for buffer pre-allocation.
Trait Implementations§
Source§impl Clone for FixMessage
impl Clone for FixMessage
Source§fn clone(&self) -> FixMessage
fn clone(&self) -> FixMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FixMessage
impl Debug for FixMessage
Source§impl PartialEq for FixMessage
impl PartialEq for FixMessage
impl StructuralPartialEq for FixMessage
Auto Trait Implementations§
impl Freeze for FixMessage
impl RefUnwindSafe for FixMessage
impl Send for FixMessage
impl Sync for FixMessage
impl Unpin for FixMessage
impl UnwindSafe for FixMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more