Skip to content

Commit 202655e

Browse files
committed
remove 3.8 support
1 parent db59e4e commit 202655e

17 files changed

+175
-188
lines changed

Diff for: .github/workflows/python-app.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
- name: Set up Python 3.8
14+
- name: Set up Python 3.9
1515
uses: actions/setup-python@v4
1616
with:
17-
python-version: '3.8'
17+
python-version: '3.9'
1818
- uses: yezz123/setup-uv@v4
1919
- name: Setup uv venv
2020
run: |

Diff for: .python-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.8
1+
3.9

Diff for: Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
install:
44
uv sync
5+
uv pip install -e .
56

67
lint:
78
uv run ruff format tastytrade/ tests/

Diff for: docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
project = "tastytrade"
1414
copyright = "2024, Graeme Holliday"
1515
author = "Graeme Holliday"
16-
release = "9.1"
16+
release = "9.2"
1717

1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -23,7 +23,7 @@
2323
"sphinx.ext.doctest",
2424
"sphinx.ext.autodoc",
2525
"sphinx.ext.autosummary",
26-
"sphinx.ext.intersphinx",
26+
# "sphinx.ext.intersphinx",
2727
"sphinx_toolbox.more_autodoc.autotypeddict",
2828
"enum_tools.autoenum",
2929
"sphinxcontrib.autodoc_pydantic",

Diff for: pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "tastytrade"
7-
version = "9.1"
7+
version = "9.2"
88
description = "An unofficial, sync/async SDK for Tastytrade!"
99
readme = "README.md"
1010
requires-python = ">=3.8"
@@ -29,7 +29,6 @@ dev-dependencies = [
2929
"pytest-aio>=1.5.0",
3030
"pytest-cov>=5.0.0",
3131
"ruff>=0.6.9",
32-
"types-pytz>=2024.2.0.20241003",
3332
"pyright>=1.1.384",
3433
]
3534

Diff for: tastytrade/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
BACKTEST_URL = "https://backtester.vast.tastyworks.com"
55
CERT_URL = "https://api.cert.tastyworks.com"
66
VAST_URL = "https://vast.tastyworks.com"
7-
VERSION = "9.1"
7+
VERSION = "9.2"
88

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

Diff for: tastytrade/account.py

+34-34
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import date, datetime
22
from decimal import Decimal
3-
from typing import Any, Dict, List, Literal, Optional, Union
3+
from typing import Any, Literal, Optional, Union
44

55
import httpx
66
from pydantic import BaseModel, model_validator
@@ -229,7 +229,7 @@ class MarginReportEntry(TastytradeJsonDataclass):
229229
margin_requirement: Decimal
230230
expected_price_range_up_percent: Optional[Decimal] = None
231231
expected_price_range_down_percent: Optional[Decimal] = None
232-
groups: Optional[List[Dict[str, Any]]] = None
232+
groups: Optional[list[dict[str, Any]]] = None
233233
initial_requirement: Optional[Decimal] = None
234234
maintenance_requirement: Optional[Decimal] = None
235235
point_of_no_return_percent: Optional[Decimal] = None
@@ -269,7 +269,7 @@ class MarginReport(TastytradeJsonDataclass):
269269
reg_t_option_buying_power: Decimal
270270
maintenance_excess: Decimal
271271
last_state_timestamp: int
272-
groups: List[Union[MarginReportEntry, EmptyDict]]
272+
groups: list[Union[MarginReportEntry, EmptyDict]]
273273
initial_requirement: Optional[Decimal] = None
274274

275275
@model_validator(mode="before")
@@ -430,7 +430,7 @@ class Transaction(TastytradeJsonDataclass):
430430
other_charge_description: Optional[str] = None
431431
reverses_id: Optional[int] = None
432432
cost_basis_reconciliation_date: Optional[date] = None
433-
lots: Optional[List[Lot]] = None
433+
lots: Optional[list[Lot]] = None
434434
agency_price: Optional[Decimal] = None
435435
principal_price: Optional[Decimal] = None
436436

@@ -484,7 +484,7 @@ class Account(TastytradeJsonDataclass):
484484
submitting_user_id: Optional[str] = None
485485

486486
@classmethod
487-
async def a_get_accounts(cls, session: Session, include_closed=False) -> List[Self]:
487+
async def a_get_accounts(cls, session: Session, include_closed=False) -> list[Self]:
488488
"""
489489
Gets all trading accounts associated with the Tastytrade user.
490490
@@ -500,7 +500,7 @@ async def a_get_accounts(cls, session: Session, include_closed=False) -> List[Se
500500
]
501501

502502
@classmethod
503-
def get_accounts(cls, session: Session, include_closed=False) -> List[Self]:
503+
def get_accounts(cls, session: Session, include_closed=False) -> list[Self]:
504504
"""
505505
Gets all trading accounts associated with the Tastytrade user.
506506
@@ -583,7 +583,7 @@ async def a_get_balance_snapshots(
583583
start_date: Optional[date] = None,
584584
snapshot_date: Optional[date] = None,
585585
time_of_day: Literal["BOD", "EOD"] = "EOD",
586-
) -> List[AccountBalanceSnapshot]:
586+
) -> list[AccountBalanceSnapshot]:
587587
"""
588588
Returns a list of balance snapshots. This list will
589589
just have a few snapshots if you don't pass a start
@@ -646,7 +646,7 @@ def get_balance_snapshots(
646646
start_date: Optional[date] = None,
647647
snapshot_date: Optional[date] = None,
648648
time_of_day: Literal["BOD", "EOD"] = "EOD",
649-
) -> List[AccountBalanceSnapshot]:
649+
) -> list[AccountBalanceSnapshot]:
650650
"""
651651
Returns a list of balance snapshots. This list will
652652
just have a few snapshots if you don't pass a start
@@ -702,15 +702,15 @@ def get_balance_snapshots(
702702
async def a_get_positions(
703703
self,
704704
session: Session,
705-
underlying_symbols: Optional[List[str]] = None,
705+
underlying_symbols: Optional[list[str]] = None,
706706
symbol: Optional[str] = None,
707707
instrument_type: Optional[InstrumentType] = None,
708708
include_closed: Optional[bool] = None,
709709
underlying_product_code: Optional[str] = None,
710-
partition_keys: Optional[List[str]] = None,
710+
partition_keys: Optional[list[str]] = None,
711711
net_positions: Optional[bool] = None,
712712
include_marks: Optional[bool] = None,
713-
) -> List[CurrentPosition]:
713+
) -> list[CurrentPosition]:
714714
"""
715715
Get the current positions of the account.
716716
@@ -747,15 +747,15 @@ async def a_get_positions(
747747
def get_positions(
748748
self,
749749
session: Session,
750-
underlying_symbols: Optional[List[str]] = None,
750+
underlying_symbols: Optional[list[str]] = None,
751751
symbol: Optional[str] = None,
752752
instrument_type: Optional[InstrumentType] = None,
753753
include_closed: Optional[bool] = None,
754754
underlying_product_code: Optional[str] = None,
755-
partition_keys: Optional[List[str]] = None,
755+
partition_keys: Optional[list[str]] = None,
756756
net_positions: Optional[bool] = None,
757757
include_marks: Optional[bool] = None,
758-
) -> List[CurrentPosition]:
758+
) -> list[CurrentPosition]:
759759
"""
760760
Get the current positions of the account.
761761
@@ -796,8 +796,8 @@ async def a_get_history(
796796
page_offset: Optional[int] = None,
797797
sort: str = "Desc",
798798
type: Optional[str] = None,
799-
types: Optional[List[str]] = None,
800-
sub_types: Optional[List[str]] = None,
799+
types: Optional[list[str]] = None,
800+
sub_types: Optional[list[str]] = None,
801801
start_date: Optional[date] = None,
802802
end_date: Optional[date] = None,
803803
instrument_type: Optional[InstrumentType] = None,
@@ -808,7 +808,7 @@ async def a_get_history(
808808
futures_symbol: Optional[str] = None,
809809
start_at: Optional[datetime] = None,
810810
end_at: Optional[datetime] = None,
811-
) -> List[Transaction]:
811+
) -> list[Transaction]:
812812
"""
813813
Get transaction history of the account.
814814
@@ -891,8 +891,8 @@ def get_history(
891891
page_offset: Optional[int] = None,
892892
sort: str = "Desc",
893893
type: Optional[str] = None,
894-
types: Optional[List[str]] = None,
895-
sub_types: Optional[List[str]] = None,
894+
types: Optional[list[str]] = None,
895+
sub_types: Optional[list[str]] = None,
896896
start_date: Optional[date] = None,
897897
end_date: Optional[date] = None,
898898
instrument_type: Optional[InstrumentType] = None,
@@ -903,7 +903,7 @@ def get_history(
903903
futures_symbol: Optional[str] = None,
904904
start_at: Optional[datetime] = None,
905905
end_at: Optional[datetime] = None,
906-
) -> List[Transaction]:
906+
) -> list[Transaction]:
907907
"""
908908
Get transaction history of the account.
909909
@@ -1036,7 +1036,7 @@ async def a_get_net_liquidating_value_history(
10361036
session: Session,
10371037
time_back: Optional[str] = None,
10381038
start_time: Optional[datetime] = None,
1039-
) -> List[NetLiqOhlc]:
1039+
) -> list[NetLiqOhlc]:
10401040
"""
10411041
Returns a list of account net liquidating value snapshots over the
10421042
specified time period.
@@ -1070,7 +1070,7 @@ def get_net_liquidating_value_history(
10701070
session: Session,
10711071
time_back: Optional[str] = None,
10721072
start_time: Optional[datetime] = None,
1073-
) -> List[NetLiqOhlc]:
1073+
) -> list[NetLiqOhlc]:
10741074
"""
10751075
Returns a list of account net liquidating value snapshots over the
10761076
specified time period.
@@ -1175,7 +1175,7 @@ def get_margin_requirements(self, session: Session) -> MarginReport:
11751175
data = session._get(f"/margin/accounts/{self.account_number}/requirements")
11761176
return MarginReport(**data)
11771177

1178-
async def a_get_live_orders(self, session: Session) -> List[PlacedOrder]:
1178+
async def a_get_live_orders(self, session: Session) -> list[PlacedOrder]:
11791179
"""
11801180
Get orders placed today for the account.
11811181
@@ -1184,7 +1184,7 @@ async def a_get_live_orders(self, session: Session) -> List[PlacedOrder]:
11841184
data = await session._a_get(f"/accounts/{self.account_number}/orders/live")
11851185
return [PlacedOrder(**i) for i in data["items"]]
11861186

1187-
def get_live_orders(self, session: Session) -> List[PlacedOrder]:
1187+
def get_live_orders(self, session: Session) -> list[PlacedOrder]:
11881188
"""
11891189
Get orders placed today for the account.
11901190
@@ -1195,7 +1195,7 @@ def get_live_orders(self, session: Session) -> List[PlacedOrder]:
11951195

11961196
async def a_get_live_complex_orders(
11971197
self, session: Session
1198-
) -> List[PlacedComplexOrder]:
1198+
) -> list[PlacedComplexOrder]:
11991199
"""
12001200
Get complex orders placed today for the account.
12011201
@@ -1206,7 +1206,7 @@ async def a_get_live_complex_orders(
12061206
)
12071207
return [PlacedComplexOrder(**i) for i in data["items"]]
12081208

1209-
def get_live_complex_orders(self, session: Session) -> List[PlacedComplexOrder]:
1209+
def get_live_complex_orders(self, session: Session) -> list[PlacedComplexOrder]:
12101210
"""
12111211
Get complex orders placed today for the account.
12121212
@@ -1309,13 +1309,13 @@ async def a_get_order_history(
13091309
start_date: Optional[date] = None,
13101310
end_date: Optional[date] = None,
13111311
underlying_symbol: Optional[str] = None,
1312-
statuses: Optional[List[OrderStatus]] = None,
1312+
statuses: Optional[list[OrderStatus]] = None,
13131313
futures_symbol: Optional[str] = None,
13141314
underlying_instrument_type: Optional[InstrumentType] = None,
13151315
sort: Optional[str] = None,
13161316
start_at: Optional[datetime] = None,
13171317
end_at: Optional[datetime] = None,
1318-
) -> List[PlacedOrder]:
1318+
) -> list[PlacedOrder]:
13191319
"""
13201320
Get order history of the account.
13211321
@@ -1390,13 +1390,13 @@ def get_order_history(
13901390
start_date: Optional[date] = None,
13911391
end_date: Optional[date] = None,
13921392
underlying_symbol: Optional[str] = None,
1393-
statuses: Optional[List[OrderStatus]] = None,
1393+
statuses: Optional[list[OrderStatus]] = None,
13941394
futures_symbol: Optional[str] = None,
13951395
underlying_instrument_type: Optional[InstrumentType] = None,
13961396
sort: Optional[str] = None,
13971397
start_at: Optional[datetime] = None,
13981398
end_at: Optional[datetime] = None,
1399-
) -> List[PlacedOrder]:
1399+
) -> list[PlacedOrder]:
14001400
"""
14011401
Get order history of the account.
14021402
@@ -1465,7 +1465,7 @@ def get_order_history(
14651465

14661466
async def a_get_complex_order_history(
14671467
self, session: Session, per_page: int = 50, page_offset: Optional[int] = None
1468-
) -> List[PlacedComplexOrder]:
1468+
) -> list[PlacedComplexOrder]:
14691469
"""
14701470
Get order history of the account.
14711471
@@ -1504,7 +1504,7 @@ async def a_get_complex_order_history(
15041504

15051505
def get_complex_order_history(
15061506
self, session: Session, per_page: int = 50, page_offset: Optional[int] = None
1507-
) -> List[PlacedComplexOrder]:
1507+
) -> list[PlacedComplexOrder]:
15081508
"""
15091509
Get order history of the account.
15101510
@@ -1653,7 +1653,7 @@ async def a_get_order_chains(
16531653
symbol: str,
16541654
start_time: datetime,
16551655
end_time: datetime,
1656-
) -> List[OrderChain]:
1656+
) -> list[OrderChain]:
16571657
"""
16581658
Get a list of order chains (open + rolls + close) for given symbol
16591659
over the given time frame, with total P/L, commissions, etc.
@@ -1692,7 +1692,7 @@ def get_order_chains(
16921692
symbol: str,
16931693
start_time: datetime,
16941694
end_time: datetime,
1695-
) -> List[OrderChain]:
1695+
) -> list[OrderChain]:
16961696
"""
16971697
Get a list of order chains (open + rolls + close) for given symbol
16981698
over the given time frame, with total P/L, commissions, etc.

Diff for: tastytrade/backtest.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import asyncio
22
from datetime import date, datetime
33
from decimal import Decimal
4-
from typing import AsyncGenerator, List, Literal, Optional
4+
from typing import AsyncGenerator, Literal, Optional
55

66
import httpx
77
from pydantic import BaseModel, Field
@@ -71,7 +71,7 @@ class Backtest(BacktestJsonDataclass):
7171
symbol: str
7272
entry_conditions: BacktestEntry
7373
exit_conditions: BacktestExit
74-
legs: List[BacktestLeg]
74+
legs: list[BacktestLeg]
7575
start_date: date
7676
end_date: date = date(2024, 7, 31)
7777
status: str = "pending"
@@ -138,9 +138,9 @@ class BacktestResults(BacktestJsonDataclass):
138138
Dataclass containing partial or finished results of a backtest.
139139
"""
140140

141-
snapshots: Optional[List[BacktestSnapshot]]
141+
snapshots: Optional[list[BacktestSnapshot]]
142142
statistics: Optional[BacktestStatistics]
143-
trials: Optional[List[BacktestTrial]]
143+
trials: Optional[list[BacktestTrial]]
144144

145145

146146
class BacktestResponse(Backtest):

0 commit comments

Comments
 (0)