commit
02809df694
|
@ -3,19 +3,43 @@ name: CI
|
|||
on: push
|
||||
|
||||
jobs:
|
||||
mypy:
|
||||
|
||||
basic_install:
|
||||
name: 'pip install'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: chart_hacking
|
||||
ref: master
|
||||
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.8'
|
||||
python-version: '3.9'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -e . --upgrade-strategy eager -r requirements.txt
|
||||
- name: Run piker
|
||||
|
||||
- name: Run piker cli
|
||||
run: piker
|
||||
|
||||
testing:
|
||||
name: 'test suite'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -U . -r requirements-test.txt -r requirements.txt --upgrade-strategy eager
|
||||
|
||||
- name: Test suite
|
||||
run: pytest tests -rs
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
include README.rst
|
||||
include data/brokers.toml
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
[binance]
|
||||
|
||||
[kraken]
|
||||
|
||||
|
||||
# [ib]
|
||||
|
||||
|
||||
# [questrade]
|
|
@ -18,9 +18,12 @@
|
|||
Broker configuration mgmt.
|
||||
"""
|
||||
import os
|
||||
import configparser
|
||||
from os.path import dirname
|
||||
import shutil
|
||||
|
||||
import toml
|
||||
import click
|
||||
|
||||
from ..log import get_logger
|
||||
|
||||
log = get_logger('broker-config')
|
||||
|
@ -40,12 +43,28 @@ def get_broker_conf_path():
|
|||
return os.path.join(_config_dir, _file_name)
|
||||
|
||||
|
||||
def repodir():
|
||||
"""Return the abspath to the repo directory.
|
||||
"""
|
||||
dirpath = os.path.abspath(
|
||||
# we're 3 levels down in **this** module file
|
||||
dirname(dirname(dirname(os.path.realpath(__file__))))
|
||||
)
|
||||
return dirpath
|
||||
|
||||
|
||||
def load(
|
||||
path: str = None
|
||||
) -> (dict, str):
|
||||
"""Load broker config.
|
||||
"""
|
||||
path = path or get_broker_conf_path()
|
||||
if not os.path.isfile(path):
|
||||
shutil.copyfile(
|
||||
os.path.join(repodir(), 'data/brokers.toml'),
|
||||
path,
|
||||
)
|
||||
|
||||
config = toml.load(path)
|
||||
log.debug(f"Read config file {path}")
|
||||
return config, path
|
||||
|
|
|
@ -47,7 +47,7 @@ from ib_insync.wrapper import Wrapper
|
|||
from ib_insync.client import Client as ib_Client
|
||||
|
||||
from ..log import get_logger, get_console_log
|
||||
from ..data import maybe_spawn_brokerd
|
||||
from .._daemon import maybe_spawn_brokerd
|
||||
from ..data._source import from_df
|
||||
from ..data._sharedmem import ShmArray
|
||||
from ._util import SymbolNotFound
|
||||
|
|
|
@ -38,7 +38,6 @@ from .feed import (
|
|||
|
||||
__all__ = [
|
||||
'open_feed',
|
||||
'maybe_spawn_brokerd',
|
||||
'ShmArray',
|
||||
'iterticks',
|
||||
'maybe_open_shm_array',
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
pytest
|
4
setup.py
4
setup.py
|
@ -77,7 +77,7 @@ setup(
|
|||
#'kivy', see requirement.txt; using a custom branch atm
|
||||
],
|
||||
tests_require=['pytest'],
|
||||
python_requires=">=3.7", # literally for ``datetime.datetime.fromisoformat``...
|
||||
python_requires=">=3.9", # literally for ``datetime.datetime.fromisoformat``...
|
||||
keywords=["async", "trading", "finance", "quant", "charting"],
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
|
@ -85,7 +85,7 @@ setup(
|
|||
'Operating System :: POSIX :: Linux',
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
'Intended Audience :: Financial and Insurance Industry',
|
||||
'Intended Audience :: Science/Research',
|
||||
'Intended Audience :: Developers',
|
||||
|
|
|
@ -44,7 +44,6 @@ def confdir(request, test_config):
|
|||
if confdir is not None:
|
||||
config._override_config_dir(confdir)
|
||||
|
||||
# return config.load()[0]
|
||||
return confdir
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,12 @@ import os.path
|
|||
import piker.watchlists as wl
|
||||
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
True,
|
||||
reason="cli tests rely on quote api and questrade symbols"
|
||||
)
|
||||
|
||||
|
||||
def run(cmd, *args):
|
||||
"""Run cmd and check for zero return code.
|
||||
"""
|
||||
|
|
|
@ -10,11 +10,18 @@ import pytest
|
|||
import tractor
|
||||
from tractor.testing import tractor_test
|
||||
|
||||
import piker
|
||||
from piker.brokers import get_brokermod
|
||||
from piker.brokers.data import DataFeed
|
||||
|
||||
|
||||
log = tractor.get_logger('tests')
|
||||
log = piker.log.get_logger('tests')
|
||||
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
True,
|
||||
reason="questrade tests can only be run locally with an API key",
|
||||
)
|
||||
|
||||
|
||||
# stock quote
|
||||
|
|
Loading…
Reference in New Issue