Open papadpickle opened 2 years ago
[2022-03-01 20:24:16.874] [info] ============Update============
[2022-03-01 20:24:16.874] [info] Latest trade: 9880
[2022-03-01 20:24:16.874] [info] Bid-Ask 9879-9880
[2022-03-01 20:24:16.874] [info] MidPrice: 9879.5
[2022-03-01 20:24:16.874] [info] Spread: 1.01 bps
[2022-03-01 20:24:16.874] [info] Market depth -2%: 1458616
[2022-03-01 20:24:16.874] [info] Market depth +2%: 950953
output should probably display ui units instead of native units, i'll open a separate ticket for this
tried it locally and the code works well for a few minutes but then one by one the different sockets disconnect. once a single socket disconnects, aggregated data can be invalid (e.g. mid price, after one side of the book stopped updating)
added changes to stop logging and exit in case of problem at any of the wss connections.
re your comment https://github.com/mschneider/solcpp/pull/19#discussion_r817093630:
I have one point about the structure of the code overall: we can refactor the monolithic mango_v3.hpp into individual hpp and cpp files to speed up dev work. Now a single line change at those interfaces forces the recompilation of everything. Since we are anyway creating a static lib, we may as well go with seperate files instead of having one huge hpp. Unless of course you decide to make it a header only lib.
updated the PR with following changes:
this example subscribes to SOL perp market on-chain events for bids, asks and fill. following info is logged at each update of orderbook as well as fill event:
note: in case no fill event received before an orderbook update, the latest trade will be empty. maybe there is a way to get the last traded price(mango-bowl recent trades maybe?), in that case we can add that in future.
snippet:![image](https://user-images.githubusercontent.com/99397192/155863696-7c9a58db-77af-4afc-9a7b-63b8089548fe.png)
additions:
minor improvements: