TastyTradeAPI is a Swift library that provides a seamless interface to interact with the TastyTrade brokerage API. It simplifies the process of accessing market data, managing accounts, and executing trades on the TastyTrade platform.
- Easy authentication with TastyTrade servers
- Data models for all supported API responses
- Currently supported API routes:
- Users and Sessions
- Account Status
- Balances and Positions
- Transactions
Because TastyTradeAPI uses Async/Await to simplify API calls, TastyTradeAPI requires Swift 5.5+, and can run on the following platforms:
- iOS 13.0+
- macOS 10.15+
- Linux
Installation steps:
- Open the project you want to add TastyTradeAPI to in Xcode.
- In the menu bar, select File > Add Package Dependencies...
- Paste the URL of this repository in the search field
- Choose the version or branch you want (latest release is recommended)
- Select the target to which you want to add TastyTradeAPI
The first step to using TastyTradeAPI is setting up authentication. Authentication is done using your Tasty Trade credentials:
// Create auth object
let auth = TastyTradeAuth(
login: "your-login-here",
password: "your-password-here",
rememberMe: true,
sandbox: false
)
// Attempt to authenticate
try await auth.login()
// Tell TastyTradeAPI to use the new auth
TastyAPI.auth = auth
After setting up authentication, requests can be made very easily using the methods in TastyAPI:
// Get the trading status for an account
let status = try await TastyAPI.tradingStatus(accountNumber: "12345")
Complete documentation for TastyTradeAPI can be found here