|
4 | 4 | "description": "Represents a current aggregation price from pyth publisher feeds.", |
5 | 5 | "type": "object", |
6 | 6 | "required": [ |
7 | | - "conf", |
8 | | - "ema_conf", |
9 | 7 | "ema_price", |
10 | | - "expo", |
11 | 8 | "id", |
12 | | - "max_num_publishers", |
13 | | - "num_publishers", |
14 | | - "prev_conf", |
15 | | - "prev_price", |
16 | | - "prev_publish_time", |
17 | | - "price", |
18 | | - "product_id", |
19 | | - "publish_time", |
20 | | - "status" |
| 9 | + "price" |
21 | 10 | ], |
22 | 11 | "properties": { |
23 | | - "conf": { |
24 | | - "description": "Confidence interval around the current aggregation price.", |
25 | | - "type": "string" |
26 | | - }, |
27 | | - "ema_conf": { |
28 | | - "description": "Exponentially moving average confidence interval.", |
29 | | - "type": "string" |
30 | | - }, |
31 | 12 | "ema_price": { |
32 | | - "description": "Exponentially moving average price.", |
33 | | - "type": "string" |
34 | | - }, |
35 | | - "expo": { |
36 | | - "description": "Price exponent.", |
37 | | - "type": "integer", |
38 | | - "format": "int32" |
39 | | - }, |
40 | | - "id": { |
41 | | - "description": "Unique identifier for this price.", |
| 13 | + "description": "Exponentially-weighted moving average (EMA) price.", |
42 | 14 | "allOf": [ |
43 | 15 | { |
44 | | - "$ref": "#/definitions/Identifier" |
| 16 | + "$ref": "#/definitions/Price" |
45 | 17 | } |
46 | 18 | ] |
47 | 19 | }, |
48 | | - "max_num_publishers": { |
49 | | - "description": "Maximum number of allowed publishers that can contribute to a price.", |
50 | | - "type": "integer", |
51 | | - "format": "uint32", |
52 | | - "minimum": 0.0 |
53 | | - }, |
54 | | - "num_publishers": { |
55 | | - "description": "Number of publishers that made up current aggregate.", |
56 | | - "type": "integer", |
57 | | - "format": "uint32", |
58 | | - "minimum": 0.0 |
59 | | - }, |
60 | | - "prev_conf": { |
61 | | - "description": "Confidence interval of previous aggregate with Trading status.", |
62 | | - "type": "string" |
63 | | - }, |
64 | | - "prev_price": { |
65 | | - "description": "Price of previous aggregate with Trading status.", |
66 | | - "type": "string" |
67 | | - }, |
68 | | - "prev_publish_time": { |
69 | | - "description": "Publish time of previous aggregate with Trading status.", |
70 | | - "type": "integer", |
71 | | - "format": "int64" |
72 | | - }, |
73 | | - "price": { |
74 | | - "description": "The current aggregation price.", |
75 | | - "type": "string" |
76 | | - }, |
77 | | - "product_id": { |
78 | | - "description": "Product account key.", |
| 20 | + "id": { |
| 21 | + "description": "Unique identifier for this price.", |
79 | 22 | "allOf": [ |
80 | 23 | { |
81 | 24 | "$ref": "#/definitions/Identifier" |
82 | 25 | } |
83 | 26 | ] |
84 | 27 | }, |
85 | | - "publish_time": { |
86 | | - "description": "Current price aggregation publish time", |
87 | | - "type": "integer", |
88 | | - "format": "int64" |
89 | | - }, |
90 | | - "status": { |
91 | | - "description": "Status of price (Trading is valid).", |
| 28 | + "price": { |
| 29 | + "description": "Price.", |
92 | 30 | "allOf": [ |
93 | 31 | { |
94 | | - "$ref": "#/definitions/PriceStatus" |
| 32 | + "$ref": "#/definitions/Price" |
95 | 33 | } |
96 | 34 | ] |
97 | 35 | } |
|
100 | 38 | "Identifier": { |
101 | 39 | "type": "string" |
102 | 40 | }, |
103 | | - "PriceStatus": { |
104 | | - "description": "Represents availability status of a price feed.", |
105 | | - "type": "string", |
106 | | - "enum": [ |
107 | | - "Unknown", |
108 | | - "Trading", |
109 | | - "Halted", |
110 | | - "Auction" |
111 | | - ] |
| 41 | + "Price": { |
| 42 | + "description": "A price with a degree of uncertainty at a certain time, represented as a price +- a confidence interval.\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.", |
| 43 | + "type": "object", |
| 44 | + "required": [ |
| 45 | + "conf", |
| 46 | + "expo", |
| 47 | + "price", |
| 48 | + "publish_time" |
| 49 | + ], |
| 50 | + "properties": { |
| 51 | + "conf": { |
| 52 | + "description": "Confidence Interval.", |
| 53 | + "type": "string" |
| 54 | + }, |
| 55 | + "expo": { |
| 56 | + "description": "Exponent.", |
| 57 | + "type": "integer", |
| 58 | + "format": "int32" |
| 59 | + }, |
| 60 | + "price": { |
| 61 | + "description": "Price.", |
| 62 | + "type": "string" |
| 63 | + }, |
| 64 | + "publish_time": { |
| 65 | + "description": "Publish Timestamp", |
| 66 | + "type": "integer", |
| 67 | + "format": "int64" |
| 68 | + } |
| 69 | + } |
112 | 70 | } |
113 | 71 | } |
114 | 72 | } |
0 commit comments