tastytrade.paper¶
- class tastytrade.paper.PaperAlertStreamer(session: PaperSession)¶
Bases:
AlertStreamerDesigned to mimic the behavior and API of
tastytrade.AlertStreamer. Currently only supports listening to orders.
- class tastytrade.paper.PaperSession(api_key: str, **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¶
user’s paper API key, buy one at https://tastyware.dev/login
-
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 automated testing.