mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-03 02:50:00 -07:00
global: add datasets and charts + fixes
This commit is contained in:
@@ -320,26 +320,25 @@ impl ComputedRatioVecsFromDateIndex {
|
||||
price: &price::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
date_to_price_opt: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
|
||||
price_opt: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
|
||||
) -> Result<()> {
|
||||
let date_to_price = date_to_price_opt.unwrap_or_else(|| unsafe {
|
||||
let closes = price.timeindexes_to_close.dateindex.as_ref().unwrap();
|
||||
|
||||
let price = price_opt.unwrap_or_else(|| unsafe {
|
||||
std::mem::transmute(&self.price.as_ref().unwrap().dateindex)
|
||||
});
|
||||
|
||||
let closes = price.timeindexes_to_close.dateindex.as_ref().unwrap();
|
||||
|
||||
self.ratio.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
let mut price = date_to_price.iter();
|
||||
v.compute_transform(
|
||||
v.compute_transform2(
|
||||
starting_indexes.dateindex,
|
||||
closes,
|
||||
|(i, close, ..)| {
|
||||
let price = price.unwrap_get_inner(i);
|
||||
price,
|
||||
|(i, close, price, ..)| {
|
||||
if price == Dollars::ZERO {
|
||||
(i, StoredF32::from(1.0))
|
||||
} else {
|
||||
@@ -553,7 +552,7 @@ impl ComputedRatioVecsFromDateIndex {
|
||||
None as Option<&EagerVec<_, _>>,
|
||||
)?;
|
||||
|
||||
let date_to_price = date_to_price_opt.unwrap_or_else(|| unsafe {
|
||||
let date_to_price = price_opt.unwrap_or_else(|| unsafe {
|
||||
std::mem::transmute(&self.price.as_ref().unwrap().dateindex)
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user