Closed drbh closed 5 years ago
It depends what you want to match. Are you talking about the last price information in the UI? In that case, you should use current_close field.
let mut web_socket: WebSockets = WebSockets::new(|event: WebsocketEvent| {
match event {
WebsocketEvent::DayTicker(ticker_events) => {
for tick_event in ticker_events {
if tick_event.symbol == "BTCUSDT" {
btcusdt = tick_event.average_price.parse().unwrap();
let btcusdt_close: f32 = tick_event.current_close.parse().unwrap();
println!("{} - {}", btcusdt, btcusdt_close);
}
}
},
_ => return,
}
});
ha silly mistake! I was just reading through the code sample average price
looked strange. Thanks so much. current_close
is exactly what I am looking for!
This is a great project and very useful in a project I'm working on.
However I can't seem to connect to the websocket correctly to get prices that match the web UI's price
I've followed the example code on the README at
WEBSOCKETS - TRADES
But for example - as I'm writing:
How should I change the websocket to get prices that match the UI?