Align jq microcap execution with intraday snapshots
This commit is contained in:
@@ -116,7 +116,10 @@ where
|
||||
self.run_with_progress(|_| {})
|
||||
}
|
||||
|
||||
pub fn run_with_progress<F>(&mut self, mut on_progress: F) -> Result<BacktestResult, BacktestError>
|
||||
pub fn run_with_progress<F>(
|
||||
&mut self,
|
||||
mut on_progress: F,
|
||||
) -> Result<BacktestResult, BacktestError>
|
||||
where
|
||||
F: FnMut(&BacktestDayProgress),
|
||||
{
|
||||
@@ -287,7 +290,9 @@ where
|
||||
) -> BrokerExecutionReport {
|
||||
result.order_events.extend(report.order_events.clone());
|
||||
result.fills.extend(report.fill_events.clone());
|
||||
result.position_events.extend(report.position_events.clone());
|
||||
result
|
||||
.position_events
|
||||
.extend(report.position_events.clone());
|
||||
result.account_events.extend(report.account_events.clone());
|
||||
report
|
||||
}
|
||||
@@ -338,7 +343,11 @@ where
|
||||
});
|
||||
format!(
|
||||
"cash_dividend_receivable {} share_cash={:.6} quantity={} payable_date={} cash={:.2}",
|
||||
action.symbol, action.share_cash, quantity_after, payable_date, cash_delta
|
||||
action.symbol,
|
||||
action.share_cash,
|
||||
quantity_after,
|
||||
payable_date,
|
||||
cash_delta
|
||||
)
|
||||
};
|
||||
notes.push(note.clone());
|
||||
@@ -457,7 +466,10 @@ where
|
||||
let settlement_price = self
|
||||
.data
|
||||
.price_on_or_before(effective_delisted_at, &symbol, PriceField::Close)
|
||||
.or_else(|| self.data.price_on_or_before(date, &symbol, PriceField::Close))
|
||||
.or_else(|| {
|
||||
self.data
|
||||
.price_on_or_before(date, &symbol, PriceField::Close)
|
||||
})
|
||||
.filter(|price| price.is_finite() && *price > 0.0)
|
||||
.unwrap_or(fallback_reference_price);
|
||||
if !settlement_price.is_finite() || settlement_price <= 0.0 {
|
||||
|
||||
Reference in New Issue
Block a user