|
19 | 19 | "Identifier": {
|
20 | 20 | "type": "string"
|
21 | 21 | },
|
22 |
| - "PriceFeed": { |
23 |
| - "description": "Represents a current aggregation price from pyth publisher feeds.", |
| 22 | + "Price": { |
| 23 | + "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.", |
24 | 24 | "type": "object",
|
25 | 25 | "required": [
|
26 | 26 | "conf",
|
27 |
| - "ema_conf", |
28 |
| - "ema_price", |
29 | 27 | "expo",
|
30 |
| - "id", |
31 |
| - "max_num_publishers", |
32 |
| - "num_publishers", |
33 |
| - "prev_conf", |
34 |
| - "prev_price", |
35 |
| - "prev_publish_time", |
36 | 28 | "price",
|
37 |
| - "product_id", |
38 |
| - "publish_time", |
39 |
| - "status" |
| 29 | + "publish_time" |
40 | 30 | ],
|
41 | 31 | "properties": {
|
42 | 32 | "conf": {
|
43 |
| - "description": "Confidence interval around the current aggregation price.", |
44 |
| - "type": "string" |
45 |
| - }, |
46 |
| - "ema_conf": { |
47 |
| - "description": "Exponentially moving average confidence interval.", |
48 |
| - "type": "string" |
49 |
| - }, |
50 |
| - "ema_price": { |
51 |
| - "description": "Exponentially moving average price.", |
| 33 | + "description": "Confidence interval.", |
52 | 34 | "type": "string"
|
53 | 35 | },
|
54 | 36 | "expo": {
|
55 |
| - "description": "Price exponent.", |
| 37 | + "description": "Exponent.", |
56 | 38 | "type": "integer",
|
57 | 39 | "format": "int32"
|
58 | 40 | },
|
59 |
| - "id": { |
60 |
| - "description": "Unique identifier for this price.", |
61 |
| - "allOf": [ |
62 |
| - { |
63 |
| - "$ref": "#/definitions/Identifier" |
64 |
| - } |
65 |
| - ] |
66 |
| - }, |
67 |
| - "max_num_publishers": { |
68 |
| - "description": "Maximum number of allowed publishers that can contribute to a price.", |
69 |
| - "type": "integer", |
70 |
| - "format": "uint32", |
71 |
| - "minimum": 0.0 |
72 |
| - }, |
73 |
| - "num_publishers": { |
74 |
| - "description": "Number of publishers that made up current aggregate.", |
75 |
| - "type": "integer", |
76 |
| - "format": "uint32", |
77 |
| - "minimum": 0.0 |
78 |
| - }, |
79 |
| - "prev_conf": { |
80 |
| - "description": "Confidence interval of previous aggregate with Trading status.", |
81 |
| - "type": "string" |
82 |
| - }, |
83 |
| - "prev_price": { |
84 |
| - "description": "Price of previous aggregate with Trading status.", |
| 41 | + "price": { |
| 42 | + "description": "Price.", |
85 | 43 | "type": "string"
|
86 | 44 | },
|
87 |
| - "prev_publish_time": { |
88 |
| - "description": "Publish time of previous aggregate with Trading status.", |
| 45 | + "publish_time": { |
| 46 | + "description": "Publish time.", |
89 | 47 | "type": "integer",
|
90 | 48 | "format": "int64"
|
| 49 | + } |
| 50 | + } |
| 51 | + }, |
| 52 | + "PriceFeed": { |
| 53 | + "description": "Represents a current aggregation price from pyth publisher feeds.", |
| 54 | + "type": "object", |
| 55 | + "required": [ |
| 56 | + "ema_price", |
| 57 | + "id", |
| 58 | + "price" |
| 59 | + ], |
| 60 | + "properties": { |
| 61 | + "ema_price": { |
| 62 | + "description": "Exponentially-weighted moving average (EMA) price.", |
| 63 | + "allOf": [ |
| 64 | + { |
| 65 | + "$ref": "#/definitions/Price" |
| 66 | + } |
| 67 | + ] |
91 | 68 | },
|
92 |
| - "price": { |
93 |
| - "description": "The current aggregation price.", |
94 |
| - "type": "string" |
95 |
| - }, |
96 |
| - "product_id": { |
97 |
| - "description": "Product account key.", |
| 69 | + "id": { |
| 70 | + "description": "Unique identifier for this price.", |
98 | 71 | "allOf": [
|
99 | 72 | {
|
100 | 73 | "$ref": "#/definitions/Identifier"
|
101 | 74 | }
|
102 | 75 | ]
|
103 | 76 | },
|
104 |
| - "publish_time": { |
105 |
| - "description": "Current price aggregation publish time", |
106 |
| - "type": "integer", |
107 |
| - "format": "int64" |
108 |
| - }, |
109 |
| - "status": { |
110 |
| - "description": "Status of price (Trading is valid).", |
| 77 | + "price": { |
| 78 | + "description": "Price.", |
111 | 79 | "allOf": [
|
112 | 80 | {
|
113 |
| - "$ref": "#/definitions/PriceStatus" |
| 81 | + "$ref": "#/definitions/Price" |
114 | 82 | }
|
115 | 83 | ]
|
116 | 84 | }
|
117 | 85 | }
|
118 |
| - }, |
119 |
| - "PriceStatus": { |
120 |
| - "description": "Represents availability status of a price feed.", |
121 |
| - "oneOf": [ |
122 |
| - { |
123 |
| - "description": "The price feed is not currently updating for an unknown reason.", |
124 |
| - "type": "string", |
125 |
| - "enum": [ |
126 |
| - "Unknown" |
127 |
| - ] |
128 |
| - }, |
129 |
| - { |
130 |
| - "description": "The price feed is updating as expected.", |
131 |
| - "type": "string", |
132 |
| - "enum": [ |
133 |
| - "Trading" |
134 |
| - ] |
135 |
| - }, |
136 |
| - { |
137 |
| - "description": "The price feed is not currently updating because trading in the product has been halted.", |
138 |
| - "type": "string", |
139 |
| - "enum": [ |
140 |
| - "Halted" |
141 |
| - ] |
142 |
| - }, |
143 |
| - { |
144 |
| - "description": "The price feed is not currently updating because an auction is setting the price.", |
145 |
| - "type": "string", |
146 |
| - "enum": [ |
147 |
| - "Auction" |
148 |
| - ] |
149 |
| - } |
150 |
| - ] |
151 | 86 | }
|
152 | 87 | }
|
153 | 88 | }
|
0 commit comments