Skip to main content

FutOptQuote

Struct FutOptQuote 

Source
pub struct FutOptQuote {
Show 25 fields pub date: String, pub contract_type: Option<String>, pub exchange: Option<String>, pub symbol: String, pub name: Option<String>, pub previous_close: Option<f64>, pub open_price: Option<f64>, pub open_time: Option<i64>, pub high_price: Option<f64>, pub high_time: Option<i64>, pub low_price: Option<f64>, pub low_time: Option<i64>, pub close_price: Option<f64>, pub close_time: Option<i64>, pub last_price: Option<f64>, pub last_size: Option<i64>, pub avg_price: Option<f64>, pub change: Option<f64>, pub change_percent: Option<f64>, pub amplitude: Option<f64>, pub bids: Vec<FutOptPriceLevel>, pub asks: Vec<FutOptPriceLevel>, pub total: Option<FutOptTotalStats>, pub last_trade: Option<FutOptLastTrade>, pub last_updated: Option<i64>,
}
Expand description

Real-time FutOpt quote from Fugle API (futopt/intraday/quote/{symbol})

This matches the official SDK’s RestFutOptIntradayQuoteResponse

§Example

use marketdata_core::models::futopt::FutOptQuote;

let json = r#"{
    "date": "2024-01-15",
    "type": "FUTURE",
    "exchange": "TAIFEX",
    "symbol": "TXFC4",
    "name": "臺股期貨",
    "previousClose": 17500.0,
    "openPrice": 17520.0,
    "openTime": 1705287000000,
    "highPrice": 17580.0,
    "highTime": 1705290600000,
    "lowPrice": 17480.0,
    "lowTime": 1705288800000,
    "closePrice": 17550.0,
    "closeTime": 1705302000000,
    "lastPrice": 17550.0,
    "lastSize": 2,
    "avgPrice": 17530.0,
    "change": 50.0,
    "changePercent": 0.29,
    "amplitude": 0.57,
    "bids": [{"price": 17549.0, "size": 50}],
    "asks": [{"price": 17550.0, "size": 30}],
    "total": {"tradeVolume": 50000, "totalBidMatch": 25000, "totalAskMatch": 25000},
    "lastTrade": {"price": 17550.0, "size": 2, "time": 1705302000000},
    "lastUpdated": 1705302000000
}"#;

let quote: FutOptQuote = serde_json::from_str(json).unwrap();
assert_eq!(quote.symbol, "TXFC4");
assert_eq!(quote.last_price, Some(17550.0));

Fields§

§date: String

Trading date (YYYY-MM-DD)

§contract_type: Option<String>

Contract type (FUTURE or OPTION)

§exchange: Option<String>

Exchange code (TAIFEX)

§symbol: String

Contract symbol (e.g., “TXFC4”, “TXO18000C4”)

§name: Option<String>

Contract name

§previous_close: Option<f64>

Previous close price

§open_price: Option<f64>

Open price

§open_time: Option<i64>

Open time (Unix milliseconds)

§high_price: Option<f64>

High price

§high_time: Option<i64>

High time (Unix milliseconds)

§low_price: Option<f64>

Low price

§low_time: Option<i64>

Low time (Unix milliseconds)

§close_price: Option<f64>

Close price

§close_time: Option<i64>

Close time (Unix milliseconds)

§last_price: Option<f64>

Last traded price

§last_size: Option<i64>

Last traded size (number of contracts)

§avg_price: Option<f64>

Average price

§change: Option<f64>

Price change from previous close

§change_percent: Option<f64>

Percentage change from previous close

§amplitude: Option<f64>

Price amplitude (high - low) / reference price * 100

§bids: Vec<FutOptPriceLevel>

Bid price levels (best to worst)

§asks: Vec<FutOptPriceLevel>

Ask price levels (best to worst)

§total: Option<FutOptTotalStats>

Total trading statistics

§last_trade: Option<FutOptLastTrade>

Last trade information

§last_updated: Option<i64>

Last updated timestamp (Unix milliseconds)

Implementations§

Source§

impl FutOptQuote

Source

pub fn spread(&self) -> Option<f64>

Get the bid-ask spread

Source

pub fn mid_price(&self) -> Option<f64>

Get the mid price between best bid and ask

Source

pub fn has_price_data(&self) -> bool

Check if quote has essential price data

Source

pub fn total_volume(&self) -> Option<i64>

Get the total trade volume

Trait Implementations§

Source§

impl Clone for FutOptQuote

Source§

fn clone(&self) -> FutOptQuote

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FutOptQuote

Source§

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

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

impl Default for FutOptQuote

Source§

fn default() -> FutOptQuote

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for FutOptQuote

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<FutOptQuote, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for FutOptQuote

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Serialize for FutOptQuote

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FutOptQuote

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> Same for T

Source§

type Output = T

Should always be Self
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

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,