Use common `.brokers` logger in most backends
parent
2ae9576cd8
commit
ea42f66b54
|
@ -28,7 +28,13 @@ import tractor
|
||||||
|
|
||||||
from ..cli import cli
|
from ..cli import cli
|
||||||
from .. import watchlists as wl
|
from .. import watchlists as wl
|
||||||
from ..log import get_console_log, colorize_json, get_logger
|
from ..log import (
|
||||||
|
colorize_json,
|
||||||
|
)
|
||||||
|
from ._util import (
|
||||||
|
log,
|
||||||
|
get_console_log,
|
||||||
|
)
|
||||||
from ..service import (
|
from ..service import (
|
||||||
maybe_spawn_brokerd,
|
maybe_spawn_brokerd,
|
||||||
maybe_open_pikerd,
|
maybe_open_pikerd,
|
||||||
|
@ -38,9 +44,7 @@ from ..brokers import (
|
||||||
get_brokermod,
|
get_brokermod,
|
||||||
data,
|
data,
|
||||||
)
|
)
|
||||||
|
DEFAULT_BROKER = 'binance'
|
||||||
log = get_logger('cli')
|
|
||||||
DEFAULT_BROKER = 'questrade'
|
|
||||||
|
|
||||||
_config_dir = click.get_app_dir('piker')
|
_config_dir = click.get_app_dir('piker')
|
||||||
_watchlists_data_path = os.path.join(_config_dir, 'watchlists.json')
|
_watchlists_data_path = os.path.join(_config_dir, 'watchlists.json')
|
||||||
|
|
|
@ -26,15 +26,12 @@ from typing import List, Dict, Any, Optional
|
||||||
|
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
from ..log import get_logger
|
from ._util import log
|
||||||
from . import get_brokermod
|
from . import get_brokermod
|
||||||
from ..service import maybe_spawn_brokerd
|
from ..service import maybe_spawn_brokerd
|
||||||
from .._cacheables import open_cached_client
|
from .._cacheables import open_cached_client
|
||||||
|
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
async def api(brokername: str, methname: str, **kwargs) -> dict:
|
async def api(brokername: str, methname: str, **kwargs) -> dict:
|
||||||
"""Make (proxy through) a broker API call by name and return its result.
|
"""Make (proxy through) a broker API call by name and return its result.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -41,13 +41,13 @@ import tractor
|
||||||
from tractor.experimental import msgpub
|
from tractor.experimental import msgpub
|
||||||
from async_generator import asynccontextmanager
|
from async_generator import asynccontextmanager
|
||||||
|
|
||||||
from ..log import get_logger, get_console_log
|
from ._util import (
|
||||||
|
log,
|
||||||
|
get_console_log,
|
||||||
|
)
|
||||||
from . import get_brokermod
|
from . import get_brokermod
|
||||||
|
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
async def wait_for_network(
|
async def wait_for_network(
|
||||||
net_func: Callable,
|
net_func: Callable,
|
||||||
sleep: int = 1
|
sleep: int = 1
|
||||||
|
|
|
@ -24,9 +24,7 @@ import subprocess
|
||||||
|
|
||||||
import tractor
|
import tractor
|
||||||
|
|
||||||
from piker.log import get_logger
|
from .._util import log
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
_reset_tech: Literal[
|
_reset_tech: Literal[
|
||||||
|
|
|
@ -68,12 +68,10 @@ import numpy as np
|
||||||
|
|
||||||
from piker import config
|
from piker import config
|
||||||
from piker.log import get_logger
|
from piker.log import get_logger
|
||||||
|
from piker.brokers._util import log
|
||||||
from piker.data._source import base_ohlc_dtype
|
from piker.data._source import base_ohlc_dtype
|
||||||
|
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
_time_units = {
|
_time_units = {
|
||||||
's': ' sec',
|
's': ' sec',
|
||||||
'm': ' mins',
|
'm': ' mins',
|
||||||
|
|
|
@ -43,10 +43,13 @@ from ..calc import humanize, percent_change
|
||||||
from .._cacheables import open_cached_client, async_lifo_cache
|
from .._cacheables import open_cached_client, async_lifo_cache
|
||||||
from .. import config
|
from .. import config
|
||||||
from ._util import resproc, BrokerError, SymbolNotFound
|
from ._util import resproc, BrokerError, SymbolNotFound
|
||||||
from ..log import get_logger, colorize_json, get_console_log
|
from ..log import (
|
||||||
|
colorize_json,
|
||||||
|
)
|
||||||
log = get_logger(__name__)
|
from .util import (
|
||||||
|
log,
|
||||||
|
get_console_log,
|
||||||
|
)
|
||||||
|
|
||||||
_use_practice_account = False
|
_use_practice_account = False
|
||||||
_refresh_token_ep = 'https://{}login.questrade.com/oauth2/'
|
_refresh_token_ep = 'https://{}login.questrade.com/oauth2/'
|
||||||
|
|
|
@ -27,12 +27,13 @@ from typing import List
|
||||||
from async_generator import asynccontextmanager
|
from async_generator import asynccontextmanager
|
||||||
import asks
|
import asks
|
||||||
|
|
||||||
from ..log import get_logger
|
from ._util import (
|
||||||
from ._util import resproc, BrokerError
|
resproc,
|
||||||
|
BrokerError,
|
||||||
|
log,
|
||||||
|
)
|
||||||
from ..calc import percent_change
|
from ..calc import percent_change
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
_service_ep = 'https://api.robinhood.com'
|
_service_ep = 'https://api.robinhood.com'
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,8 +66,10 @@ class Client:
|
||||||
self.api = _API(self._sess)
|
self.api = _API(self._sess)
|
||||||
|
|
||||||
def _zip_in_order(self, symbols: [str], quotes: List[dict]):
|
def _zip_in_order(self, symbols: [str], quotes: List[dict]):
|
||||||
return {quote.get('symbol', sym) if quote else sym: quote
|
return {
|
||||||
for sym, quote in zip(symbols, results_dict)}
|
quote.get('symbol', sym) if quote else sym: quote
|
||||||
|
for sym, quote in zip(symbols, quotes)
|
||||||
|
}
|
||||||
|
|
||||||
async def quote(self, symbols: [str]):
|
async def quote(self, symbols: [str]):
|
||||||
"""Retrieve quotes for a list of ``symbols``.
|
"""Retrieve quotes for a list of ``symbols``.
|
||||||
|
|
Loading…
Reference in New Issue