|
|
@@ -160,14 +160,15 @@ impl Platform for KucoinSwap {
|
|
|
let res_data_json: serde_json::Value = serde_json::from_str(res_data_str).unwrap();
|
|
|
let ticker_info = res_data_json;
|
|
|
let time = (Decimal::from_str(&*ticker_info["ts"].to_string()).unwrap() / dec!(1000000)).floor().to_i64().unwrap();
|
|
|
+
|
|
|
let result = Ticker {
|
|
|
time,
|
|
|
- high: Decimal::from_f64(ticker_info["bestAskPrice"].as_f64().unwrap()).unwrap(),
|
|
|
- low: Decimal::from_f64(ticker_info["bestBidPrice"].as_f64().unwrap()).unwrap(),
|
|
|
- sell: Decimal::from_f64(ticker_info["bestAskPrice"].as_f64().unwrap()).unwrap(),
|
|
|
- buy: Decimal::from_f64(ticker_info["bestBidPrice"].as_f64().unwrap()).unwrap(),
|
|
|
- last: Decimal::from_f64(ticker_info["price"].as_f64().unwrap()).unwrap(),
|
|
|
- volume: Decimal::from_f64(ticker_info["size"].as_f64().unwrap()).unwrap(),
|
|
|
+ high: Decimal::from_str(ticker_info["bestAskPrice"].as_str().unwrap()).unwrap(),
|
|
|
+ low: Decimal::from_str(ticker_info["bestBidPrice"].as_str().unwrap()).unwrap(),
|
|
|
+ sell: Decimal::from_str(ticker_info["bestAskPrice"].as_str().unwrap()).unwrap(),
|
|
|
+ buy: Decimal::from_str(ticker_info["bestBidPrice"].as_str().unwrap()).unwrap(),
|
|
|
+ last: Decimal::from_str(ticker_info["price"].as_str().unwrap()).unwrap(),
|
|
|
+ volume: Decimal::from_str(&ticker_info["size"].to_string()).unwrap(),
|
|
|
};
|
|
|
Ok(result)
|
|
|
} else {
|
|
|
@@ -186,12 +187,12 @@ impl Platform for KucoinSwap {
|
|
|
let time = (Decimal::from_str(&*ticker_info["ts"].to_string()).unwrap() / dec!(1000000)).floor().to_i64().unwrap();
|
|
|
let result = Ticker {
|
|
|
time,
|
|
|
- high: Decimal::from_f64(ticker_info["bestAskPrice"].as_f64().unwrap()).unwrap(),
|
|
|
- low: Decimal::from_f64(ticker_info["bestBidPrice"].as_f64().unwrap()).unwrap(),
|
|
|
- sell: Decimal::from_f64(ticker_info["bestAskPrice"].as_f64().unwrap()).unwrap(),
|
|
|
- buy: Decimal::from_f64(ticker_info["bestBidPrice"].as_f64().unwrap()).unwrap(),
|
|
|
- last: Decimal::from_f64(ticker_info["price"].as_f64().unwrap()).unwrap(),
|
|
|
- volume: Decimal::from_f64(ticker_info["size"].as_f64().unwrap()).unwrap(),
|
|
|
+ high: Decimal::from_str(ticker_info["bestAskPrice"].as_str().unwrap()).unwrap(),
|
|
|
+ low: Decimal::from_str(ticker_info["bestBidPrice"].as_str().unwrap()).unwrap(),
|
|
|
+ sell: Decimal::from_str(ticker_info["bestAskPrice"].as_str().unwrap()).unwrap(),
|
|
|
+ buy: Decimal::from_str(ticker_info["bestBidPrice"].as_str().unwrap()).unwrap(),
|
|
|
+ last: Decimal::from_str(ticker_info["price"].as_str().unwrap()).unwrap(),
|
|
|
+ volume: Decimal::from_str(&ticker_info["size"].to_string()).unwrap(),
|
|
|
};
|
|
|
Ok(result)
|
|
|
} else {
|