diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 8fa7260..6d26701 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -26,6 +26,12 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Linting... run: | - isort --check --diff tastytrade/ - flake8 --count --show-source --statistics tastytrade/ + isort --check --diff tastytrade/ tests/ + flake8 --count --show-source --statistics tastytrade/ tests/ mypy -p tastytrade + - name: Testing... + run: | + python -m pytest --cov=tastytrade --cov-report=term-missing tests/ + env: + TT_USERNAME: ${{ secrets.TT_USERNAME }} + TT_PASSWORD: ${{ secrets.TT_PASSWORD }} diff --git a/Makefile b/Makefile index be7d47a..88eaea6 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,14 @@ venv: python -m venv env env/bin/pip install -r requirements.txt -test: - isort --check --diff tastytrade/ - flake8 --count --show-source --statistics tastytrade/ +lint: + isort --check --diff tastytrade/ tests/ + flake8 --count --show-source --statistics tastytrade/ tests/ mypy -p tastytrade +test: + python -m pytest --cov=tastytrade --cov-report=term-missing tests/ + install: env/bin/pip install -e . diff --git a/docs/conf.py b/docs/conf.py index 4d0071a..0c72788 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -9,7 +9,7 @@ project = 'tastytrade' copyright = '2023, Graeme Holliday' author = 'Graeme Holliday' -release = '6.1' +release = '6.2' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/requirements.txt b/requirements.txt index 3043a7e..06d349f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,5 @@ isort==5.11.5 types-requests==2.31.0.1 websockets==11.0.3 pydantic==1.10.11 +pytest==7.4.0 +pytest_cov==4.1.0 diff --git a/setup.py b/setup.py index 97a7073..7d23f7e 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='tastytrade', - version='6.1', + version='6.2', description='An unofficial SDK for Tastytrade!', long_description=LONG_DESCRIPTION, long_description_content_type='text/x-rst', diff --git a/tastytrade/__init__.py b/tastytrade/__init__.py index 40e30cc..0999234 100644 --- a/tastytrade/__init__.py +++ b/tastytrade/__init__.py @@ -2,7 +2,7 @@ API_URL = 'https://api.tastyworks.com' CERT_URL = 'https://api.cert.tastyworks.com' -VERSION = '6.1' +VERSION = '6.2' logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) diff --git a/tastytrade/metrics.py b/tastytrade/metrics.py index c62d7d1..65c5312 100644 --- a/tastytrade/metrics.py +++ b/tastytrade/metrics.py @@ -66,15 +66,16 @@ class MarketMetricInfo(TastytradeJsonDataclass): option_expiration_implied_volatilities: List[OptionExpirationImpliedVolatility] # noqa: E501 beta: Decimal corr_spy_3month: Decimal - dividend_rate_per_share: Optional[Decimal] = None market_cap: Decimal + price_earnings_ratio: Decimal + earnings_per_share: Decimal + dividend_rate_per_share: Optional[Decimal] = None implied_volatility_30_day: Optional[Decimal] = None historical_volatility_30_day: Optional[Decimal] = None historical_volatility_60_day: Optional[Decimal] = None historical_volatility_90_day: Optional[Decimal] = None iv_hv_30_day_difference: Optional[Decimal] = None - price_earnings_ratio: Decimal - earnings_per_share: Decimal + beta_updated_at: Optional[datetime] = None created_at: Optional[datetime] = None dividend_ex_date: Optional[date] = None dividend_next_date: Optional[date] = None @@ -83,7 +84,6 @@ class MarketMetricInfo(TastytradeJsonDataclass): liquidity_value: Optional[Decimal] = None liquidity_rank: Optional[Decimal] = None liquidity_running_state: Optional[Liquidity] = None - beta_updated_at: Optional[datetime] = None dividend_yield: Optional[Decimal] = None listed_market: Optional[str] = None lendability: Optional[str] = None diff --git a/tests/test_session.py b/tests/test_session.py new file mode 100644 index 0000000..175ae3e --- /dev/null +++ b/tests/test_session.py @@ -0,0 +1,12 @@ +import os + +from tastytrade import CertificationSession + + +def test_session(): + username = os.environ.get('TT_USERNAME', None) + assert username is not None + password = os.environ.get('TT_PASSWORD', None) + assert password is not None + + session = CertificationSession(username, password) # noqa: F841