Getting prices from the Connect oracle
x/prices
).
These prices are updated on a per-block basis when there is a sufficient delta from the last block’s price. They can be accessed natively by CosmWasm smart contracts, other modules, or those with access to chain state.
Connect’s market configuration is stored in the x/marketmap. This module, unlike x/oracle
, does not store price data. Instead, it stores which currency pairs are supported and how they are configured.
curl http://localhost:1317/connect/marketmap/v2/marketmap
appd q marketmap marketmap
grpcurl -plaintext localhost:9090 connect.marketmap.v2.Query/MarketMap
curl http://localhost:1317/connect/oracle/v2/get_prices
grpcurl -plaintext localhost:9090 connect.oracle.v2.Query/GetPrices
appd q oracle currency-pairs
appd q oracle price [base] [quote]
getPrices
via the above methods, you are returned an array of GetPriceResponse
, each of which contains the following metadata about individual prices:
QuotePrice
GetPriceResponse
looks like this:
QuotePrice
, you can fetch for the currency-pair:
QuotePrice
looks like this: