Skip to content

Commit f378dd2

Browse files
committed
more utilities coverage
1 parent daf4c64 commit f378dd2

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ A simple, reverse-engineered SDK for Tastytrade built on their (now mostly publi
1616
- 95%+ unit test coverage
1717
- Comprehensive documentation
1818
- Utility functions for timezone calculations, futures monthly expiration dates, and more
19+
- Proprietary paper API for reliable testing
1920

2021
> [!TIP]
2122
> Want to see the SDK in action? Check out [tastytrade-cli](https://github.com/tastyware/tastytrade-cli), a CLI for Tastytrade that showcases many of the SDK's features.

tests/test_account.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
from tastytrade import Account, Session
99
from tastytrade.instruments import Equity
1010
from tastytrade.order import (
11+
FillInfo,
1112
NewComplexOrder,
1213
NewOrder,
1314
OrderAction,
1415
OrderTimeInForce,
1516
OrderType,
1617
PlacedOrder,
1718
)
19+
from tastytrade.utils import TastytradeError, now_in_new_york
1820

1921
pytestmark = pytest.mark.anyio
2022

@@ -136,7 +138,19 @@ async def placed_order(
136138

137139

138140
async def test_place_order(placed_order: PlacedOrder):
139-
pass
141+
assert placed_order.legs[0].multiplier == 1
142+
with pytest.raises(TastytradeError):
143+
_ = placed_order.average_fill_price()
144+
fill_price = Decimal(2)
145+
placed_order.legs[0].fills = [
146+
FillInfo(
147+
fill_id="fill",
148+
quantity=Decimal(1),
149+
fill_price=fill_price,
150+
filled_at=now_in_new_york(),
151+
)
152+
]
153+
assert placed_order.average_fill_price() == Decimal(2)
140154

141155

142156
async def test_place_notional_order(

0 commit comments

Comments
 (0)