The Tastytrade API, which my Python module relies on, is currently in beta.
A Python client for the Tastytrade API, providing convenient access to Tastytrade's REST API for trading, account management, and more.
Install the package using pip:
pip install tastytrade-api
Here's an example of how to use the Tastytrade API client:
from tastytrade_api.authentication import TastytradeAuth
username = "your_username"
password = "your_password"
# Initialize the authentication object
auth = TastytradeAuth(username, password)
# Log in to the API
auth_data = auth.login()
if auth_data:
print("Successfully logged in!")
else:
print("Failed to log in.")
# Validate the session
is_valid = auth.validate_session()
if is_valid:
print("Session is valid.")
else:
print("Session is invalid or expired.")
# Destroy the session (log out)
if auth.destroy_session():
print("Successfully logged out.")
else:
print("Failed to log out.")
To run tests, first install the required development packages:
pip install -r requirements-dev.txt
Then, execute the tests using unittest:
python -m unittest discover
This project is licensed under the MIT License. See the LICENSE file for details.