escwdev / kucoin_rs Goto Github PK
View Code? Open in Web Editor NEWRust KuCoin Cryptocurrency Exchange v2 API Wrapper/SDK
License: MIT License
Rust KuCoin Cryptocurrency Exchange v2 API Wrapper/SDK
License: MIT License
I'm trying to get the websocket code excerpt in the documentation to work; however the following line is throwing an error:
while let Some(msg) = ws.try_next().await? {...
The rust analyzer is saying that there is no method named 'try_next', and after looking through the source, I don't see it either. I guess that I should call poll_next, but at the moment, I'm not sure what the context would be in this case.
Crate name 'kucoin' seems to be available on crates.io. Would you like to rename this crate?
Repository name can remain the same to not clash with other language implementations
First off, just want to say amazing work on this.
I've discovered a bug where a websocket which is subscribed to WSTopic::TradeOrders
crashes when an order is placed via the Kucoin website.
Here is the raw response message (with some private data x
d out):
{
"data":{
"symbol":"VET-USDT",
"orderType":"limit",
"side":"buy",
"orderTime":1607489362287360739,
"size":"44",
"orderId":"xxxxxxxxxxxxxxxxxxxxxxxx",
"filledSize":"0",
"price":"0.0161091",
"type":"open",
"remainSize":"44",
"status":"open",
"ts":1607489362287360739
},
"subject":"orderChange",
"topic":"/spotMarket/tradeOrders",
"channelType":"private",
"type":"message",
"userId":"xxxxxxxxxxxxxxxxxxxxxxxx"
}
The problem is that when the trade is placed from the web UI no clientOid
is present. Deserialization fails with Error: Serde(Error("missing field `clientOid`", line: 1, column: 253))
. Just to check, I placed an order via the API and confirmed that clientOid
is in fact present.
I'm fairly new to Serde and Rust in general but I'll dig around and see if I can find a workable solution.
-d
parse_message
in websocket.rs
fails when parsing a market fill with error Serde(Error("missing field `price`", line: 1, column: 336))
. I placed the order from the web UI, but my guess is that this is an issue with match orders since there's no price associated with the order; only with the match.
Example JSON:
{
"data":{
"symbol":"VET-USDT",
"orderType":"market",
"side":"sell",
"orderId":"5fdxxxxxxxxxxxxxxxxx",
"liquidity":"taker",
"type":"match",
"orderTime":1608101947404986582,
"size":"10",
"filledSize":"10",
"matchPrice":"0.0163897",
"matchSize":"10",
"tradeId":"5fdxxxxxxxxxxxxxxxxx",
"remainSize":"0",
"status":"match",
"ts":1608101947404986582
},
"subject":"orderChange",
"topic":"/spotMarket/tradeOrders",
"channelType":"private",
"type":"message",
"userId":"xxxxxxxxxxxxxxxxx"
}
The underlying libraries required for updating kucoin_rs
to using tokio 1.x are:
The latter two have been updated to support it now, but haven't released those updates yet through cargo
. Updating kucoin_rs
would therefore require using a git
link in Cargo.toml
and I'm worried that could cause breaking issues in the future. So once the versions that include tokio 1.x
support are published to Cargo, it will be integrated into kucoin_rs
.
The only other necessary change will be replacing the deprecated tokio-tls
with tokio-native-tls
and adjusting a few types appropriately in ./src/kraken/websocket.rs
.
I'm going to leave this open until the update is complete.
Does this crate have support for futures?
thiserror implements std::error::Error
so that users don't have to depend on failure crate externally or this library doesn't have to re-export failure
crate.
Another reason is thiserror
has become a defacto crate for error handling in rust and hence might provide better interoperability with other crates
I'll send a PR if this sounds good to you
I noticed that you have write the kucoin api the node, and why do you rewrite it with rust? Just for fun or any necessity? And the performance of node is enough for high frequency trading?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.