tastytrade.paper¶
- class tastytrade.paper.PaperAlertStreamer(**kwargs)¶
Bases:
AlertStreamerCurrently only supports listening to orders.
- class tastytrade.paper.PaperSession(api_key: str | None, **client_kwargs: Any)¶
Bases:
SessionContains a session which can be used to interact with the paper trading API. Note these sessions are only valid for endpoints in the Account class.
- Parameters:¶
- api_key: str | None¶
tastyware paper API key, buy one at https://tastyware.dev/login defaults to the $TW_API_KEY environment variable
-
async create_account(name: str, margin_or_cash: 'Cash' | 'Margin' =
'Margin', initial_deposit: int =100000) Account¶ Create a new paper trading account with the given configuration.
- async delete_account(account: Account) None¶
Delete the given paper trading account along with its orders, transactions, etc.
- async deposit(account: Account, amount: Decimal) None¶
Deposit the given quantity of fake dollars into the paper trading account. Use with a negative number for withdrawals.
-
temporary_account(margin_or_cash: 'Cash' | 'Margin' =
'Margin') AsyncGenerator[Account, None]¶ Create an account for temporary use that will be cleaned up when exiting the context manager. Useful for unit testing.