use std::fmt;
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[derive(Debug, PartialEq, Default)]
pub enum TickType {
#[default]
Unknown = -1,
BidSize = 0,
Bid = 1,
Ask = 2,
AskSize = 3,
Last = 4,
LastSize = 5,
High = 6,
Low = 7,
Volume = 8,
Close = 9,
BidOption = 10,
AskOption = 11,
LastOption = 12,
ModelOption = 13,
Open = 14,
Low13Week = 15,
High13Week = 16,
Low26Week = 17,
High26Week = 18,
Low52Week = 19,
High52Week = 20,
AvgVolume = 21,
OpenInterest = 22,
OptionHistoricalVol = 23,
OptionImpliedVol = 24,
OptionBidExch = 25,
OptionAskExch = 26,
OptionCallOpenInterest = 27,
OptionPutOpenInterest = 28,
OptionCallVolume = 29,
OptionPutVolume = 30,
IndexFuturePremium = 31,
BidExch = 32,
AskExch = 33,
AuctionVolume = 34,
AuctionPrice = 35,
AuctionImbalance = 36,
MarkPrice = 37,
BidEfpComputation = 38,
AskEfpComputation = 39,
LastEfpComputation = 40,
OpenEfpComputation = 41,
HighEfpComputation = 42,
LowEfpComputation = 43,
CloseEfpComputation = 44,
LastTimestamp = 45,
Shortable = 46,
RtVolume = 48,
Halted = 49,
BidYield = 50,
AskYield = 51,
LastYield = 52,
CustOptionComputation = 53,
TradeCount = 54,
TradeRate = 55,
VolumeRate = 56,
LastRthTrade = 57,
RtHistoricalVol = 58,
IbDividends = 59,
BondFactorMultiplier = 60,
RegulatoryImbalance = 61,
NewsTick = 62,
ShortTermVolume3Min = 63,
ShortTermVolume5Min = 64,
ShortTermVolume10Min = 65,
DelayedBid = 66,
DelayedAsk = 67,
DelayedLast = 68,
DelayedBidSize = 69,
DelayedAskSize = 70,
DelayedLastSize = 71,
DelayedHigh = 72,
DelayedLow = 73,
DelayedVolume = 74,
DelayedClose = 75,
DelayedOpen = 76,
RtTrdVolume = 77,
CreditmanMarkPrice = 78,
CreditmanSlowMarkPrice = 79,
DelayedBidOption = 80,
DelayedAskOption = 81,
DelayedLastOption = 82,
DelayedModelOption = 83,
LastExch = 84,
LastRegTime = 85,
FuturesOpenInterest = 86,
AvgOptVolume = 87,
DelayedLastTimestamp = 88,
ShortableShares = 89,
DelayedHalted = 90,
Reuters2MutualFunds = 91,
EtfNavClose = 92,
EtfNavPriorClose = 93,
EtfNavBid = 94,
EtfNavAsk = 95,
EtfNavLast = 96,
EtfFrozenNavLast = 97,
EtfNavHigh = 98,
EtfNavLow = 99,
SocialMarketAnalytics = 100,
EstimatedIpoMidpoint = 101,
FinalIpoLast = 102,
DelayedYieldBid = 103,
DelayedYieldAsk = 104,
OddLotBid = 105,
OddLotAsk = 106,
OddLotBidSize = 107,
OddLotAskSize = 108,
OddLotBidExch = 109,
OddLotAskExch = 110,
}
impl From<i32> for TickType {
fn from(value: i32) -> Self {
match value {
-1 => Self::Unknown,
0 => Self::BidSize,
1 => Self::Bid,
2 => Self::Ask,
3 => Self::AskSize,
4 => Self::Last,
5 => Self::LastSize,
6 => Self::High,
7 => Self::Low,
8 => Self::Volume,
9 => Self::Close,
10 => Self::BidOption,
11 => Self::AskOption,
12 => Self::LastOption,
13 => Self::ModelOption,
14 => Self::Open,
15 => Self::Low13Week,
16 => Self::High13Week,
17 => Self::Low26Week,
18 => Self::High26Week,
19 => Self::Low52Week,
20 => Self::High52Week,
21 => Self::AvgVolume,
22 => Self::OpenInterest,
23 => Self::OptionHistoricalVol,
24 => Self::OptionImpliedVol,
25 => Self::OptionBidExch,
26 => Self::OptionAskExch,
27 => Self::OptionCallOpenInterest,
28 => Self::OptionPutOpenInterest,
29 => Self::OptionCallVolume,
30 => Self::OptionPutVolume,
31 => Self::IndexFuturePremium,
32 => Self::BidExch,
33 => Self::AskExch,
34 => Self::AuctionVolume,
35 => Self::AuctionPrice,
36 => Self::AuctionImbalance,
37 => Self::MarkPrice,
38 => Self::BidEfpComputation,
39 => Self::AskEfpComputation,
40 => Self::LastEfpComputation,
41 => Self::OpenEfpComputation,
42 => Self::HighEfpComputation,
43 => Self::LowEfpComputation,
44 => Self::CloseEfpComputation,
45 => Self::LastTimestamp,
46 => Self::Shortable,
48 => Self::RtVolume,
49 => Self::Halted,
50 => Self::BidYield,
51 => Self::AskYield,
52 => Self::LastYield,
53 => Self::CustOptionComputation,
54 => Self::TradeCount,
55 => Self::TradeRate,
56 => Self::VolumeRate,
57 => Self::LastRthTrade,
58 => Self::RtHistoricalVol,
59 => Self::IbDividends,
60 => Self::BondFactorMultiplier,
61 => Self::RegulatoryImbalance,
62 => Self::NewsTick,
63 => Self::ShortTermVolume3Min,
64 => Self::ShortTermVolume5Min,
65 => Self::ShortTermVolume10Min,
66 => Self::DelayedBid,
67 => Self::DelayedAsk,
68 => Self::DelayedLast,
69 => Self::DelayedBidSize,
70 => Self::DelayedAskSize,
71 => Self::DelayedLastSize,
72 => Self::DelayedHigh,
73 => Self::DelayedLow,
74 => Self::DelayedVolume,
75 => Self::DelayedClose,
76 => Self::DelayedOpen,
77 => Self::RtTrdVolume,
78 => Self::CreditmanMarkPrice,
79 => Self::CreditmanSlowMarkPrice,
80 => Self::DelayedBidOption,
81 => Self::DelayedAskOption,
82 => Self::DelayedLastOption,
83 => Self::DelayedModelOption,
84 => Self::LastExch,
85 => Self::LastRegTime,
86 => Self::FuturesOpenInterest,
87 => Self::AvgOptVolume,
88 => Self::DelayedLastTimestamp,
89 => Self::ShortableShares,
90 => Self::DelayedHalted,
91 => Self::Reuters2MutualFunds,
92 => Self::EtfNavClose,
93 => Self::EtfNavPriorClose,
94 => Self::EtfNavBid,
95 => Self::EtfNavAsk,
96 => Self::EtfNavLast,
97 => Self::EtfFrozenNavLast,
98 => Self::EtfNavHigh,
99 => Self::EtfNavLow,
100 => Self::SocialMarketAnalytics,
101 => Self::EstimatedIpoMidpoint,
102 => Self::FinalIpoLast,
103 => Self::DelayedYieldBid,
104 => Self::DelayedYieldAsk,
105 => Self::OddLotBid,
106 => Self::OddLotAsk,
107 => Self::OddLotBidSize,
108 => Self::OddLotAskSize,
109 => Self::OddLotBidExch,
110 => Self::OddLotAskExch,
_ => Self::Unknown,
}
}
}
impl From<&str> for TickType {
fn from(value: &str) -> Self {
match value {
"bidSize" => Self::BidSize,
"bidPrice" => Self::Bid,
"askPrice" => Self::Ask,
"askSize" => Self::AskSize,
"lastPrice" => Self::Last,
"lastSize" => Self::LastSize,
"high" => Self::High,
"low" => Self::Low,
"volume" => Self::Volume,
"close" => Self::Close,
"bidOptComp" => Self::BidOption,
"askOptComp" => Self::AskOption,
"lastOptComp" => Self::LastOption,
"modelOptComp" => Self::ModelOption,
"open" => Self::Open,
"13WeekLow" => Self::Low13Week,
"13WeekHigh" => Self::High13Week,
"26WeekLow" => Self::Low26Week,
"26WeekHigh" => Self::High26Week,
"52WeekLow" => Self::Low52Week,
"52WeekHigh" => Self::High52Week,
"AvgVolume" => Self::AvgVolume,
"OpenInterest" => Self::OpenInterest,
"OptionHistoricalVolatility" => Self::OptionHistoricalVol,
"OptionImpliedVolatility" => Self::OptionImpliedVol,
"OptionBidExchStr" => Self::OptionBidExch,
"OptionAskExchStr" => Self::OptionAskExch,
"OptionCallOpenInterest" => Self::OptionCallOpenInterest,
"OptionPutOpenInterest" => Self::OptionPutOpenInterest,
"OptionCallVolume" => Self::OptionCallVolume,
"OptionPutVolume" => Self::OptionPutVolume,
"IndexFuturePremium" => Self::IndexFuturePremium,
"bidExch" => Self::BidExch,
"askExch" => Self::AskExch,
"auctionVolume" => Self::AuctionVolume,
"auctionPrice" => Self::AuctionPrice,
"auctionImbalance" => Self::AuctionImbalance,
"markPrice" => Self::MarkPrice,
"bidEFP" => Self::BidEfpComputation,
"askEFP" => Self::AskEfpComputation,
"lastEFP" => Self::LastEfpComputation,
"openEFP" => Self::OpenEfpComputation,
"highEFP" => Self::HighEfpComputation,
"lowEFP" => Self::LowEfpComputation,
"closeEFP" => Self::CloseEfpComputation,
"lastTimestamp" => Self::LastTimestamp,
"shortable" => Self::Shortable,
"RTVolume" => Self::RtVolume,
"halted" => Self::Halted,
"bidYield" => Self::BidYield,
"askYield" => Self::AskYield,
"lastYield" => Self::LastYield,
"custOptComp" => Self::CustOptionComputation,
"trades" => Self::TradeCount,
"trades/min" => Self::TradeRate,
"volume/min" => Self::VolumeRate,
"lastRTHTrade" => Self::LastRthTrade,
"RTHistoricalVol" => Self::RtHistoricalVol,
"IBDividends" => Self::IbDividends,
"bondFactorMultiplier" => Self::BondFactorMultiplier,
"regulatoryImbalance" => Self::RegulatoryImbalance,
"newsTick" => Self::NewsTick,
"shortTermVolume3Min" => Self::ShortTermVolume3Min,
"shortTermVolume5Min" => Self::ShortTermVolume5Min,
"shortTermVolume10Min" => Self::ShortTermVolume10Min,
"delayedBid" => Self::DelayedBid,
"delayedAsk" => Self::DelayedAsk,
"delayedLast" => Self::DelayedLast,
"delayedBidSize" => Self::DelayedBidSize,
"delayedAskSize" => Self::DelayedAskSize,
"delayedLastSize" => Self::DelayedLastSize,
"delayedHigh" => Self::DelayedHigh,
"delayedLow" => Self::DelayedLow,
"delayedVolume" => Self::DelayedVolume,
"delayedClose" => Self::DelayedClose,
"delayedOpen" => Self::DelayedOpen,
"rtTrdVolume" => Self::RtTrdVolume,
"creditmanMarkPrice" => Self::CreditmanMarkPrice,
"creditmanSlowMarkPrice" => Self::CreditmanSlowMarkPrice,
"delayedBidOptComp" => Self::DelayedBidOption,
"delayedAskOptComp" => Self::DelayedAskOption,
"delayedLastOptComp" => Self::DelayedLastOption,
"delayedModelOptComp" => Self::DelayedModelOption,
"lastExchange" => Self::LastExch,
"lastRegTime" => Self::LastRegTime,
"futuresOpenInterest" => Self::FuturesOpenInterest,
"avgOptVolume" => Self::AvgOptVolume,
"delayedLastTimestamp" => Self::DelayedLastTimestamp,
"shortableShares" => Self::ShortableShares,
"delayedHalted" => Self::DelayedHalted,
"reuters2MutualFunds" => Self::Reuters2MutualFunds,
"etfNavClose" => Self::EtfNavClose,
"etfNavPriorClose" => Self::EtfNavPriorClose,
"etfNavBid" => Self::EtfNavBid,
"etfNavAsk" => Self::EtfNavAsk,
"etfNavLast" => Self::EtfNavLast,
"etfFrozenNavLast" => Self::EtfFrozenNavLast,
"etfNavHigh" => Self::EtfNavHigh,
"etfNavLow" => Self::EtfNavLow,
"socialMarketAnalytics" => Self::SocialMarketAnalytics,
"estimatedIPOMidpoint" => Self::EstimatedIpoMidpoint,
"finalIPOLast" => Self::FinalIpoLast,
"delayedYieldBid" => Self::DelayedYieldBid,
"delayedYieldAsk" => Self::DelayedYieldAsk,
"oddLotBid" => Self::OddLotBid,
"oddLotAsk" => Self::OddLotAsk,
"oddLotBidSize" => Self::OddLotBidSize,
"oddLotAskSize" => Self::OddLotAskSize,
"oddLotBidExch" => Self::OddLotBidExch,
"oddLotAskExch" => Self::OddLotAskExch,
_ => Self::Unknown,
}
}
}
impl fmt::Display for TickType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Unknown => write!(f, "Unknown"),
Self::BidSize => write!(f, "Bid Size"),
Self::Bid => write!(f, "Bid"),
Self::Ask => write!(f, "Ask"),
Self::AskSize => write!(f, "Ask Size"),
Self::Last => write!(f, "Last"),
Self::LastSize => write!(f, "Last Size"),
Self::High => write!(f, "High"),
Self::Low => write!(f, "Low"),
Self::Volume => write!(f, "Volume"),
Self::Close => write!(f, "Close"),
Self::BidOption => write!(f, "Bid Option"),
Self::AskOption => write!(f, "Ask Option"),
Self::LastOption => write!(f, "Last Option"),
Self::ModelOption => write!(f, "Model Option"),
Self::Open => write!(f, "Open"),
Self::Low13Week => write!(f, "13 Week Low"),
Self::High13Week => write!(f, "13 Week High"),
Self::Low26Week => write!(f, "26 Week Low"),
Self::High26Week => write!(f, "26 Week High"),
Self::Low52Week => write!(f, "52 Week Low"),
Self::High52Week => write!(f, "52 Week High"),
Self::AvgVolume => write!(f, "Average Volume"),
Self::OpenInterest => write!(f, "Open Interest"),
Self::OptionHistoricalVol => write!(f, "Option Historical Volatility"),
Self::OptionImpliedVol => write!(f, "Option Implied Volatility"),
Self::OptionBidExch => write!(f, "Option Bid Exchange"),
Self::OptionAskExch => write!(f, "Option Ask Exchange"),
Self::OptionCallOpenInterest => write!(f, "Option Call Open Interest"),
Self::OptionPutOpenInterest => write!(f, "Option Put Open Interest"),
Self::OptionCallVolume => write!(f, "Option Call Volume"),
Self::OptionPutVolume => write!(f, "Option Put Volume"),
Self::IndexFuturePremium => write!(f, "Index Future Premium"),
Self::BidExch => write!(f, "Bid Exchange"),
Self::AskExch => write!(f, "Ask Exchange"),
Self::AuctionVolume => write!(f, "Auction Volume"),
Self::AuctionPrice => write!(f, "Auction Price"),
Self::AuctionImbalance => write!(f, "Auction Imbalance"),
Self::MarkPrice => write!(f, "Mark Price"),
Self::BidEfpComputation => write!(f, "Bid EFP Computation"),
Self::AskEfpComputation => write!(f, "Ask EFP Computation"),
Self::LastEfpComputation => write!(f, "Last EFP Computation"),
Self::OpenEfpComputation => write!(f, "Open EFP Computation"),
Self::HighEfpComputation => write!(f, "High EFP Computation"),
Self::LowEfpComputation => write!(f, "Low EFP Computation"),
Self::CloseEfpComputation => write!(f, "Close EFP Computation"),
Self::LastTimestamp => write!(f, "Last Timestamp"),
Self::Shortable => write!(f, "Shortable"),
Self::RtVolume => write!(f, "RT Volume"),
Self::Halted => write!(f, "Halted"),
Self::BidYield => write!(f, "Bid Yield"),
Self::AskYield => write!(f, "Ask Yield"),
Self::LastYield => write!(f, "Last Yield"),
Self::CustOptionComputation => write!(f, "Custom Option Computation"),
Self::TradeCount => write!(f, "Trade Count"),
Self::TradeRate => write!(f, "Trade Rate"),
Self::VolumeRate => write!(f, "Volume Rate"),
Self::LastRthTrade => write!(f, "Last RTH Trade"),
Self::RtHistoricalVol => write!(f, "RT Historical Volatility"),
Self::IbDividends => write!(f, "IB Dividends"),
Self::BondFactorMultiplier => write!(f, "Bond Factor Multiplier"),
Self::RegulatoryImbalance => write!(f, "Regulatory Imbalance"),
Self::NewsTick => write!(f, "News Tick"),
Self::ShortTermVolume3Min => write!(f, "Short Term Volume 3 Min"),
Self::ShortTermVolume5Min => write!(f, "Short Term Volume 5 Min"),
Self::ShortTermVolume10Min => write!(f, "Short Term Volume 10 Min"),
Self::DelayedBid => write!(f, "Delayed Bid"),
Self::DelayedAsk => write!(f, "Delayed Ask"),
Self::DelayedLast => write!(f, "Delayed Last"),
Self::DelayedBidSize => write!(f, "Delayed Bid Size"),
Self::DelayedAskSize => write!(f, "Delayed Ask Size"),
Self::DelayedLastSize => write!(f, "Delayed Last Size"),
Self::DelayedHigh => write!(f, "Delayed High"),
Self::DelayedLow => write!(f, "Delayed Low"),
Self::DelayedVolume => write!(f, "Delayed Volume"),
Self::DelayedClose => write!(f, "Delayed Close"),
Self::DelayedOpen => write!(f, "Delayed Open"),
Self::RtTrdVolume => write!(f, "RT Trade Volume"),
Self::CreditmanMarkPrice => write!(f, "Creditman Mark Price"),
Self::CreditmanSlowMarkPrice => write!(f, "Creditman Slow Mark Price"),
Self::DelayedBidOption => write!(f, "Delayed Bid Option"),
Self::DelayedAskOption => write!(f, "Delayed Ask Option"),
Self::DelayedLastOption => write!(f, "Delayed Last Option"),
Self::DelayedModelOption => write!(f, "Delayed Model Option"),
Self::LastExch => write!(f, "Last Exchange"),
Self::LastRegTime => write!(f, "Last Reg Time"),
Self::FuturesOpenInterest => write!(f, "Futures Open Interest"),
Self::AvgOptVolume => write!(f, "Average Option Volume"),
Self::DelayedLastTimestamp => write!(f, "Delayed Last Timestamp"),
Self::ShortableShares => write!(f, "Shortable Shares"),
Self::DelayedHalted => write!(f, "Delayed Halted"),
Self::Reuters2MutualFunds => write!(f, "Reuters2 Mutual Funds"),
Self::EtfNavClose => write!(f, "ETF NAV Close"),
Self::EtfNavPriorClose => write!(f, "ETF NAV Prior Close"),
Self::EtfNavBid => write!(f, "ETF NAV Bid"),
Self::EtfNavAsk => write!(f, "ETF NAV Ask"),
Self::EtfNavLast => write!(f, "ETF NAV Last"),
Self::EtfFrozenNavLast => write!(f, "ETF Frozen NAV Last"),
Self::EtfNavHigh => write!(f, "ETF NAV High"),
Self::EtfNavLow => write!(f, "ETF NAV Low"),
Self::SocialMarketAnalytics => write!(f, "Social Market Analytics"),
Self::EstimatedIpoMidpoint => write!(f, "Estimated IPO Midpoint"),
Self::FinalIpoLast => write!(f, "Final IPO Last"),
Self::DelayedYieldBid => write!(f, "Delayed Yield Bid"),
Self::DelayedYieldAsk => write!(f, "Delayed Yield Ask"),
Self::OddLotBid => write!(f, "Odd Lot Bid"),
Self::OddLotAsk => write!(f, "Odd Lot Ask"),
Self::OddLotBidSize => write!(f, "Odd Lot Bid Size"),
Self::OddLotAskSize => write!(f, "Odd Lot Ask Size"),
Self::OddLotBidExch => write!(f, "Odd Lot Bid Exchange"),
Self::OddLotAskExch => write!(f, "Odd Lot Ask Exchange"),
}
}
}
#[cfg(test)]
#[path = "tick_types_tests.rs"]
mod tests;