Skip to content

Commit 7410bfd

Browse files
jayantkJayant Krishnamurthy
andauthored
Only manually aggregate for "coming soon" symbols (#17)
* fix this bug * pre-commit * bump version --------- Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
1 parent 9068383 commit 7410bfd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

example_publisher/providers/pyth_replicator.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
UnixTimestamp = int
1717

18+
# Any feed with >= this number of min publishers is considered "coming soon".
19+
COMING_SOON_MIN_PUB_THRESHOLD = 10
20+
1821

1922
class PythReplicator(Provider):
2023
def __init__(self, config: PythReplicatorConfig) -> None:
@@ -55,11 +58,18 @@ async def _update_loop(self) -> None:
5558
update.aggregate_price_confidence_interval,
5659
update.timestamp,
5760
]
58-
elif self._config.manual_agg_enabled:
61+
elif (
62+
self._config.manual_agg_enabled
63+
and update.min_publishers >= COMING_SOON_MIN_PUB_THRESHOLD
64+
):
5965
# Do the manual aggregation based on the recent active publishers
6066
# and their confidence intervals if possible. This will allow us to
6167
# get an aggregate if there are some active publishers but they are
6268
# not enough to reach the min_publishers threshold.
69+
#
70+
# Note that we only manually aggregate for feeds that are coming soon. Some feeds should go
71+
# offline outside of market hours (e.g., Equities, Metals). Manually aggregating for these feeds
72+
# can cause them to come online at unexpected times if a single data provider publishes at that time.
6373
prices = []
6474

6575
current_slot = update.slot

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "example-publisher"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
description = ""
55
authors = []
66
license = "Apache-2"

0 commit comments

Comments
 (0)