From 38b190e59873171f80d25e5df452ea3ab8918c45 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 20 Aug 2022 18:59:53 -0400 Subject: [PATCH] Add `ib` `Crypto` contract support --- piker/brokers/ib/api.py | 7 +++++++ piker/brokers/ib/feed.py | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/piker/brokers/ib/api.py b/piker/brokers/ib/api.py index c18125f4..f5d61879 100644 --- a/piker/brokers/ib/api.py +++ b/piker/brokers/ib/api.py @@ -678,6 +678,13 @@ class Client: con = ibis.Commodity(**con_kwargs) con.bars_kwargs = bars_kwargs + # crypto$ + elif exch == 'PAXOS': # btc.paxos + con = ibis.Crypto( + symbol=symbol, + currency=currency, + ) + # stonks else: # TODO: metadata system for all these exchange rules.. diff --git a/piker/brokers/ib/feed.py b/piker/brokers/ib/feed.py index 4ec214bc..294ebc99 100644 --- a/piker/brokers/ib/feed.py +++ b/piker/brokers/ib/feed.py @@ -426,6 +426,7 @@ asset_type_map = { 'WAR': 'warrant', 'IOPT': 'warran', 'BAG': 'bag', + 'CRYPTO': 'crypto', # bc it's diff then fiat? # 'NEWS': 'news', } @@ -722,7 +723,8 @@ async def stream_quotes( isnan(first_ticker.last) and type(first_ticker.contract) not in ( ibis.Commodity, - ibis.Forex + ibis.Forex, + ibis.Crypto, ) ): task_status.started((init_msgs, first_quote))