You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
println!("{} {} shares of {}", data.execution.side, data.execution.shares, data.contract.symbol);
211
207
} else {
212
-
println!("{:?}", notice);
208
+
println!("{:?}", event);
213
209
}
214
210
}
215
211
}
@@ -259,7 +255,6 @@ Some TWS API calls do not have a unique request ID and are mapped back to the in
259
255
To avoid this issue, you can use a model of one client per thread. This ensures that each client instance handles only its own messages, reducing potential conflicts:
260
256
261
257
```rust
262
-
usestd::sync::Arc;
263
258
usestd::thread;
264
259
265
260
useibapi::contracts::Contract;
@@ -273,7 +268,7 @@ fn main() {
273
268
for (symbol, client_id) insymbols {
274
269
lethandle=thread::spawn(move|| {
275
270
letconnection_url="127.0.0.1:4002";
276
-
letclient=Arc::new(Client::connect(connection_url, client_id).expect("connection to TWS failed!"));
271
+
letclient=Client::connect(connection_url, client_id).expect("connection to TWS failed!");
277
272
278
273
letcontract=Contract::stock(symbol);
279
274
letsubscription=client
@@ -304,29 +299,28 @@ use ibapi::market_data::realtime::{BarSize, WhatToShow};
304
299
useibapi::{Client, Error};
305
300
306
301
fnmain() {
307
-
env_logger::init();
308
-
309
302
letconnection_url="127.0.0.1:4002";
310
303
letclient=Client::connect(connection_url, 100).expect("connection to TWS failed!");
311
304
312
305
letcontract=Contract::stock("AAPL");
313
-
stream_bars(&client, &contract);
314
-
}
315
306
316
-
// Request real-time bars data with 5-second intervals
0 commit comments