Fix panic when fetching bars
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -51,8 +51,8 @@ impl Config {
|
||||
.build()
|
||||
.unwrap(),
|
||||
alpaca_rate_limit: RateLimiter::direct(Quota::per_minute(match alpaca_source {
|
||||
Source::Iex => NonZeroU32::new(200).unwrap(),
|
||||
Source::Sip => NonZeroU32::new(1000).unwrap(),
|
||||
Source::Iex => NonZeroU32::new(180).unwrap(),
|
||||
Source::Sip => NonZeroU32::new(900).unwrap(),
|
||||
})),
|
||||
alpaca_historical_offset: Duration::from_secs(match alpaca_source {
|
||||
Source::Iex => 900,
|
||||
|
@@ -91,7 +91,12 @@ pub async fn backfill(
|
||||
break;
|
||||
};
|
||||
|
||||
for bar in response.bars.remove(&asset.symbol).unwrap().unwrap() {
|
||||
for bar in response
|
||||
.bars
|
||||
.remove(&asset.symbol)
|
||||
.unwrap_or_default()
|
||||
.unwrap_or_default()
|
||||
{
|
||||
bars.insert(bar.timestamp, Bar::from((bar, asset.symbol.clone())));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user