11from datetime import date , datetime
22from decimal import Decimal
3- from typing import Any , Dict , List , Literal , Optional , Union
3+ from typing import Any , Literal , Optional , Union
44
55import httpx
66from 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.
0 commit comments