Add `kraken` test, ensure single broker-provider for now

agg_feedz
Tyler Goodlet 2022-11-10 10:38:45 -05:00
parent 29b6b3e54f
commit 36868bb86e
1 changed files with 18 additions and 3 deletions

View File

@ -13,14 +13,18 @@ from piker import (
open_feed, open_feed,
) )
from piker.data import ShmArray from piker.data import ShmArray
from piker.data._source import (
unpack_fqsn,
)
@pytest.mark.parametrize( @pytest.mark.parametrize(
'fqsns', '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( def test_basic_rt_feed(
fqsns: set[str], fqsns: set[str],
@ -30,6 +34,17 @@ def test_basic_rt_feed(
a few quotes then simply shut down. 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 def main():
async with ( async with (
open_piker_runtime( open_piker_runtime(
@ -60,7 +75,7 @@ def test_basic_rt_feed(
# stream some ticks and ensure we see data from both symbol # stream some ticks and ensure we see data from both symbol
# subscriptions. # subscriptions.
stream = feed.streams['binance'] stream = feed.streams[brokername]
# pull the first startup quotes, one for each fqsn, and # pull the first startup quotes, one for each fqsn, and
# ensure they match each flume's startup quote value. # ensure they match each flume's startup quote value.