kanekoshoyu / kucoin_arbitrage Goto Github PK
View Code? Open in Web Editor NEWKuCoin Cyclic Arbitrage, using Event-Driven Async Rust
Home Page: https://docs.rs/kucoin_arbitrage
License: MIT License
KuCoin Cyclic Arbitrage, using Event-Driven Async Rust
Home Page: https://docs.rs/kucoin_arbitrage
License: MIT License
[2023-10-28 15:01:18][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] All Taker Chance found!
[2023-10-28 15:01:18][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] TriangularArbitrageChance { profit: OrderedFloat(0.0004159016320031128), actions: [ActionInfo { Buy LINK-USDT at 11.1751 for 4.474200000000001}, ActionInfo { Sell LINK-BTC at 0.00032844 for 4.4697000000000005}, ActionInfo { Sell BTC-USDT at 34127.8 for 0.00146656}] }
[2023-10-28 15:01:18][ERROR][kucoin_arbitrage::broker::order::kucoin] Invalid order size increment LimitOrder { id: "78570f60-1db6-4f81-ad08-3b56633c7b2a", order_type: Limit, side: Buy, symbol: "LINK-USDT", amount: "4.474200000000001", price: "11.1751" }
[2023-10-23 17:39:46][INFO][chaiwala_service] Received [SIGINT] signal
[2023-10-23 17:39:46][INFO][chaiwala_service] received external signal, Good bye!
[2023-10-23 17:39:46][ERROR][kucoin_arbitrage::broker::orderbook::kucoin] Orderbook event publish error, check receiver
[2023-10-23 17:39:46][ERROR][kucoin_arbitrage::broker::orderbook::kucoin] Orderbook event publish error, check receiver
hello
Please explain how to Run this project
[2023-10-30 17:34:33][INFO][kucoin_arbitrage::monitor::task] orderbook : 29601 messages ( 986mps)
[2023-10-30 17:34:33][INFO][kucoin_arbitrage::monitor::task] best_price : 3772 messages ( 125mps)
[2023-10-30 17:34:33][INFO][kucoin_arbitrage::monitor::task] chance : 0 messages ( 0mps)
[2023-10-30 17:34:33][INFO][kucoin_arbitrage::monitor::task] order : 0 messages ( 0mps)
[2023-10-30 17:34:33][INFO][kucoin_arbitrage::monitor::task] trade : 0 messages ( 0mps)
thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value', src/model/orderbook.rs:59:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
core ended first Err(ErrorMessage { msg: "unexpected error [Infrastructure task pool error [Some(Err(JoinError::Panic(Id(17), ...)))]]" })
[2023-10-23 17:53:13][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] time_sent: SystemTime { tv_sec: 1698076393, tv_nsec: 843016101 }
[2023-10-23 17:53:13][ERROR][kucoin_arbitrage::broker::order::kucoin] ErrorMessage { msg: "global timer [order_placement_broadcast] is not found" }
[2023-10-23 17:53:13][INFO][kucoin_arbitrage::broker::order::kucoin] order placement
LimitOrder { id: "MhESL0T33wphLG8OvQS4evTEWFa-oZrAbDPCi7H0", order_type: Limit, side: Buy, symbol: "BCH-USDT", amount: "0.40740000000000004", price: "245.44" }
[2023-10-23 17:53:17][INFO][chaiwala::report::counter] Broadcast channel data rate
[2023-10-23 17:53:17][INFO][chaiwala::report::counter] orderbook : 25482 points ( 5096mps)
[2023-10-23 17:53:17][INFO][chaiwala::report::counter] best_price: 2589 points ( 517mps)
[2023-10-23 17:53:17][INFO][chaiwala::report::counter] chance : 0 points ( 0mps)
[2023-10-23 17:53:17][INFO][chaiwala::report::counter] order : 0 points ( 0mps)
[2023-10-23 17:53:17][INFO][chaiwala::report::counter] orderchange: 0 points ( 0mps)
[2023-10-23 18:22:55][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] All Taker Chance found!
[2023-10-23 18:22:55][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] TriangularArbitrageChance { profit: OrderedFloat(0.016376796710005692), actions: [ActionInfo { Buy BTC-USDT at 30900.1 for 0.00323623}, ActionInfo { Buy HBAR-BTC at 0.000001593 for 2029.5001000000002}, ActionInfo { Sell HBAR-USDT at 0.04938 for 2027.4705000000001}] }
[2023-10-23 18:22:55][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] time_sent: SystemTime { tv_sec: 1698078175, tv_nsec: 779915767 }
[2023-10-23 18:22:55][ERROR][kucoin_arbitrage::broker::order::kucoin] ErrorMessage { msg: "global timer [order_placement_broadcast] is not found" }
[2023-10-23 18:22:55][INFO][kucoin_arbitrage::broker::order::kucoin] order placement
LimitOrder { id: "390KyrWm18SG3nP5ioEk71ZZUB8QvPgy2-mTWcol", order_type: Limit, side: Buy, symbol: "BTC-USDT", amount: "0.00323623", price: "30900.1" }
[2023-10-23 18:23:18][INFO][chaiwala::report::counter] Broadcast channel data rate
[2023-10-23 18:23:18][INFO][chaiwala::report::counter] orderbook : 194488 points ( 3241mps)
[2023-10-23 18:23:18][INFO][chaiwala::report::counter] best_price: 23920 points ( 398mps)
[2023-10-23 18:23:18][INFO][chaiwala::report::counter] chance : 356 points ( 5mps)
[2023-10-23 18:23:18][INFO][chaiwala::report::counter] order : 1 points ( 0mps)
[2023-10-23 18:23:18][INFO][chaiwala::report::counter] orderchange: 0 points ( 0mps)
[2023-10-27 21:57:43][INFO][kucoin_arbitrage::broker::trade::kucoin] TradeMatch [335561405913109708508436045567613047709]
[2023-10-27 21:57:43][INFO][kucoin_arbitrage::broker::order::kucoin] Limit order placement successful [335561405913109708508436045567613047709]
[2023-10-27 21:57:43][INFO][kucoin_arbitrage::broker::trade::kucoin] TradeFilled [335561405913109708508436045567613047709]
[2023-10-27 21:57:48][INFO][kucoin_arbitrage::monitor::task] Broadcast channel MPS
[2023-10-27 21:57:48][INFO][kucoin_arbitrage::monitor::task] order : 1 messages ( 0mps)
[2023-10-27 21:57:48][INFO][kucoin_arbitrage::monitor::task] trade : 2 messages ( 0mps)
[2023-10-27 21:57:58][INFO][kucoin_arbitrage::monitor::task] Broadcast channel MPS
[2023-10-27 21:57:58][INFO][kucoin_arbitrage::monitor::task] order : 1 messages ( 0mps)
[2023-10-27 21:57:58][INFO][kucoin_arbitrage::monitor::task] trade : 0 messages ( 0mps)
[2023-10-27 21:57:58][INFO][kucoin_arbitrage::broker::trade::kucoin] TradeMatch [80848103607579503676599271329919883293]
[2023-10-27 21:57:58][INFO][kucoin_arbitrage::broker::trade::kucoin] TradeFilled [80848103607579503676599271329919883293]
[2023-10-27 21:57:58][INFO][kucoin_arbitrage::broker::order::kucoin] Limit order placement successful [80848103607579503676599271329919883293]
[2023-10-27 21:58:08][INFO][kucoin_arbitrage::monitor::task] Broadcast channel MPS
[2023-10-27 21:58:08][INFO][kucoin_arbitrage::monitor::task] order : 0 messages ( 0mps)
[2023-10-27 21:58:08][INFO][kucoin_arbitrage::monitor::task] trade : 2 messages ( 0mps)
[2023-10-27 21:58:13][INFO][kucoin_arbitrage::broker::trade::kucoin] TradeMatch [295437004754534137248699779684710492288]
[2023-10-27 21:58:13][INFO][kucoin_arbitrage::broker::trade::kucoin] TradeFilled [295437004754534137248699779684710492288]
[2023-10-27 21:58:13][INFO][kucoin_arbitrage::broker::order::kucoin] Limit order placement successful [295437004754534137248699779684710492288]
[2023-10-30 17:44:55][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] All Taker Chance found!
[2023-10-30 17:44:55][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] TriangularArbitrageChance { profit: OrderedFloat(0.024062122741007386), actions: [ActionInfo { Buy FTM-USDT at 0.24025 for 208.1165}, ActionInfo { Sell FTM-BTC at 0.00000703 for 207.9083}, ActionInfo { Sell BTC-USDT at 34294.3 for 0.00146013}] }
[2023-10-30 17:44:55][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] waiting for TradeInfo from KuCoin server
[2023-10-30 17:44:55][INFO][kucoin_arbitrage::broker::trade::kucoin] TradeOpen[37999890520258331277283304113892230095]
[2023-10-30 17:44:55][INFO][kucoin_arbitrage::broker::gatekeeper::kucoin] waiting for TradeInfo from KuCoin server
[2023-10-30 17:44:55][INFO][kucoin_arbitrage::broker::order::kucoin] Limit order placement successful [37999890520258331277283304113892230095]
[2023-10-25 14:40:33][INFO][kucoin_arbitrage::broker::order::kucoin] order_placement_broadcast: 158.196µs
[2023-10-25 14:40:33][INFO][kucoin_arbitrage::broker::order::kucoin] order placement
LimitOrder { id: "13ps68ZRGTOhrqC1irUO3C_qYBlSUwiBX2-EE-ob", order_type: Limit, side: Buy, symbol: "BTC-USDT", amount: "0.001", price: "40000" }
[2023-10-25 14:40:34][INFO][kucoin_arbitrage::broker::orderchange::kucoin] message: WelcomeMsg(DefaultMsg { id: "lthOjqTzii", type: "welcome" })
[2023-10-25 14:40:34][INFO][kucoin_arbitrage::broker::orderchange::kucoin] message: WelcomeMsg(DefaultMsg { id: "1698241234562", type: "ack" })
[2023-10-25 14:40:43][INFO][kucoin_arbitrage::broker::order::kucoin] order_placement_broadcast: 10.001355413s
[2023-10-25 14:40:43][INFO][kucoin_arbitrage::broker::order::kucoin] order placement
LimitOrder { id: "13ps68ZRGTOhrqC1irUO3C_qYBlSUwiBX2-EE-ob", order_type: Limit, side: Buy, symbol: "BTC-USDT", amount: "0.001", price: "40000" }
[2023-10-25 14:40:43][INFO][kucoin_arbitrage::broker::orderchange::kucoin] message: TradeMatchMsg(WSResp { type: "message", topic: "/spotMarket/tradeOrders", subject: "orderChange", data: TradeMatch { symbol: "BTC-USDT", order_type: "limit", side: "buy", liquidity: "taker", type: "match", order_id: "65391adb7877490007663031", order_time: 1698241243615, size: "0.001", filled_size: "0.001", price: "40000", match_price: "34404.8", match_size: "0.001", trade_id: "5665652239777793", client_oid: "13ps68ZRGTOhrqC1irUO3C_qYBlSUwiBX2-EE-ob", remain_size: "0", status: "match", ts: 1698241243630000000 } })
[2023-10-25 14:40:43][INFO][kucoin_arbitrage::broker::orderchange::kucoin] TradeMatchMsg: "/spotMarket/tradeOrders"
TradeMatch {
symbol: "BTC-USDT",
order_type: "limit",
side: "buy",
liquidity: "taker",
type: "match",
order_id: "65391adb7877490007663031",
order_time: 1698241243615,
size: "0.001",
filled_size: "0.001",
price: "40000",
match_price: "34404.8",
match_size: "0.001",
trade_id: "5665652239777793",
client_oid: "13ps68ZRGTOhrqC1irUO3C_qYBlSUwiBX2-EE-ob",
remain_size: "0",
status: "match",
ts: 1698241243630000000,
}
[2023-10-25 14:40:43][INFO][kucoin_arbitrage::broker::orderchange::kucoin] message: TradeFilledMsg(WSResp { type: "message", topic: "/spotMarket/tradeOrders", subject: "orderChange", data: TradeFilled { symbol: "BTC-USDT", order_type: "limit", side: "buy", type: "filled", order_id: "65391adb7877490007663031", order_time: 1698241243615, size: "0.001", filled_size: "0.001", price: "40000", client_oid: "13ps68ZRGTOhrqC1irUO3C_qYBlSUwiBX2-EE-ob", remain_size: "0", status: "done", ts: 1698241243630000000 } })
[2023-10-25 14:40:43][INFO][kucoin_arbitrage::broker::orderchange::kucoin] TradeFilledMsg: "/spotMarket/tradeOrders"
TradeFilled {
symbol: "BTC-USDT",
order_type: "limit",
side: "buy",
type: "filled",
order_id: "65391adb7877490007663031",
order_time: 1698241243615,
size: "0.001",
filled_size: "0.001",
price: "40000",
client_oid: "13ps68ZRGTOhrqC1irUO3C_qYBlSUwiBX2-EE-ob",
remain_size: "0",
status: "done",
ts: 1698241243630000000,
}
thread 'tokio-runtime-worker' panicked at 'Publishing OrderFilled failed: SendError(OrderFilled((0, "TradeFilled { symbol: \"BTC-USDT\", order_type: \"limit\", side: \"buy\", type: \"filled\", order_id: \"65391adb7877490007663031\", order_time: 1698241243615, size: \"0.001\", filled_size: \"0.001\", price: \"40000\", client_oid: \"13ps68ZRGTOhrqC1irUO3C_qYBlSUwiBX2-EE-ob\", remain_size: \"0\", status: \"done\", ts: 1698241243630000000 }")))', /home/sho/Documents/personal/kucoin_arbitrage/src/broker/orderchange/kucoin.rs:46:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
we do not need strings mod if we have a nice struct that does all of it
TriangularArbitrageChance { profit: OrderedFloat(0.025960391571992147), actions: [ActionInfo { Buy EWT-USDT at 1.76 for 28.409000000000002}, ActionInfo { Sell EWT-BTC at 0.00005216 for 28.3805}, ActionInfo { Sell BTC-USDT at 33861.7 for 0.00147884}] }
[2023-10-27 23:37:16][ERROR][kucoin_arbitrage::broker::orderbook::kucoin] Orderbook event publish error, check receiver
core ended first Err(ErrorMessage { msg: "unexpected error [Infrastructure task pool error [Some(Ok(Err(ErrorMessage { msg: \"unrecognised code [\\\"400100\\\"]\" })))]]" })
Good bye!
[2023-10-27 23:37:16][ERROR][kucoin_arbitrage::broker::orderbook::kucoin] Orderbook event publish error, check receiver
[2023-11-23 19:01:55][WARN][kucoin_arbitrage::broker::orderbook::kucoin] orderbook[UQC-USDT] did not respond (101 tries) [HTTP(reqwest::Error { kind: Decode, source: Error("invalid type: null, expected a string", line: 1, column: 49) })]
HTTP request for UQC fails all the time.
After running cargo build
I get following output:
➜ kucoin_arbitrage git:(master) cargo build
Compiling proc-macro2 v1.0.59
Compiling parking_lot v0.12.1
Compiling ahash v0.7.6
Compiling core-foundation v0.9.3
Compiling security-framework-sys v2.9.0
Compiling tempfile v3.5.0
Compiling tracing-core v0.1.31
Compiling percent-encoding v2.2.0
error[E0635]: unknown feature `proc_macro_span_shrink`
--> /home/mimir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.59/src/lib.rs:92:30
|
92 | feature(proc_macro_span, proc_macro_span_shrink)
| ^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0635`.
error: could not compile `proc-macro2` (lib) due to previous
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.