From 3655e449d65abfa54a750bf419ce5c7ec4dece1a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 15 Jul 2020 13:26:48 -0400 Subject: [PATCH] Raise errors, fix module script entry --- piker/brokers/kraken.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/piker/brokers/kraken.py b/piker/brokers/kraken.py index 4b553dd8..cbfa3cbc 100644 --- a/piker/brokers/kraken.py +++ b/piker/brokers/kraken.py @@ -64,7 +64,9 @@ class Client: pair: str = 'all', ): resp = await self._public('AssetPairs', {'pair': pair}) - assert not resp['error'] + err = resp['error'] + if err: + raise BrokerError(err) true_pair_key, data = next(iter(resp['result'].items())) return data @@ -113,7 +115,9 @@ async def get_client() -> Client: async def stream_quotes( - symbols: List[str] = ['BTC/USD', 'XRP/USD'], + # These are the symbols not expected by the ws api + # they are looked up inside this routine. + symbols: List[str] = ['XBTUSD', 'XMRUSD'], sub_type: str = 'ohlc', ) -> None: """Subscribe for ohlc stream of quotes for ``pairs``. @@ -185,6 +189,6 @@ if __name__ == '__main__': async def stream_ohlc(): async for msg in stream_quotes(): - print(asdict(msg)) + print(msg) tractor.run(stream_ohlc)