akenshaw / iced-trade

Cross-platform desktop app visualizing basic orderflow in crypto markets
GNU General Public License v3.0
27 stars 6 forks source link

Charts freeze and wrong time #18

Closed 7jrxt42BxFZo4iAnN4CX closed 1 month ago

7jrxt42BxFZo4iAnN4CX commented 1 month ago

After some time, all the charts freeze except Candlestick. How can I display debug logs?

And also on footprint and candlestick the time is UTC, but on heatmap and time&sales UTC+5-6 (this is not my time zone).

№1

Screenshot_20240918_211330

№2

Screenshot_20240918_212831

akenshaw commented 1 month ago

Time zones for heatmap and time&sales are also in UTC, but their formatting is different. They are showing "minutes:seconds.milliseconds". I do see how it can create confusion though, might need to find ways to clarify this

There should be a log file named "output.log", which is either in the root directory, where the src folder is, or inside the target directory. I need more details on reproducing "charts freezing" though. Are you able to pan/zoom around on those charts after the freeze? Can you check that log file and see if an "ERROR" or "WARN" logs on loop?

7jrxt42BxFZo4iAnN4CX commented 1 month ago

yes, my mistake, the time is correct. Could pan/zoom all graphs.

6 hours passed and I started it again and suddenly everything works fine. Perhaps there was something on the binance side or with the network.

p.s. I don’t know yet whether I’ll use it, I was just looking for projects with graphics in Rust.

output.log

21:23:53.194:INFO [/home/f2/.cargo/git/checkouts/iced-f01cba4d5e61fd0a/169667e/wgpu/src/window/compositor.rs:137] -- Selected format: Bgra8UnormSrgb with alpha mode: PreMultiplied 21:23:53.318:WARN [/home/f2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fontdb-0.16.2/src/lib.rs:241] -- Failed to load a font face 0 from '/usr/local/share/fonts/ProgrammingFonts-2.0.0/DEC-Terminal-Modern/_decterm.ttf' cause font doesn't have a family name. 21:23:53.339:WARN [/home/f2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fontdb-0.16.2/src/lib.rs:241] -- Failed to load a font face 0 from '/usr/local/share/fonts/ProgrammingFonts-2.0.0/DEC-Terminal-Modern/_decterm.ttf' cause font doesn't have a family name. 21:23:54.699:INFO [src/main.rs:240] -- a stream connected to Binance WS: Connection 21:23:57.670:INFO [src/main.rs:240] -- a stream connected to Binance WS: Connection 21:24:45.734:INFO [src/main.rs:243] -- a stream disconnected from Binance WS: "Error reading frame: Unexpected EOF" 21:24:47.250:INFO [src/main.rs:240] -- a stream connected to Binance WS: Connection 21:24:47.416:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... 21:24:47.416:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... ..................... 21:26:06.727:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... 21:26:06.727:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... 21:26:06.727:INFO [src/main.rs:243] -- a stream disconnected from Binance WS: "Error reading frame: Unexpected EOF" 21:26:11.812:INFO [src/main.rs:240] -- a stream connected to Binance WS: Connection 21:26:13.454:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... 21:26:13.714:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... ..................... 21:28:03.376:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... 21:28:03.376:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... 21:28:03.376:INFO [src/main.rs:243] -- a stream disconnected from Binance WS: "Error reading frame: Unexpected EOF" 21:28:06.897:INFO [src/main.rs:240] -- a stream connected to Binance WS: Connection 21:28:09.161:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... 21:28:09.421:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... ..................... 21:28:38.751:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... 21:28:38.751:ERROR [src/data_providers/binance/market_data.rs:500] -- Out of sync... 21:28:39.162:INFO [src/main.rs:362] -- Successfully wrote layout state to dashboard_state.json

akenshaw commented 1 month ago

indeed, it seems like a network condition problem. Looks like websocket instance was dropping some orderbook update packages, which was making the newer updates being in desync from the local orderbook. If this was a very rare occasion, like it only happened once or in a specific time, it probably caused by the exchange itself is my guess

Streaming orderbook with reasonable levels from Binance is a bit tricky, we have to be in-sync the whole way, or we have to fetch 1000 bid ask levels from the rest api all over again, while trying to sync it with the data coming from websocket. Further looking at it, i've realized that it is actually missing some "self-healing" steps while trying to maintain the sync on situations where packages dropped. So thanks for bringing up this issue!

akenshaw commented 1 month ago

0776c9f43daee5bb4288664d10d8e38e7e9dffd1 should be fixing this issue