pyth-sdk 0.8.0

Data structures and utilites for the Pyth price oracle
Documentation
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "PriceFeed",
  "description": "Represents a current aggregation price from pyth publisher feeds.",
  "type": "object",
  "required": [
    "ema_price",
    "id",
    "price"
  ],
  "properties": {
    "ema_price": {
      "description": "Exponentially-weighted moving average (EMA) price.",
      "allOf": [
        {
          "$ref": "#/definitions/Price"
        }
      ]
    },
    "id": {
      "description": "Unique identifier for this price.",
      "allOf": [
        {
          "$ref": "#/definitions/Identifier"
        }
      ]
    },
    "price": {
      "description": "Price.",
      "allOf": [
        {
          "$ref": "#/definitions/Price"
        }
      ]
    }
  },
  "definitions": {
    "Identifier": {
      "type": "string"
    },
    "Price": {
      "description": "A price with a degree of uncertainty at a certain time, represented as a price +- a confidence interval.\n\nPlease refer to the documentation at https://docs.pyth.network/consumers/best-practices for using this price safely.\n\nThe confidence interval roughly corresponds to the standard error of a normal distribution. Both the price and confidence are stored in a fixed-point numeric representation, `x * 10^expo`, where `expo` is the exponent. For example:\n\n``` use pyth_sdk::Price; Price { price: 12345, conf: 267, expo: -2, publish_time: 100 }; // represents 123.45 +- 2.67 published at UnixTimestamp 100 Price { price: 123, conf: 1, expo: 2,  publish_time: 100 }; // represents 12300 +- 100 published at UnixTimestamp 100 ```\n\n`Price` supports a limited set of mathematical operations. All of these operations will propagate any uncertainty in the arguments into the result. However, the uncertainty in the result may overestimate the true uncertainty (by at most a factor of `sqrt(2)`) due to computational limitations. Furthermore, all of these operations may return `None` if their result cannot be represented within the numeric representation (e.g., the exponent is so small that the price does not fit into an i64). Users of these methods should (1) select their exponents to avoid this problem, and (2) handle the `None` case gracefully.",
      "type": "object",
      "required": [
        "conf",
        "expo",
        "price",
        "publish_time"
      ],
      "properties": {
        "conf": {
          "description": "Confidence interval.",
          "type": "string"
        },
        "expo": {
          "description": "Exponent.",
          "type": "integer",
          "format": "int32"
        },
        "price": {
          "description": "Price.",
          "type": "string"
        },
        "publish_time": {
          "description": "Publish time.",
          "type": "integer",
          "format": "int64"
        }
      }
    }
  }
}