FixMessage

Struct FixMessage 

Source
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: MessageType

Message 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

Source

pub fn new(message_type: MessageType) -> Self

Create a new FIX message.

Source

pub fn new_order_single( symbol: String, price: f64, quantity: f64, side: String, ) -> Self

Create a New Order Single message (MessageType D).

Source

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.

Source

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.

Source

pub fn set_field(&mut self, tag: u32, value: FieldValue)

Set a field value.

Source

pub fn get_field(&self, tag: u32) -> Option<&FieldValue>

Get a field value.

Source

pub fn remove_field(&mut self, tag: u32) -> Option<FieldValue>

Remove a field.

Source

pub fn has_field(&self, tag: u32) -> bool

Check if field exists.

Source

pub fn field_tags(&self) -> impl Iterator<Item = u32> + '_

Get all field tags.

Source

pub fn with_seq_num(self, seq_num: u32) -> Self

Set sequence number.

Source

pub fn with_sender_comp_id(self, sender_comp_id: String) -> Self

Set sender CompID.

Source

pub fn with_target_comp_id(self, target_comp_id: String) -> Self

Set target CompID.

Source

pub fn with_sending_time(self, sending_time: u64) -> Self

Set sending time.

Source

pub fn validate(&self) -> Result<(), EncodeError>

Validate required fields for the message type.

Source

pub fn estimated_size(&self) -> usize

Calculate approximate message size for buffer pre-allocation.

Trait Implementations§

Source§

impl Clone for FixMessage

Source§

fn clone(&self) -> FixMessage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FixMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for FixMessage

Source§

fn eq(&self, other: &FixMessage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for FixMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V