Skip to content

Commit

Permalink
uv formatting (#166)
Browse files Browse the repository at this point in the history
* uv formatting

* add backtesting
  • Loading branch information
Graeme22 authored Sep 30, 2024
1 parent 97e1bc6 commit 73e17e0
Show file tree
Hide file tree
Showing 38 changed files with 2,586 additions and 942 deletions.
3 changes: 2 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
Fixes ...

## Pre-merge checklist
- [ ] Passing tests LOCALLY
- [ ] Code formatted correctly with `uv run ruff format .`
- [ ] Passing tests locally
- [ ] New tests added (if applicable)

Please note that, in order to pass the tests, you'll need to set up your Tastytrade credentials as repository secrets on your local fork. Read more at CONTRIBUTING.md.
22 changes: 10 additions & 12 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.10"

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
os: "ubuntu-22.04"
tools:
python: "3.10"
commands:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv sync
- uv pip install .
- .venv/bin/python -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/htmlo

formats: all
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ install:
uv pip install -e .

lint:
uv run ruff check tastytrade/
uv run ruff check tests/
uv run ruff check .
uv run ruff format .
uv run mypy -p tastytrade
uv run mypy -p tests

Expand Down
21 changes: 10 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'tastytrade'
copyright = '2024, Graeme Holliday'
author = 'Graeme Holliday'
release = '8.4'
project = "tastytrade"
copyright = "2024, Graeme Holliday"
author = "Graeme Holliday"
release = "8.4"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand All @@ -22,26 +22,25 @@
"sphinx.ext.intersphinx",
"sphinx_toolbox.more_autodoc.autotypeddict",
"enum_tools.autoenum",
"sphinxcontrib.autodoc_pydantic"
"sphinxcontrib.autodoc_pydantic",
]

intersphinx_mapping = {
"rtd": ("https://docs.readthedocs.io/en/stable/", None),
"python": ("https://docs.python.org/3/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None)
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
}
intersphinx_disabled_domains = ["std"]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]

# -- Options for pydantic -------------------------------------------------
autodoc_pydantic_model_show_json = True
Expand Down
5 changes: 0 additions & 5 deletions docs/requirements.txt

This file was deleted.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ authors = [

dependencies = [
"fake-useragent>=1.5.1",
"httpx>=0.27.2",
"pandas-market-calendars>=4.4.1",
"pydantic>=2.9.2",
"requests>=2.32.3",
Expand All @@ -35,6 +36,7 @@ dev-dependencies = [
"sphinx-toolbox==3.4.0",
"enum-tools>=0.12.0",
"autodoc-pydantic>=2.2.0",
"jupyter>=1.1.1",
]

[tool.setuptools.package-data]
Expand Down
156 changes: 91 additions & 65 deletions tastytrade/__init__.py
Original file line number Diff line number Diff line change
@@ -1,81 +1,107 @@
import logging

API_URL = 'https://api.tastyworks.com'
CERT_URL = 'https://api.cert.tastyworks.com'
VERSION = '8.3'
API_URL = "https://api.tastyworks.com"
BACKTEST_URL = "https://backtester.vast.tastyworks.com"
CERT_URL = "https://api.cert.tastyworks.com"
VERSION = "8.4"

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

# flake8: noqa
# ruff: noqa: E402

from .account import Account
from .dxfeed import EventType
from .instruments import (Cryptocurrency, Equity, Future, FutureOption,
FutureOptionProduct, FutureProduct,
NestedFutureOptionChain, NestedOptionChain, Option,
OptionType, Warrant, get_future_option_chain,
get_option_chain, get_quantity_decimal_precisions)
from .metrics import (get_dividends, get_earnings, get_market_metrics,
get_risk_free_rate)
from .order import (ComplexOrderType, InstrumentType, NewComplexOrder,
NewOrder, OrderAction, OrderStatus, OrderTimeInForce,
OrderType, PriceEffect)
from .instruments import (
Cryptocurrency,
Equity,
Future,
FutureOption,
FutureOptionProduct,
FutureProduct,
NestedFutureOptionChain,
NestedOptionChain,
Option,
OptionType,
Warrant,
get_future_option_chain,
get_option_chain,
get_quantity_decimal_precisions,
)
from .metrics import get_dividends, get_earnings, get_market_metrics, get_risk_free_rate
from .order import (
ComplexOrderType,
InstrumentType,
NewComplexOrder,
NewOrder,
OrderAction,
OrderStatus,
OrderTimeInForce,
OrderType,
PriceEffect,
)
from .search import symbol_search
from .session import Session
from .streamer import AlertStreamer, AlertType, DXLinkStreamer
from .utils import (get_future_fx_monthly, get_future_grain_monthly,
get_future_index_monthly, get_future_metal_monthly,
get_future_oil_monthly, get_future_treasury_monthly,
get_tasty_monthly, get_third_friday, now_in_new_york,
today_in_new_york)
from .utils import (
get_future_fx_monthly,
get_future_grain_monthly,
get_future_index_monthly,
get_future_metal_monthly,
get_future_oil_monthly,
get_future_treasury_monthly,
get_tasty_monthly,
get_third_friday,
now_in_new_york,
today_in_new_york,
)
from .watchlists import PairsWatchlist, Watchlist

__all__ = [
'Account',
'AlertStreamer',
'AlertType',
'ComplexOrderType',
'Cryptocurrency',
'DXLinkStreamer',
'Equity',
'EventType',
'Future',
'FutureOption',
'FutureOptionProduct',
'FutureProduct',
'InstrumentType',
'NestedFutureOptionChain',
'NestedOptionChain',
'NewComplexOrder',
'NewOrder',
'Option',
'OptionType',
'OrderAction',
'OrderStatus',
'OrderTimeInForce',
'OrderType',
'PairsWatchlist',
'PriceEffect',
'Session',
'Warrant',
'Watchlist',
'get_dividends',
'get_earnings',
'get_future_fx_monthly',
'get_future_grain_monthly',
'get_future_index_monthly',
'get_future_metal_monthly',
'get_future_oil_monthly',
'get_future_option_chain',
'get_future_treasury_monthly',
'get_market_metrics',
'get_option_chain',
'get_quantity_decimal_precisions',
'get_risk_free_rate',
'get_tasty_monthly',
'get_third_friday',
'now_in_new_york',
'symbol_search',
'today_in_new_york'
"Account",
"AlertStreamer",
"AlertType",
"ComplexOrderType",
"Cryptocurrency",
"DXLinkStreamer",
"Equity",
"EventType",
"Future",
"FutureOption",
"FutureOptionProduct",
"FutureProduct",
"InstrumentType",
"NestedFutureOptionChain",
"NestedOptionChain",
"NewComplexOrder",
"NewOrder",
"Option",
"OptionType",
"OrderAction",
"OrderStatus",
"OrderTimeInForce",
"OrderType",
"PairsWatchlist",
"PriceEffect",
"Session",
"Warrant",
"Watchlist",
"get_dividends",
"get_earnings",
"get_future_fx_monthly",
"get_future_grain_monthly",
"get_future_index_monthly",
"get_future_metal_monthly",
"get_future_oil_monthly",
"get_future_option_chain",
"get_future_treasury_monthly",
"get_market_metrics",
"get_option_chain",
"get_quantity_decimal_precisions",
"get_risk_free_rate",
"get_tasty_monthly",
"get_third_friday",
"now_in_new_york",
"symbol_search",
"today_in_new_york",
]
Loading

0 comments on commit 73e17e0

Please sign in to comment.