Merge pull request #176 from pikers/py3.9

Py3.9 bbys
ems_tweaks
goodboy 2021-05-22 15:35:44 -04:00 committed by GitHub
commit 02809df694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 76 additions and 11 deletions

View File

@ -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

View File

@ -1 +1,2 @@
include README.rst
include data/brokers.toml

View File

@ -0,0 +1,9 @@
[binance]
[kraken]
# [ib]
# [questrade]

View File

@ -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

View File

@ -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

View File

@ -38,7 +38,6 @@ from .feed import (
__all__ = [
'open_feed',
'maybe_spawn_brokerd',
'ShmArray',
'iterticks',
'maybe_open_shm_array',

View File

@ -0,0 +1 @@
pytest

View File

@ -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',

View File

@ -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

View File

@ -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.
"""

View File

@ -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