支持显式止盈止损参考价口径
This commit is contained in:
@@ -554,6 +554,18 @@ impl AdjustedCloseSeries {
|
||||
12,
|
||||
))
|
||||
}
|
||||
|
||||
fn latest_back_adjusted_close(&self, date: NaiveDate) -> Option<f64> {
|
||||
let index = match self.dates.binary_search(&date) {
|
||||
Ok(index) => index,
|
||||
Err(0) => return None,
|
||||
Err(index) => index - 1,
|
||||
};
|
||||
self.back_adjusted_closes
|
||||
.get(index)
|
||||
.copied()
|
||||
.filter(|value| value.is_finite() && *value > 0.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl SymbolPriceSeries {
|
||||
@@ -2429,6 +2441,11 @@ impl DataSet {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn market_latest_back_adjusted_close(&self, date: NaiveDate, symbol: &str) -> Option<f64> {
|
||||
self.adjusted_close_series(symbol)
|
||||
.and_then(|series| series.latest_back_adjusted_close(date))
|
||||
}
|
||||
|
||||
pub fn market_decision_numeric_values(
|
||||
&self,
|
||||
date: NaiveDate,
|
||||
|
||||
Reference in New Issue
Block a user