Skip to content

Commit

Permalink
Add kraken test, ensure single broker-provider for now
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Nov 10, 2022
1 parent dc7b2c0 commit 091329d
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/test_feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@
open_feed,
)
from piker.data import ShmArray
from piker.data._source import (
unpack_fqsn,
)


@pytest.mark.parametrize(
'fqsns',
[
{'btcusdt.binance', 'ethusdt.binance'}
(100, {'btcusdt.binance', 'ethusdt.binance'}),
(50, {'xbteur.kraken', 'xbtusd.kraken'}),
],
ids=lambda param: f'fqsns={param}',
ids=lambda param: f'quotes={param[0]}@fqsns={param[1]}',
)
def test_basic_rt_feed(
fqsns: set[str],
Expand All @@ -30,6 +34,17 @@ def test_basic_rt_feed(
a few quotes then simply shut down.
'''
max_quotes, fqsns = fqsns

brokers = set()
for fqsn in fqsns:
brokername, key, suffix = unpack_fqsn(fqsn)
brokers.add(brokername)

# NOTE: we only have single broker-backed multi-symbol streams
# currently.
assert len(brokers) == 1

async def main():
async with (
open_piker_runtime(
Expand Down Expand Up @@ -60,7 +75,7 @@ async def main():

# stream some ticks and ensure we see data from both symbol
# subscriptions.
stream = feed.streams['binance']
stream = feed.streams[brokername]

# pull the first startup quotes, one for each fqsn, and
# ensure they match each flume's startup quote value.
Expand Down

0 comments on commit 091329d

Please sign in to comment.