|
1 | 1 | use {
|
2 | 2 | futures::{SinkExt, StreamExt},
|
3 | 3 | pyth_lazer_protocol::{
|
4 |
| - publisher::PriceFeedData, |
| 4 | + publisher::PriceFeedDataV2, |
5 | 5 | router::{Price, PriceFeedId, TimestampUs},
|
6 | 6 | },
|
7 | 7 | std::time::Duration,
|
@@ -37,22 +37,14 @@ async fn run() -> anyhow::Result<()> {
|
37 | 37 | i += 1;
|
38 | 38 | sleep(Duration::from_secs(1)).await;
|
39 | 39 | for feed_id in 1u32..=5 {
|
40 |
| - let data = PriceFeedData { |
| 40 | + let data = PriceFeedDataV2 { |
41 | 41 | price_feed_id: PriceFeedId(feed_id),
|
42 | 42 | source_timestamp_us: TimestampUs::now(),
|
43 | 43 | publisher_timestamp_us: TimestampUs::now(),
|
44 |
| - price: Some(Price::from_integer( |
45 |
| - (feed_id * 10000 + i) as i64, |
46 |
| - Price::TMP_EXPONENT, |
47 |
| - )?), |
48 |
| - best_bid_price: Some(Price::from_integer( |
49 |
| - (feed_id * 10000 + i - 1) as i64, |
50 |
| - Price::TMP_EXPONENT, |
51 |
| - )?), |
52 |
| - best_ask_price: Some(Price::from_integer( |
53 |
| - (feed_id * 10000 + i + 1) as i64, |
54 |
| - Price::TMP_EXPONENT, |
55 |
| - )?), |
| 44 | + price: Some(Price::from_integer((feed_id * 10000 + i) as i64, 8)?), |
| 45 | + best_bid_price: Some(Price::from_integer((feed_id * 10000 + i - 1) as i64, 8)?), |
| 46 | + best_ask_price: Some(Price::from_integer((feed_id * 10000 + i + 1) as i64, 8)?), |
| 47 | + funding_rate: None, |
56 | 48 | };
|
57 | 49 | let mut buf = Vec::new();
|
58 | 50 | bincode::serialize_into(&mut buf, &data)?;
|
|
0 commit comments