Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest #94

Merged
merged 5 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion tastytrade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions tastytrade/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions tests/test_session.py
Original file line number Diff line number Diff line change
@@ -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
Loading