-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: change raydium provider to query committed blocks instead o…
…f finalized (#648)
- Loading branch information
1 parent
a191f41
commit ef067ce
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Raydium Provider | ||
|
||
The Raydium provider fetches prices from the Raydium dex via JSON-RPC requests to Solana nodes. | ||
|
||
## How It Works | ||
|
||
For each ticker (i.e. RAY/SOL), we query 4 accounts: | ||
|
||
* BaseTokenVault | ||
* QuoteTokenVault | ||
* AMMInfo | ||
* OpenOrders | ||
|
||
To calculate the price, we need to get the base and quote token balances, subtract PNL feels, and add the value of open orders. | ||
|
||
With the above values, we calculate the price by dividing quote / base and multiplying by the scaling factor. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters