File tree Expand file tree Collapse file tree 1 file changed +17
-20
lines changed
Expand file tree Collapse file tree 1 file changed +17
-20
lines changed Original file line number Diff line number Diff line change @@ -48,26 +48,23 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4848 info ! ( "Subscribed to {} on {}" , symbol, exchange) ;
4949 }
5050
51- // Inner loop: process until disconnect
52- loop {
53- match handle. subscription_receiver . recv ( ) . await {
54- Ok ( update) => match & update. message {
55- RithmicMessage :: HeartbeatTimeout
56- | RithmicMessage :: ForcedLogout ( _)
57- | RithmicMessage :: ConnectionError => {
58- warn ! ( "Disconnected, reconnecting..." ) ;
59- break ;
60- }
61- RithmicMessage :: LastTrade ( t) => {
62- info ! (
63- "Trade: {} @ {}" ,
64- t. trade_size. unwrap_or( 0 ) ,
65- t. trade_price. unwrap_or( 0.0 )
66- ) ;
67- }
68- _ => { }
69- } ,
70- Err ( _) => break ,
51+ // Process until disconnect
52+ while let Ok ( update) = handle. subscription_receiver . recv ( ) . await {
53+ match & update. message {
54+ RithmicMessage :: HeartbeatTimeout
55+ | RithmicMessage :: ForcedLogout ( _)
56+ | RithmicMessage :: ConnectionError => {
57+ warn ! ( "Disconnected, reconnecting..." ) ;
58+ break ;
59+ }
60+ RithmicMessage :: LastTrade ( t) => {
61+ info ! (
62+ "Trade: {} @ {}" ,
63+ t. trade_size. unwrap_or( 0 ) ,
64+ t. trade_price. unwrap_or( 0.0 )
65+ ) ;
66+ }
67+ _ => { }
7168 }
7269 }
7370
You can’t perform that action at this time.
0 commit comments