-
Notifications
You must be signed in to change notification settings - Fork 5
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
Query and store old OpenBook orders into our DB #248
Labels
enhancement
New feature or request
Comments
How to handle different IXs coming through:
Arcana market: https://app.arcana.markets/data/CciLvCtXAkGS5TMKNRDYBPFzfWWL7fwCQi79NRx5kTHz |
Notes on convo with @R-K-H regarding actual trades(takes and makes):
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We want to query these OpenBook programs and store the orders accordingly in our table. There are some functions and classes in the futarchy-indexer repo as well as accompanying tables that could allow this to be done with a lot of the initial setup taken care of.
You can use the
transaction_watchers
table with the Openbook Twap program account to index all transactions from this program. If you set thechecked_up_to_slot
column to 0, it should in theory re-index all of the transactions. You shouldn't get many new txns in the `transactions' table, but you will be able to run any new indexing logic you have built on these transactions.Here are all the program account IDs you want "watch"/query transactions from:
Definitely for staging, you will have to insert records in the
transaction_watchers
table with thechecked_up_to_slot
field at 0 and then set thefirst_tx_sig
tonull
.In the DB, if txns already are in there, you might need to delete those or maybe not.
An unfilled order record can be built from a placeOrder instruction based off the args:
Max Base Lots = unfilled base amount
Price Lots = quotePrice * 10 **6
a following cancelOrderByClientId ix will often let us know that the order is cancelled. BUT this will be tricky. We don't store the clientID of the order... so you might need to figure things out in a roundabout way. You might be able to use the openOrdersAccount pubkey on this tx to find the data you need. Here is an example: https://solscan.io/tx/3JbFRjRfXNNP1FDFE5zK1AwDzfuXw8qRNa8ULR6eSga76Tt46QseUesw2Q2xe2bYjm3z7rcqj1fQzh82pZ6soZaS
This is the openOrdersAccount tied to that txn: https://solscan.io/account/FSBrxyZWoaXGomRH2cyfAjHhfbzDGV9DdD2Q3gK7g2kA
you can find the original placeOrders ix that created the account and that would be able to potentially tell you which order in our orders table you need to update.
Example program account for openbook on devnet: https://explorer.solana.com/address/TWAPrdhADy2aTKN5iFZtNnkQYXERD9NvKjPFVPMSCNN?cluster=devnet
The text was updated successfully, but these errors were encountered: