@@ -92,7 +92,7 @@ pub struct BasicOptionData {
9292
9393#[allow(dead_code)]
9494impl OptionInstrumentPair {
95- fn expiration(&self) -> Option<DateTime<Utc>> {
95+ pub fn expiration(&self) -> Option<DateTime<Utc>> {
9696 let expiration_timestamp = match self.instrument() {
9797 Some(i) => i.expiration_timestamp,
9898 None => return None,
@@ -104,20 +104,19 @@ impl OptionInstrumentPair {
104104 None
105105 }
106106 }
107- fn instrument(&self) -> Option<Instrument> {
107+ pub fn instrument(&self) -> Option<Instrument> {
108108 self.call
109109 .as_ref()
110110 .map(|i| i.instrument.clone())
111111 .or_else(|| self.put.as_ref().map(|i| i.instrument.clone()))
112112 }
113- fn ticker(&self) -> Option<TickerData> {
113+ pub fn ticker(&self) -> Option<TickerData> {
114114 self.call
115115 .as_ref()
116116 .map(|i| i.ticker.clone())
117117 .or_else(|| self.put.as_ref().map(|i| i.ticker.clone()))
118118 }
119-
120- fn volume(&self) -> f64 {
119+ pub fn volume(&self) -> f64 {
121120 let mut volume: f64 = 0.0;
122121 if let Some(call) = &self.call {
123122 volume += call.ticker.stats.volume
@@ -127,8 +126,7 @@ impl OptionInstrumentPair {
127126 }
128127 volume
129128 }
130-
131- fn open_interest(&self) -> f64 {
129+ pub fn open_interest(&self) -> f64 {
132130 let mut open_interest: f64 = 0.0;
133131 if let Some(call) = &self.call {
134132 open_interest += call.ticker.open_interest.unwrap_or(0.0)
@@ -139,7 +137,7 @@ impl OptionInstrumentPair {
139137 open_interest
140138 }
141139
142- fn interest_rate(&self) -> f64 {
140+ pub fn interest_rate(&self) -> f64 {
143141 let mut interest_rate: f64 = 0.0;
144142 if let Some(call) = &self.call {
145143 interest_rate += call.ticker.interest_rate.unwrap_or(0.0)
@@ -150,11 +148,11 @@ impl OptionInstrumentPair {
150148 interest_rate
151149 }
152150
153- fn value(&self) -> Option<Value> {
151+ pub fn value(&self) -> Option<Value> {
154152 serde_json::to_value(self).ok()
155153 }
156154
157- fn call_spread(&self) -> Spread {
155+ pub fn call_spread(&self) -> Spread {
158156 if let Some(call) = &self.call {
159157 let bid = call.ticker.best_bid_price;
160158 let ask = call.ticker.best_ask_price;
@@ -174,7 +172,7 @@ impl OptionInstrumentPair {
174172 }
175173 }
176174
177- fn put_spread(&self) -> Spread {
175+ pub fn put_spread(&self) -> Spread {
178176 if let Some(put) = &self.put {
179177 let bid = put.ticker.best_bid_price;
180178 let ask = put.ticker.best_ask_price;
@@ -194,13 +192,13 @@ impl OptionInstrumentPair {
194192 }
195193 }
196194
197- fn iv(&self) -> (Option<f64>, Option<f64>) {
195+ pub fn iv(&self) -> (Option<f64>, Option<f64>) {
198196 let call_iv = self.call.as_ref().and_then(|c| c.ticker.mark_iv);
199197 let put_iv = self.put.as_ref().and_then(|p| p.ticker.mark_iv);
200198 (call_iv, put_iv)
201199 }
202200
203- fn greeks(&self) -> BasicGreeks {
201+ pub fn greeks(&self) -> BasicGreeks {
204202 let delta_call = self
205203 .call
206204 .as_ref()
@@ -225,7 +223,7 @@ impl OptionInstrumentPair {
225223 }
226224 }
227225
228- fn data(&self) -> BasicOptionData {
226+ pub fn data(&self) -> BasicOptionData {
229227 let strike_price: f64 = match self.instrument() {
230228 Some(i) => i.strike.unwrap_or(0.0),
231229 None => 0.0,
0 commit comments