1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Lightstreamer streaming client for the IG Markets API.
//!
//! This module is guarded by the `stream` Cargo feature. Enable it in
//! `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! trading-ig = { version = "...", features = ["stream"] }
//! ```
//!
//! # Quickstart
//!
//! ```no_run
//! # use trading_ig::{IgClient, Environment, Credentials};
//! # async fn run() -> trading_ig::Result<()> {
//! let client = IgClient::builder()
//! .environment(Environment::Demo)
//! .api_key("YOUR_KEY")
//! .credentials(Credentials::password("user", "pass"))
//! .build()?;
//!
//! // v2 login gives CST/XST which Lightstreamer needs directly.
//! client.session().login_v2().await?;
//!
//! let (stream, _events) = client.streaming().connect().await?;
//! let mut rx = stream.subscribe_market("CS.D.GBPUSD.TODAY.IP").await?;
//!
//! while let Some(update) = rx.recv().await {
//! println!("{} bid={:?} offer={:?}", update.epic, update.bid, update.offer);
//! }
//!
//! stream.disconnect().await?;
//! # Ok(()) }
//! ```
pub
pub
pub use ;
pub use ;
pub use ;