-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create advanced example to fetch orderbook via websocket #9
Comments
i have started working on this one. |
created a board: https://github.com/mschneider/solcpp/projects/1 |
also we are just about to roll out v3.4 from mango side, i was planning to write a simple order book parser for that purpose. lmk if that causes a conflict on your end. |
i am using the mango bowl wss server to subscribe to the data. not sure if the rollout to newer mango version will affect that or not. let me know if you had something else in the mind re this orderbook parsing example. |
yeah, we should probably connect directly to the on-chain data rather then through mango-bowl which does a lot of intermediate processing. i'll try to make a simple example of getting the order book via json rpc. |
here's a rough sketch of the code to parse the order book |
thanks for the rough idea. added lowest asks now https://github.com/papadpickle/solcpp/blob/example_orderbook_subscribe/examples/orderbookSubscribe.cpp still unclear though how to have a websocket subscription to orderbook update instead of the rpc polling. if you have any code somewhere in other projects which wss'es solana, please let me know. |
accountSubscribe is the correct request to implement this, you can either open multiple websockets or subscribe to multiple account updates on the same socket |
makes sense. have added two subscriber objects for bids and asks. 8760e57 |
do you have any specific way to calculate market depth? that is just the volume of orders at $+% right? would be cool if you already have a logic in rust code or some other mango project to look into before i try to reinvent the wheel. that''s the remaining part, everything else is ready at https://github.com/papadpickle/solcpp/tree/example_orderbook_subscribe_sol |
noticed you use |
here is an example in C#:
|
https://github.com/mschneider/solcpp/blob/main/examples/accountSubscribe.cpp is a basic example for how to get the recent fills. We need a more complete example that is able to fetch the orderbook in addition and prints the following to the CLI on every SOL-PERP order book update:
The text was updated successfully, but these errors were encountered: