Guard missing Kraken `src_fiat` at trade startup
Raise `ConfigurationError` if private startup lacks source fiat.
Deats,
- Import `ConfigurationError` in `.kraken.broker`.
- Move Kraken's `reg_err_types` imports to the import blocks.
Kraken-only extraction from
f210a478c6.
(this commit msg was generated in some part by `Codex` using
`gpt-6.2-sol` (`OpenAI`))
wkt/land_kraken_parity_replay
parent
70a6a9c024
commit
e0f8e5a859
|
|
@ -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])
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue