diff --git a/piker/brokers/kraken/api.py b/piker/brokers/kraken/api.py index fbf9d6a9..92297393 100644 --- a/piker/brokers/kraken/api.py +++ b/piker/brokers/kraken/api.py @@ -35,6 +35,7 @@ import hashlib import hmac import base64 import tractor +from tractor._exceptions import reg_err_types import trio from piker import config @@ -118,7 +119,6 @@ class InvalidKey(ValueError): ''' -from tractor._exceptions import reg_err_types reg_err_types([InvalidKey]) diff --git a/piker/brokers/kraken/broker.py b/piker/brokers/kraken/broker.py index d66a9f22..3282bf99 100644 --- a/piker/brokers/kraken/broker.py +++ b/piker/brokers/kraken/broker.py @@ -36,6 +36,7 @@ from typing import ( from bidict import bidict import trio import tractor +from tractor._exceptions import reg_err_types from piker.accounting import ( Position, @@ -45,6 +46,9 @@ from piker.accounting import ( open_trade_ledger, open_account, ) +from piker.config import ( + ConfigurationError, +) from piker.clearing import( OrderDialogs, ) @@ -99,7 +103,7 @@ MsgUnion = Union[ class TooFastEdit(Exception): 'Edit requests faster then api submissions' -from tractor._exceptions import reg_err_types + reg_err_types([TooFastEdit]) @@ -466,7 +470,11 @@ async def open_trade_dialog( # (much like the web UI let's you set an "account currency") # such that all positions (nested or flat) will be translated to # this source currency's terms. - src_fiat = client.conf['src_fiat'] + src_fiat = client.conf.get('src_fiat') + if not src_fiat: + raise ConfigurationError( + 'No `src_fiat: str` field defined in `brokers.toml`' + ) # auth required block acctid = client._name