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 hmac
|
||||||
import base64
|
import base64
|
||||||
import tractor
|
import tractor
|
||||||
|
from tractor._exceptions import reg_err_types
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
from piker import config
|
from piker import config
|
||||||
|
|
@ -118,7 +119,6 @@ class InvalidKey(ValueError):
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from tractor._exceptions import reg_err_types
|
|
||||||
reg_err_types([InvalidKey])
|
reg_err_types([InvalidKey])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ from typing import (
|
||||||
from bidict import bidict
|
from bidict import bidict
|
||||||
import trio
|
import trio
|
||||||
import tractor
|
import tractor
|
||||||
|
from tractor._exceptions import reg_err_types
|
||||||
|
|
||||||
from piker.accounting import (
|
from piker.accounting import (
|
||||||
Position,
|
Position,
|
||||||
|
|
@ -45,6 +46,9 @@ from piker.accounting import (
|
||||||
open_trade_ledger,
|
open_trade_ledger,
|
||||||
open_account,
|
open_account,
|
||||||
)
|
)
|
||||||
|
from piker.config import (
|
||||||
|
ConfigurationError,
|
||||||
|
)
|
||||||
from piker.clearing import(
|
from piker.clearing import(
|
||||||
OrderDialogs,
|
OrderDialogs,
|
||||||
)
|
)
|
||||||
|
|
@ -99,7 +103,7 @@ MsgUnion = Union[
|
||||||
class TooFastEdit(Exception):
|
class TooFastEdit(Exception):
|
||||||
'Edit requests faster then api submissions'
|
'Edit requests faster then api submissions'
|
||||||
|
|
||||||
from tractor._exceptions import reg_err_types
|
|
||||||
reg_err_types([TooFastEdit])
|
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")
|
# (much like the web UI let's you set an "account currency")
|
||||||
# such that all positions (nested or flat) will be translated to
|
# such that all positions (nested or flat) will be translated to
|
||||||
# this source currency's terms.
|
# 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
|
# auth required block
|
||||||
acctid = client._name
|
acctid = client._name
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue