Skip to content

Commit f8c526e

Browse files
author
Jayant Krishnamurthy
committed
minor updates
1 parent d8c915d commit f8c526e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

pyth-sdk/README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,46 @@ This crate is typically used in combination with a platform-specific crate such
55

66
## Usage
77

8-
The Pyth Network SDK has two core data types:
8+
The SDK has two core data types:
99

1010
* `PriceFeed` is a container for all currently-available pricing information about a product (e.g., BTC/USD).
1111
* `Price` represents a price with a degree of uncertainty.
1212

1313
The typical usage of this SDK is to first retrieve a `PriceFeed` for one or more products required by your application.
14-
This step typically uses one of the platform-specific crates referenced above, which provide retrieval methods for specific blockchains.
14+
This step typically uses one of the platform-specific crates (referenced above), which provide retrieval methods for specific blockchains.
1515
Once you have a `PriceFeed`, you can call one of the methods below to get the prices your application needs:
1616

1717
### Get the Current Price
1818

1919
Get the current price of the product from its `PriceFeed`:
2020

2121
```rust
22-
let current_price: Price = price_feed.get_current_price().ok_or(StdError::not_found("Current Price is not available"))?;
22+
let current_price: Price = price_feed.get_current_price().ok_or(StdError::not_found("Current price is not available"))?;
2323
println!("price: ({} +- {}) x 10^{}", current_price.price, current_price.conf, current_price.expo);
2424
```
2525

2626
The price is returned along with a confidence interval that represents the degree of uncertainty in the price.
2727
Both values are represented as fixed-point numbers, `a * 10^e`.
28-
The method will return `None` if the price is not currently available; this can happen for various reasons, e.g., US equities only trade during market hours.
28+
The method will return `None` if the current price is not available.
2929

30-
Please see the [consumer best practices guide](https://docs.pyth.network/consumers/best-practices) for additional recommendations on how to consume Pyth Network prices, such as how to use the confidence interval.
30+
Please see the [consumer best practices guide](https://docs.pyth.network/consumers/best-practices) for additional recommendations on how to consume Pyth Network prices, such as how to use the confidence interval, and what to do if the price is not currently available.
3131

3232
### EMA Price
3333

3434
`PriceFeed` includes an exponentially-weighted moving average (EMA) price that represents a time-average of recent prices.
3535
The EMA price can be retrieved as follows:
3636

3737
```rust
38-
let current_price: Price = price_feed.get_ema_price().ok_or(StdError::not_found("Current Price is not available"))?;
39-
println!("price: ({} +- {}) x 10^{}", current_price.price, current_price.conf, current_price.expo);
38+
let ema_price: Price = price_feed.get_ema_price().ok_or(StdError::not_found("EMA price is not available"))?;
39+
println!("price: ({} +- {}) x 10^{}", ema_price.price, ema_price.conf, ema_price.expo);
4040
```
4141

42-
## Prices
42+
## Manipulating Prices
4343

44-
The `Price` object supports arithmetic operations (e.g., multiplication).
45-
These operations automatically propagate any uncertainty in the inputs into uncertainty in the output.
46-
These operations allow you to combine prices in several useful ways:
44+
The `Price` struct supports arithmetic operations that allow you to combine prices from multiple products.
45+
These operations can be used to price some products that aren't directly listed on Pyth Network:
4746

48-
### Change the Quote Currency
47+
### Non-USD Prices
4948

5049
Most assets listed on Pyth Network are quoted in terms of USD, e.g., the BTC/USD price feed provides the number of dollars per BTC.
5150
However, some applications would like prices in other quote currencies, such as the number of ETH per BTC.

0 commit comments

Comments
 (0)