Close RQAlpha P0-P2 parity gaps
This commit is contained in:
@@ -7,7 +7,10 @@ use std::sync::OnceLock;
|
||||
use chrono::{Datelike, Duration, NaiveDate, NaiveDateTime, NaiveTime};
|
||||
|
||||
use crate::cost::ChinaAShareCostModel;
|
||||
use crate::data::{DailyMarketSnapshot, DataSet, IntradayExecutionQuote, PriceBar, PriceField};
|
||||
use crate::data::{
|
||||
DailyMarketSnapshot, DataSet, DividendRecord, FactorValue, IntradayExecutionQuote, PriceBar,
|
||||
PriceField, SecuritiesMarginRecord, SplitRecord, YieldCurvePoint,
|
||||
};
|
||||
use crate::engine::BacktestError;
|
||||
use crate::events::{FillEvent, OrderEvent, OrderSide, OrderStatus, ProcessEvent};
|
||||
use crate::futures::{FuturesAccountState, FuturesOrderIntent};
|
||||
@@ -601,6 +604,72 @@ impl StrategyContext<'_> {
|
||||
self.data.get_price(symbol, start, end, frequency)
|
||||
}
|
||||
|
||||
pub fn get_dividend(&self, symbol: &str, start: NaiveDate) -> Vec<DividendRecord> {
|
||||
let end = self
|
||||
.data
|
||||
.previous_trading_date(self.execution_date, 1)
|
||||
.unwrap_or(self.execution_date);
|
||||
self.data.get_dividend(symbol, start, end)
|
||||
}
|
||||
|
||||
pub fn get_split(&self, symbol: &str, start: NaiveDate) -> Vec<SplitRecord> {
|
||||
let end = self
|
||||
.data
|
||||
.previous_trading_date(self.execution_date, 1)
|
||||
.unwrap_or(self.execution_date);
|
||||
self.data.get_split(symbol, start, end)
|
||||
}
|
||||
|
||||
pub fn get_factor(
|
||||
&self,
|
||||
symbol: &str,
|
||||
start: NaiveDate,
|
||||
end: NaiveDate,
|
||||
field: &str,
|
||||
) -> Vec<FactorValue> {
|
||||
self.data.get_factor(symbol, start, end, field)
|
||||
}
|
||||
|
||||
pub fn get_yield_curve(
|
||||
&self,
|
||||
start: NaiveDate,
|
||||
end: NaiveDate,
|
||||
tenor: Option<&str>,
|
||||
) -> Vec<YieldCurvePoint> {
|
||||
self.data.get_yield_curve(start, end, tenor)
|
||||
}
|
||||
|
||||
pub fn get_margin_stocks(&self, margin_type: &str) -> Vec<String> {
|
||||
self.data
|
||||
.get_margin_stocks(self.execution_date, margin_type)
|
||||
}
|
||||
|
||||
pub fn get_securities_margin(
|
||||
&self,
|
||||
symbol: &str,
|
||||
start: NaiveDate,
|
||||
end: NaiveDate,
|
||||
field: &str,
|
||||
) -> Vec<SecuritiesMarginRecord> {
|
||||
self.data.get_securities_margin(symbol, start, end, field)
|
||||
}
|
||||
|
||||
pub fn get_dominant_future(&self, underlying_symbol: &str) -> Option<String> {
|
||||
self.data
|
||||
.get_dominant_future(underlying_symbol, self.execution_date)
|
||||
}
|
||||
|
||||
pub fn get_dominant_future_price(
|
||||
&self,
|
||||
underlying_symbol: &str,
|
||||
start: NaiveDate,
|
||||
end: NaiveDate,
|
||||
frequency: &str,
|
||||
) -> Vec<PriceBar> {
|
||||
self.data
|
||||
.get_dominant_future_price(underlying_symbol, start, end, frequency)
|
||||
}
|
||||
|
||||
pub fn has_subscriptions(&self) -> bool {
|
||||
!self.subscriptions.is_empty()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user