Skip to content

Commit

Permalink
MOD: Rework live example
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen committed Aug 26, 2024
1 parent 3bcc2e5 commit 7642711
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ async fn main() -> Result<(), Box<dyn Error>> {

let mut symbol_map = PitSymbolMap::new();
// Get the next trade
loop {
let rec = client.next_record().await?.unwrap();
while let Some(rec) = client.next_record().await? {
if let Some(trade) = rec.get::<TradeMsg>() {
let symbol = &symbol_map[trade];
println!("Received trade for {symbol}: {trade:?}");
Expand Down
3 changes: 1 addition & 2 deletions examples/live.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ async fn main() -> Result<(), Box<dyn Error>> {

let mut symbol_map = PitSymbolMap::new();
// Get the next trade
loop {
let rec = client.next_record().await?.unwrap();
while let Some(rec) = client.next_record().await? {
if let Some(trade) = rec.get::<TradeMsg>() {
let symbol = &symbol_map[trade];
println!("Received trade for {symbol}: {trade:?}");
Expand Down

0 comments on commit 7642711

Please sign in to comment.