Move `reg_err_types` imports to module-level
Hoist inline `from tractor._exceptions import reg_err_types` calls up to the module-level import block across 5 files so they follow normal import ordering. Other, - `kraken/broker.py`: same; also add `ConfigurationError` import and raise on missing `src_fiat` config field instead of `KeyError`. - `storage/__init__.py`: same; also switch from relative to absolute `piker.*` imports and reorder the import block. - comment out stray `await tractor.pause()` in binance `feed.py`. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-coderepair_tests
parent
79be47635f
commit
f210a478c6
|
|
@ -383,7 +383,8 @@ async def get_mkt_info(
|
||||||
if not mkt_mode:
|
if not mkt_mode:
|
||||||
mkt_mode: str = f'{venue_lower}_futes'
|
mkt_mode: str = f'{venue_lower}_futes'
|
||||||
|
|
||||||
await tractor.pause()
|
# tracing
|
||||||
|
# await tractor.pause()
|
||||||
|
|
||||||
async with open_cached_client(
|
async with open_cached_client(
|
||||||
'binance',
|
'binance',
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
)
|
)
|
||||||
|
|
@ -97,7 +101,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])
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -464,7 +468,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
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,13 @@ from typing import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from msgspec import field
|
from msgspec import field
|
||||||
|
from tractor._exceptions import reg_err_types
|
||||||
|
|
||||||
from piker.types import Struct
|
from piker.types import Struct
|
||||||
from piker.accounting import (
|
from piker.accounting import (
|
||||||
Asset,
|
Asset,
|
||||||
MktPair,
|
MktPair,
|
||||||
)
|
)
|
||||||
from tractor._exceptions import reg_err_types
|
|
||||||
from ._util import log
|
from ._util import log
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ from msgspec.msgpack import (
|
||||||
# import pyqtgraph as pg
|
# import pyqtgraph as pg
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import tractor
|
import tractor
|
||||||
|
from tractor._exceptions import reg_err_types
|
||||||
from trio_websocket import open_websocket_url
|
from trio_websocket import open_websocket_url
|
||||||
from anyio_marketstore import ( # noqa
|
from anyio_marketstore import ( # noqa
|
||||||
open_marketstore_client,
|
open_marketstore_client,
|
||||||
|
|
@ -382,7 +383,6 @@ def quote_to_marketstore_structarray(
|
||||||
class MarketStoreError(Exception):
|
class MarketStoreError(Exception):
|
||||||
"Generic marketstore client error"
|
"Generic marketstore client error"
|
||||||
|
|
||||||
from tractor._exceptions import reg_err_types
|
|
||||||
reg_err_types([MarketStoreError])
|
reg_err_types([MarketStoreError])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,15 +42,17 @@ from typing import (
|
||||||
)
|
)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from tractor._exceptions import reg_err_types
|
||||||
|
|
||||||
from .. import config
|
from piker import config
|
||||||
from ..service import (
|
from piker.log import (
|
||||||
check_for_service,
|
|
||||||
)
|
|
||||||
from ..log import (
|
|
||||||
get_logger,
|
get_logger,
|
||||||
get_console_log,
|
get_console_log,
|
||||||
)
|
)
|
||||||
|
from piker.service import (
|
||||||
|
check_for_service,
|
||||||
|
)
|
||||||
|
|
||||||
subsys: str = 'piker.storage'
|
subsys: str = 'piker.storage'
|
||||||
|
|
||||||
log = get_logger(subsys)
|
log = get_logger(subsys)
|
||||||
|
|
@ -151,7 +153,6 @@ class StorageConnectionError(ConnectionError):
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from tractor._exceptions import reg_err_types
|
|
||||||
reg_err_types([
|
reg_err_types([
|
||||||
TimeseriesNotFound,
|
TimeseriesNotFound,
|
||||||
StorageConnectionError,
|
StorageConnectionError,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue