4
4
5
5
from pythclient .pythaccounts import (
6
6
ACCOUNT_HEADER_BYTES ,
7
- DEFAULT_MAX_LATENCY ,
8
7
PythPriceAccount ,
9
8
PythPriceType ,
10
9
PythPriceStatus ,
14
13
15
14
16
15
# Yes, this sucks, but it is actually a monster datastructure
17
- # Equity.US.AAPL/USD symbol
16
+ # Equity.US.AAPL/USD symbol with a max latency of 50 slots
18
17
@pytest .fixture
19
18
def price_account_bytes ():
20
19
return base64 .b64decode ((
@@ -316,15 +315,15 @@ def test_price_account_agregate_conf_interval(
316
315
):
317
316
price_account .update_from (buffer = price_account_bytes , version = 2 , offset = ACCOUNT_HEADER_BYTES )
318
317
price_account .slot = price_account .aggregate_price_info .pub_slot
319
- assert price_account .aggregate_price_confidence_interval == 0.366305
318
+ assert price_account .aggregate_price_confidence_interval == 0.14454
320
319
321
320
322
321
def test_price_account_agregate_price (
323
322
price_account_bytes : bytes , price_account : PythPriceAccount ,
324
323
):
325
324
price_account .update_from (buffer = price_account_bytes , version = 2 , offset = ACCOUNT_HEADER_BYTES )
326
325
price_account .slot = price_account .aggregate_price_info .pub_slot
327
- assert price_account .aggregate_price == 707.125
326
+ assert price_account .aggregate_price == 236.23373
328
327
329
328
def test_price_account_unknown_status (
330
329
price_account_bytes : bytes , price_account : PythPriceAccount ,
@@ -340,7 +339,7 @@ def test_price_account_get_aggregate_price_status_still_trading(
340
339
price_account_bytes : bytes , price_account : PythPriceAccount
341
340
):
342
341
price_account .update_from (buffer = price_account_bytes , version = 2 , offset = ACCOUNT_HEADER_BYTES )
343
- price_account .slot = price_account .aggregate_price_info .pub_slot + DEFAULT_MAX_LATENCY
342
+ price_account .slot = price_account .aggregate_price_info .pub_slot + 50
344
343
345
344
price_status = price_account .aggregate_price_status
346
345
assert price_status == PythPriceStatus .TRADING
@@ -349,7 +348,7 @@ def test_price_account_get_aggregate_price_status_got_stale(
349
348
price_account_bytes : bytes , price_account : PythPriceAccount
350
349
):
351
350
price_account .update_from (buffer = price_account_bytes , version = 2 , offset = ACCOUNT_HEADER_BYTES )
352
- price_account .slot = price_account .aggregate_price_info .pub_slot + DEFAULT_MAX_LATENCY + 1
351
+ price_account .slot = price_account .aggregate_price_info .pub_slot + 50 + 1
353
352
354
353
price_status = price_account .aggregate_price_status
355
354
assert price_status == PythPriceStatus .UNKNOWN
0 commit comments