Serde { error: Error("EOF while parsing a value", line: 1, column: 0), data: "" }
jsoneaday opened this issue · comments
I'm getting this error running the ws_url url of coinbase pro. Any ideas?
`
extern crate coinbase_pro_rs;
extern crate hyper;
extern crate tokio;
use coinbase_pro_rs::{ ASync, Public, WS_URL, structs };
use hyper::rt::Future;
fn main() {
let client: Public = Public::new_with_keep_alive(WS_URL, false);
let btc_usd = client
.get_book::<structs::public::BookRecordL1>("BTC-USD")
.map_err(|err| {
println!("{:?}", err);
})
.and_then(|book| {
println!("BTC-USD: {:?}", book);
Ok(())
});
tokio::run(btc_usd);
}
`
Checking it. Sorry for delay.
@dharric
The problem was that you use WS_URL which is used for subscribtion to different streaming data only: like ticker , level2 or full channels. https://docs.pro.coinbase.com/#websocket-feed
To send API request you should use MAIN_URL or SANDBOX_URL.
extern crate coinbase_pro_rs;
extern crate hyper;
extern crate tokio;
use coinbase_pro_rs::{ASync, Public, SANDBOX_URL, structs};
use hyper::rt::Future;
fn main() {
let client: Public<ASync> = Public::new_with_keep_alive(SANDBOX_URL, false);
let btc_usd = client
.get_book::<structs::public::BookRecordL1>("BTC-USD")
.map_err(|err| {
println!("{:?}", err);
})
.and_then(|book| {
println!("BTC-USD: {:?}", book);
Ok(())
});
tokio::run(btc_usd);
}