tastytrade 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.claude/commands/release-pr.md +108 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +29 -0
- data/.github/ISSUE_TEMPLATE/roadmap_task.md +34 -0
- data/.github/dependabot.yml +11 -0
- data/.github/workflows/main.yml +75 -0
- data/.rspec +3 -0
- data/.rubocop.yml +101 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +100 -0
- data/CLAUDE.md +78 -0
- data/CODE_OF_CONDUCT.md +81 -0
- data/CONTRIBUTING.md +89 -0
- data/DISCLAIMER.md +54 -0
- data/LICENSE.txt +24 -0
- data/README.md +235 -0
- data/ROADMAP.md +157 -0
- data/Rakefile +17 -0
- data/SECURITY.md +48 -0
- data/docs/getting_started.md +48 -0
- data/docs/python_sdk_analysis.md +181 -0
- data/exe/tastytrade +8 -0
- data/lib/tastytrade/cli.rb +604 -0
- data/lib/tastytrade/cli_config.rb +79 -0
- data/lib/tastytrade/cli_helpers.rb +178 -0
- data/lib/tastytrade/client.rb +117 -0
- data/lib/tastytrade/keyring_store.rb +72 -0
- data/lib/tastytrade/models/account.rb +129 -0
- data/lib/tastytrade/models/account_balance.rb +75 -0
- data/lib/tastytrade/models/base.rb +47 -0
- data/lib/tastytrade/models/current_position.rb +155 -0
- data/lib/tastytrade/models/user.rb +23 -0
- data/lib/tastytrade/models.rb +7 -0
- data/lib/tastytrade/session.rb +164 -0
- data/lib/tastytrade/session_manager.rb +160 -0
- data/lib/tastytrade/version.rb +5 -0
- data/lib/tastytrade.rb +31 -0
- data/sig/tastytrade.rbs +4 -0
- data/spec/exe/tastytrade_spec.rb +104 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/tastytrade/cli_accounts_spec.rb +166 -0
- data/spec/tastytrade/cli_auth_spec.rb +216 -0
- data/spec/tastytrade/cli_config_spec.rb +180 -0
- data/spec/tastytrade/cli_helpers_spec.rb +248 -0
- data/spec/tastytrade/cli_interactive_spec.rb +54 -0
- data/spec/tastytrade/cli_logout_spec.rb +121 -0
- data/spec/tastytrade/cli_select_spec.rb +174 -0
- data/spec/tastytrade/cli_status_spec.rb +206 -0
- data/spec/tastytrade/client_spec.rb +210 -0
- data/spec/tastytrade/keyring_store_spec.rb +168 -0
- data/spec/tastytrade/models/account_balance_spec.rb +247 -0
- data/spec/tastytrade/models/account_spec.rb +206 -0
- data/spec/tastytrade/models/base_spec.rb +61 -0
- data/spec/tastytrade/models/current_position_spec.rb +444 -0
- data/spec/tastytrade/models/user_spec.rb +58 -0
- data/spec/tastytrade/session_manager_spec.rb +296 -0
- data/spec/tastytrade/session_spec.rb +392 -0
- data/spec/tastytrade_spec.rb +9 -0
- metadata +303 -0
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# Contributing to Tastytrade
|
2
|
+
|
3
|
+
First off, thank you for considering contributing to Tastytrade! It's people like you that make Tastytrade such a great tool.
|
4
|
+
|
5
|
+
## Code of Conduct
|
6
|
+
|
7
|
+
This project and everyone participating in it is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
8
|
+
|
9
|
+
## How Can I Contribute?
|
10
|
+
|
11
|
+
### Reporting Bugs
|
12
|
+
|
13
|
+
Before creating bug reports, please check existing issues as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
|
14
|
+
|
15
|
+
* **Use a clear and descriptive title**
|
16
|
+
* **Describe the exact steps to reproduce the problem**
|
17
|
+
* **Provide specific examples to demonstrate the steps**
|
18
|
+
* **Describe the behavior you observed and what behavior you expected**
|
19
|
+
* **Include Ruby version, gem version, and OS information**
|
20
|
+
|
21
|
+
### Suggesting Enhancements
|
22
|
+
|
23
|
+
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
|
24
|
+
|
25
|
+
* **Use a clear and descriptive title**
|
26
|
+
* **Provide a step-by-step description of the suggested enhancement**
|
27
|
+
* **Provide specific examples to demonstrate the steps**
|
28
|
+
* **Describe the current behavior and explain the expected behavior**
|
29
|
+
* **Explain why this enhancement would be useful**
|
30
|
+
|
31
|
+
### Pull Requests
|
32
|
+
|
33
|
+
1. Fork the repo and create your branch from `main`
|
34
|
+
2. If you've added code that should be tested, add tests
|
35
|
+
3. If you've changed APIs, update the documentation
|
36
|
+
4. Ensure the test suite passes (`bundle exec rake`)
|
37
|
+
5. Make sure your code follows the style guidelines (`bundle exec rubocop`)
|
38
|
+
6. Issue that pull request!
|
39
|
+
|
40
|
+
## Development Setup
|
41
|
+
|
42
|
+
1. Fork and clone the repo
|
43
|
+
2. Run `bin/setup` to install dependencies
|
44
|
+
3. Run `bundle exec rake spec` to run the tests
|
45
|
+
4. Run `bin/console` for an interactive prompt
|
46
|
+
|
47
|
+
## Style Guidelines
|
48
|
+
|
49
|
+
### Ruby Style Guide
|
50
|
+
|
51
|
+
We use RuboCop with a few customizations. Run `bundle exec rubocop` to check your code.
|
52
|
+
|
53
|
+
Key points:
|
54
|
+
* Use double quotes for strings
|
55
|
+
* Keep lines under 120 characters
|
56
|
+
* Write descriptive commit messages
|
57
|
+
|
58
|
+
### Commit Messages
|
59
|
+
|
60
|
+
* Use the present tense ("Add feature" not "Added feature")
|
61
|
+
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
|
62
|
+
* Limit the first line to 72 characters or less
|
63
|
+
* Reference issues and pull requests liberally after the first line
|
64
|
+
|
65
|
+
## Testing
|
66
|
+
|
67
|
+
* Write RSpec tests for all new functionality
|
68
|
+
* Ensure all tests pass before submitting PR
|
69
|
+
* Aim for high test coverage but focus on testing behavior, not implementation
|
70
|
+
* Use descriptive test names that explain what is being tested
|
71
|
+
|
72
|
+
## Documentation
|
73
|
+
|
74
|
+
* Update the README.md with details of changes to the interface
|
75
|
+
* Update the CHANGELOG.md following the Keep a Changelog format
|
76
|
+
* Comment your code where necessary
|
77
|
+
* Use YARD documentation for public APIs
|
78
|
+
|
79
|
+
## Release Process
|
80
|
+
|
81
|
+
Maintainers will handle releases, but for reference:
|
82
|
+
|
83
|
+
1. Update version number in `lib/tastytrade/version.rb`
|
84
|
+
2. Update CHANGELOG.md
|
85
|
+
3. Run `bundle exec rake release`
|
86
|
+
|
87
|
+
## Questions?
|
88
|
+
|
89
|
+
Feel free to open an issue with the "question" label if you have any questions about contributing.
|
data/DISCLAIMER.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# DISCLAIMER
|
2
|
+
|
3
|
+
## Unofficial SDK Notice
|
4
|
+
|
5
|
+
This is an **UNOFFICIAL** Ruby SDK for the Tastytrade API. This project is:
|
6
|
+
|
7
|
+
- ❌ NOT affiliated with Tastytrade or Tastyworks
|
8
|
+
- ❌ NOT endorsed by Tastytrade or Tastyworks
|
9
|
+
- ❌ NOT sponsored by Tastytrade or Tastyworks
|
10
|
+
- ✅ An independent open-source project
|
11
|
+
|
12
|
+
## Financial Risk Disclaimer
|
13
|
+
|
14
|
+
**⚠️ IMPORTANT: PLEASE READ CAREFULLY**
|
15
|
+
|
16
|
+
### Investment Risks
|
17
|
+
- Trading securities, options, futures, and other financial instruments involves **substantial risk of loss**
|
18
|
+
- You may lose some or **all of your invested capital**
|
19
|
+
- Past performance is **not indicative** of future results
|
20
|
+
- Options trading involves additional risks and is not suitable for all investors
|
21
|
+
|
22
|
+
### No Financial Advice
|
23
|
+
- This software is provided for **educational and informational purposes only**
|
24
|
+
- Nothing in this software constitutes financial advice, investment advice, or trading recommendations
|
25
|
+
- The authors are not financial advisors, brokers, or dealers
|
26
|
+
- Always consult with a **qualified financial advisor** before making investment decisions
|
27
|
+
|
28
|
+
### Your Responsibilities
|
29
|
+
- You are **solely responsible** for your investment and trading decisions
|
30
|
+
- You must understand the risks involved in trading before using this software
|
31
|
+
- You should paper trade or use a demo account before trading with real money
|
32
|
+
- You must comply with all applicable laws and regulations in your jurisdiction
|
33
|
+
|
34
|
+
### Software Disclaimer
|
35
|
+
- This software is provided "AS IS" without warranty of any kind
|
36
|
+
- The authors assume no responsibility for errors or omissions
|
37
|
+
- The authors are not liable for any losses or damages arising from the use of this software
|
38
|
+
- There is no guarantee that this software will meet your requirements or be error-free
|
39
|
+
|
40
|
+
### API Usage
|
41
|
+
- You are responsible for complying with Tastytrade's Terms of Service
|
42
|
+
- Excessive API usage may result in rate limiting or account suspension by Tastytrade
|
43
|
+
- Your API credentials are your responsibility - keep them secure
|
44
|
+
|
45
|
+
### Regulatory Compliance
|
46
|
+
- Securities trading is regulated by various governmental and self-regulatory organizations
|
47
|
+
- You are responsible for ensuring your trading activities comply with all applicable regulations
|
48
|
+
- This software does not provide regulatory or compliance advice
|
49
|
+
|
50
|
+
## Acceptance of Terms
|
51
|
+
|
52
|
+
By using this software, you acknowledge that you have read, understood, and agree to be bound by these disclaimers and accept all risks associated with using this software for trading purposes.
|
53
|
+
|
54
|
+
**If you do not agree with these terms, do not use this software.**
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Ryan Hamamura
|
4
|
+
|
5
|
+
IMPORTANT: This software is subject to additional disclaimers.
|
6
|
+
Please read DISCLAIMER.md before using this software.
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
10
|
+
in the Software without restriction, including without limitation the rights
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
13
|
+
furnished to do so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
16
|
+
all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
# Tastytrade Ruby SDK (Unofficial)
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/tastytrade)
|
4
|
+
[](https://github.com/ryanhamamura/tastytrade/actions/workflows/main.yml)
|
5
|
+
[](https://github.com/rubocop/rubocop)
|
6
|
+
|
7
|
+
> An unofficial Ruby SDK for the Tastytrade API
|
8
|
+
|
9
|
+
**⚠️ IMPORTANT DISCLAIMER**: This is an **unofficial** SDK and is not affiliated with, endorsed by, or sponsored by Tastytrade, Tastyworks, or any of their affiliates. This is an independent project created to help Ruby developers interact with the Tastytrade API.
|
10
|
+
|
11
|
+
This Ruby gem provides a simple interface to interact with the Tastytrade API, allowing you to:
|
12
|
+
- Authenticate with your Tastytrade account
|
13
|
+
- Retrieve account information and balances
|
14
|
+
- Access market data
|
15
|
+
- Place and manage orders
|
16
|
+
- Monitor positions and transactions
|
17
|
+
|
18
|
+
## Features
|
19
|
+
|
20
|
+
- Secure authentication with Tastytrade API
|
21
|
+
- Real-time market data access
|
22
|
+
- Account management and portfolio tracking
|
23
|
+
- Order placement and management
|
24
|
+
- Position monitoring
|
25
|
+
- Transaction history
|
26
|
+
|
27
|
+
## Roadmap
|
28
|
+
|
29
|
+
See [ROADMAP.md](ROADMAP.md) for the detailed development roadmap. Track progress on our [GitHub Project Board](https://github.com/users/ryanhamamura/projects/1).
|
30
|
+
|
31
|
+
## Installation
|
32
|
+
|
33
|
+
Add this line to your application's Gemfile:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
gem 'tastytrade'
|
37
|
+
```
|
38
|
+
|
39
|
+
And then execute:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
bundle install
|
43
|
+
```
|
44
|
+
|
45
|
+
Or install it yourself as:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
gem install tastytrade
|
49
|
+
```
|
50
|
+
|
51
|
+
## Usage
|
52
|
+
|
53
|
+
### Authentication
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
require 'tastytrade'
|
57
|
+
|
58
|
+
# Create a session
|
59
|
+
session = Tastytrade::Session.new(
|
60
|
+
username: 'your_username',
|
61
|
+
password: 'your_password',
|
62
|
+
remember_me: true # Optional: enables session refresh with remember token
|
63
|
+
)
|
64
|
+
|
65
|
+
# Login
|
66
|
+
session.login
|
67
|
+
|
68
|
+
# Check if authenticated
|
69
|
+
session.authenticated? # => true
|
70
|
+
|
71
|
+
# Session will automatically refresh when expired if remember_me was enabled
|
72
|
+
```
|
73
|
+
|
74
|
+
### CLI Usage
|
75
|
+
|
76
|
+
The gem includes a command-line interface for common operations:
|
77
|
+
|
78
|
+
```bash
|
79
|
+
# Login to your account
|
80
|
+
tastytrade login
|
81
|
+
|
82
|
+
# Login with remember option for automatic session refresh
|
83
|
+
tastytrade login --remember
|
84
|
+
|
85
|
+
# View account balances
|
86
|
+
tastytrade balance
|
87
|
+
|
88
|
+
# View balances for all accounts
|
89
|
+
tastytrade balance --all
|
90
|
+
|
91
|
+
# List all accounts
|
92
|
+
tastytrade accounts
|
93
|
+
|
94
|
+
# Select an account
|
95
|
+
tastytrade select
|
96
|
+
|
97
|
+
# Check session status
|
98
|
+
tastytrade status
|
99
|
+
|
100
|
+
# Refresh session (requires remember token)
|
101
|
+
tastytrade refresh
|
102
|
+
|
103
|
+
# Logout
|
104
|
+
tastytrade logout
|
105
|
+
```
|
106
|
+
|
107
|
+
### Account Information
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
# Get all accounts
|
111
|
+
accounts = Tastytrade::Models::Account.get_all(session)
|
112
|
+
|
113
|
+
# Get specific account
|
114
|
+
account = Tastytrade::Models::Account.get(session, 'account_number')
|
115
|
+
|
116
|
+
# Check account status
|
117
|
+
account.closed? # => false
|
118
|
+
account.futures_approved? # => true
|
119
|
+
```
|
120
|
+
|
121
|
+
### Account Balances
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
# Get account balance
|
125
|
+
balance = account.get_balances(session)
|
126
|
+
|
127
|
+
# Access balance information
|
128
|
+
balance.cash_balance # => BigDecimal("10000.50")
|
129
|
+
balance.net_liquidating_value # => BigDecimal("42001.00")
|
130
|
+
balance.equity_buying_power # => BigDecimal("20000.00")
|
131
|
+
balance.available_trading_funds # => BigDecimal("12000.00")
|
132
|
+
|
133
|
+
# Check buying power usage
|
134
|
+
balance.buying_power_usage_percentage # => BigDecimal("40.00")
|
135
|
+
balance.high_buying_power_usage? # => false (checks if > 80%)
|
136
|
+
|
137
|
+
# Calculate totals
|
138
|
+
balance.total_equity_value # => BigDecimal("30001.00")
|
139
|
+
balance.total_derivative_value # => BigDecimal("4500.00")
|
140
|
+
balance.total_market_value # => BigDecimal("34501.00")
|
141
|
+
```
|
142
|
+
|
143
|
+
### Positions
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
# Get all positions
|
147
|
+
positions = account.get_positions(session)
|
148
|
+
|
149
|
+
# Filter positions
|
150
|
+
positions = account.get_positions(session,
|
151
|
+
symbol: 'AAPL',
|
152
|
+
underlying_symbol: 'AAPL',
|
153
|
+
include_closed: false
|
154
|
+
)
|
155
|
+
|
156
|
+
# Work with positions
|
157
|
+
positions.each do |position|
|
158
|
+
puts position.symbol
|
159
|
+
puts position.quantity
|
160
|
+
puts position.unrealized_pnl
|
161
|
+
puts position.unrealized_pnl_percentage
|
162
|
+
|
163
|
+
# Check position type
|
164
|
+
position.equity? # => true
|
165
|
+
position.option? # => false
|
166
|
+
position.long? # => true
|
167
|
+
position.short? # => false
|
168
|
+
end
|
169
|
+
```
|
170
|
+
|
171
|
+
## Development
|
172
|
+
|
173
|
+
After checking out the repo, run `bin/setup` to install dependencies and verify your environment is configured correctly.
|
174
|
+
|
175
|
+
Run tests with:
|
176
|
+
```bash
|
177
|
+
bundle exec rake spec
|
178
|
+
```
|
179
|
+
|
180
|
+
Run linting with:
|
181
|
+
```bash
|
182
|
+
bundle exec rake rubocop
|
183
|
+
```
|
184
|
+
|
185
|
+
For an interactive console:
|
186
|
+
```bash
|
187
|
+
bin/console
|
188
|
+
```
|
189
|
+
|
190
|
+
To install this gem onto your local machine:
|
191
|
+
```bash
|
192
|
+
bundle exec rake install
|
193
|
+
```
|
194
|
+
|
195
|
+
## Documentation
|
196
|
+
|
197
|
+
TODO: Add links to additional documentation
|
198
|
+
- [API Documentation](https://rubydoc.info/gems/tastytrade)
|
199
|
+
- [Wiki](https://github.com/ryanhamamura/tastytrade/wiki)
|
200
|
+
|
201
|
+
## Contributing
|
202
|
+
|
203
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ryanhamamura/tastytrade. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ryanhamamura/tastytrade/blob/main/CODE_OF_CONDUCT.md).
|
204
|
+
|
205
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
206
|
+
|
207
|
+
## Security
|
208
|
+
|
209
|
+
Please see our [security policy](SECURITY.md) for reporting vulnerabilities.
|
210
|
+
|
211
|
+
## License
|
212
|
+
|
213
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
214
|
+
|
215
|
+
## Code of Conduct
|
216
|
+
|
217
|
+
Everyone interacting in the Tastytrade project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ryanhamamura/tastytrade/blob/main/CODE_OF_CONDUCT.md).
|
218
|
+
|
219
|
+
## Legal Disclaimer
|
220
|
+
|
221
|
+
**⚠️ IMPORTANT FINANCIAL DISCLAIMER**
|
222
|
+
|
223
|
+
This software is provided for educational and informational purposes only. It is not intended to be used as financial advice, investment advice, or as a recommendation to buy, sell, or hold any securities or financial instruments.
|
224
|
+
|
225
|
+
**TRADING RISKS**: Trading securities, options, futures, and other financial instruments involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results. You may lose some or all of your invested capital.
|
226
|
+
|
227
|
+
**NO WARRANTY**: This software is provided "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
|
228
|
+
|
229
|
+
**YOUR RESPONSIBILITY**: You are solely responsible for any investment and trading decisions you make using this software. You should consult with a qualified financial advisor before making any investment decisions.
|
230
|
+
|
231
|
+
**API USAGE**: By using this SDK, you are responsible for complying with Tastytrade's Terms of Service and API usage guidelines. Excessive API usage may result in rate limiting or account suspension by Tastytrade.
|
232
|
+
|
233
|
+
**NOT AFFILIATED**: This project is not affiliated with, endorsed by, or sponsored by Tastytrade, Tastyworks, or any of their affiliates. All trademarks and registered trademarks are the property of their respective owners.
|
234
|
+
|
235
|
+
The authors and contributors of this software shall not be held liable for any losses, damages, or costs of any kind arising from the use of this software.
|
data/ROADMAP.md
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
# Tastytrade Ruby SDK Roadmap
|
2
|
+
|
3
|
+
This document outlines the development roadmap for the unofficial Tastytrade Ruby SDK. Track progress via [GitHub Projects](https://github.com/users/ryanhamamura/projects/1).
|
4
|
+
|
5
|
+
## Project Goals
|
6
|
+
|
7
|
+
- Port the Python Tastytrade SDK to Ruby with idiomatic Ruby patterns
|
8
|
+
- Provide both synchronous and asynchronous API support
|
9
|
+
- Include a powerful CLI tool within the same gem
|
10
|
+
- Maintain comprehensive test coverage and documentation
|
11
|
+
|
12
|
+
## Development Phases
|
13
|
+
|
14
|
+
### Phase 1: Core SDK Foundation
|
15
|
+
**Target: Q3 2025 (July - September)**
|
16
|
+
|
17
|
+
#### Authentication & Session Management
|
18
|
+
- [x] Basic session class with login/logout (closes #1)
|
19
|
+
- [x] Token management and refresh (closes #2)
|
20
|
+
- [x] Production/sandbox environment support (closes #3)
|
21
|
+
- [x] Credentials storage (secure) (closes #4)
|
22
|
+
- [x] Session validation and error handling (closes #5)
|
23
|
+
|
24
|
+
#### Account Operations
|
25
|
+
- [x] Fetch account info and balances (closes #6)
|
26
|
+
- [x] Get positions
|
27
|
+
- [ ] Get transaction history
|
28
|
+
- [ ] Calculate buying power
|
29
|
+
- [ ] Account status and trading permissions
|
30
|
+
|
31
|
+
#### Basic Trading
|
32
|
+
- [ ] Place equity orders (market, limit)
|
33
|
+
- [ ] Cancel/replace orders
|
34
|
+
- [ ] Get order status
|
35
|
+
- [ ] Order validation
|
36
|
+
- [ ] Basic order types (day, GTC)
|
37
|
+
|
38
|
+
#### Core Infrastructure
|
39
|
+
- [x] HTTP client setup (Faraday) (closes #16)
|
40
|
+
- [x] Error handling framework (closes #17)
|
41
|
+
- [ ] Logging system
|
42
|
+
- [x] Configuration management (closes #19)
|
43
|
+
- [x] Basic data models (using dry-struct) (closes #20)
|
44
|
+
|
45
|
+
### Phase 2: Advanced SDK Features
|
46
|
+
**Target: Q4 2025 (October - December)**
|
47
|
+
|
48
|
+
#### Options Trading
|
49
|
+
- [ ] Option chain retrieval
|
50
|
+
- [ ] Options orders (single leg)
|
51
|
+
- [ ] Multi-leg strategies (spreads, strangles, iron condors)
|
52
|
+
- [ ] Greeks calculation
|
53
|
+
- [ ] Options-specific validations
|
54
|
+
|
55
|
+
#### Advanced Order Types
|
56
|
+
- [ ] Stop/stop-limit orders
|
57
|
+
- [ ] OCO (One-Cancels-Other)
|
58
|
+
- [ ] Trailing stops
|
59
|
+
- [ ] Conditional orders
|
60
|
+
- [ ] Order grouping
|
61
|
+
|
62
|
+
#### Market Data
|
63
|
+
- [ ] Real-time quotes
|
64
|
+
- [ ] Historical data
|
65
|
+
- [ ] Market hours/calendar
|
66
|
+
- [ ] Instrument search
|
67
|
+
- [ ] Watchlist management
|
68
|
+
|
69
|
+
#### Streaming Support
|
70
|
+
- [ ] WebSocket connection management
|
71
|
+
- [ ] Quote streaming (DXLink)
|
72
|
+
- [ ] Account alerts streaming
|
73
|
+
- [ ] Auto-reconnection logic
|
74
|
+
- [ ] Event handling system
|
75
|
+
|
76
|
+
### Phase 3: CLI Integration
|
77
|
+
**Target: Q1 2026 (January - March)**
|
78
|
+
|
79
|
+
#### Core CLI Commands
|
80
|
+
- [ ] Authentication (`tt login`)
|
81
|
+
- [ ] Account info (`tt account`)
|
82
|
+
- [ ] Portfolio view (`tt portfolio`)
|
83
|
+
- [ ] Basic trading (`tt trade`)
|
84
|
+
- [ ] Order management (`tt orders`)
|
85
|
+
|
86
|
+
#### Options CLI
|
87
|
+
- [ ] Option chains (`tt option chain`)
|
88
|
+
- [ ] Options trading (`tt option trade`)
|
89
|
+
- [ ] Strategy builder
|
90
|
+
- [ ] Greeks display
|
91
|
+
|
92
|
+
#### Advanced CLI Features
|
93
|
+
- [ ] Watchlist monitoring (`tt watch`)
|
94
|
+
- [ ] Portfolio analysis (`tt analyze`)
|
95
|
+
- [ ] Real-time quotes (`tt quote`)
|
96
|
+
- [ ] Configuration management (`tt config`)
|
97
|
+
- [ ] Interactive mode
|
98
|
+
|
99
|
+
#### CLI Enhancements
|
100
|
+
- [ ] Rich terminal output (TTY gems)
|
101
|
+
- [ ] Progress indicators
|
102
|
+
- [ ] Confirmation prompts
|
103
|
+
- [ ] Output formatting (JSON, CSV, table)
|
104
|
+
- [ ] Shell completion
|
105
|
+
|
106
|
+
### Phase 4: Advanced Features & Polish
|
107
|
+
**Target: Q2 2026 (April - June)**
|
108
|
+
|
109
|
+
#### Advanced Analytics
|
110
|
+
- [ ] Portfolio metrics calculation
|
111
|
+
- [ ] Risk analysis
|
112
|
+
- [ ] P&L tracking
|
113
|
+
- [ ] Tax lot management
|
114
|
+
- [ ] Performance reporting
|
115
|
+
|
116
|
+
#### Async Support
|
117
|
+
- [ ] Async HTTP client option
|
118
|
+
- [ ] Concurrent operations
|
119
|
+
- [ ] Batch operations
|
120
|
+
- [ ] Rate limiting
|
121
|
+
|
122
|
+
#### Developer Experience
|
123
|
+
- [ ] Comprehensive documentation
|
124
|
+
- [ ] Example applications
|
125
|
+
- [ ] Video tutorials
|
126
|
+
- [ ] API reference docs
|
127
|
+
- [ ] Migration guide from Python
|
128
|
+
|
129
|
+
#### Testing & Quality
|
130
|
+
- [ ] 90%+ test coverage
|
131
|
+
- [ ] Integration test suite
|
132
|
+
- [ ] Performance benchmarks
|
133
|
+
- [ ] Security audit
|
134
|
+
- [ ] Load testing
|
135
|
+
|
136
|
+
## Success Metrics
|
137
|
+
|
138
|
+
- **Test Coverage**: Maintain >90% coverage
|
139
|
+
- **Documentation**: 100% public API documented
|
140
|
+
- **Performance**: <100ms average response time
|
141
|
+
- **Reliability**: 99.9% uptime for streaming
|
142
|
+
- **Community**: Active user base and contributors
|
143
|
+
|
144
|
+
## Contributing
|
145
|
+
|
146
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to help with development.
|
147
|
+
|
148
|
+
## Notes
|
149
|
+
|
150
|
+
- Each phase builds upon the previous one
|
151
|
+
- Phases may overlap as development progresses
|
152
|
+
- Community feedback will influence priorities
|
153
|
+
- Breaking changes will be minimized after v1.0
|
154
|
+
|
155
|
+
---
|
156
|
+
|
157
|
+
Last Updated: 2025-07-30
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
require "rubocop/rake_task"
|
6
|
+
require "bundler/audit/task"
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
+
t.pattern = Dir.glob("spec/**/*_spec.rb")
|
10
|
+
end
|
11
|
+
RuboCop::RakeTask.new
|
12
|
+
Bundler::Audit::Task.new
|
13
|
+
|
14
|
+
desc "Run all checks (tests, style, security)"
|
15
|
+
task check: %i[spec rubocop bundle:audit]
|
16
|
+
|
17
|
+
task default: :check
|
data/SECURITY.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
## Supported Versions
|
4
|
+
|
5
|
+
Currently supported versions for security updates:
|
6
|
+
|
7
|
+
| Version | Supported |
|
8
|
+
| ------- | ------------------ |
|
9
|
+
| 0.1.x | :white_check_mark: |
|
10
|
+
|
11
|
+
## Reporting a Vulnerability
|
12
|
+
|
13
|
+
We take security vulnerabilities seriously. If you discover a security vulnerability within Tastytrade, please follow these steps:
|
14
|
+
|
15
|
+
1. **DO NOT** create a public GitHub issue for the vulnerability
|
16
|
+
2. Email your findings to `security@tastytrade.com` (replace with actual email)
|
17
|
+
3. Include the following in your report:
|
18
|
+
- Description of the vulnerability
|
19
|
+
- Steps to reproduce
|
20
|
+
- Potential impact
|
21
|
+
- Suggested fix (if any)
|
22
|
+
|
23
|
+
## Response Timeline
|
24
|
+
|
25
|
+
- **Initial Response**: Within 48 hours
|
26
|
+
- **Status Update**: Within 5 business days
|
27
|
+
- **Resolution Target**:
|
28
|
+
- Critical: 7 days
|
29
|
+
- High: 14 days
|
30
|
+
- Medium: 30 days
|
31
|
+
- Low: 60 days
|
32
|
+
|
33
|
+
## Security Update Process
|
34
|
+
|
35
|
+
1. Security patches will be released as soon as possible
|
36
|
+
2. Announcements will be made through:
|
37
|
+
- GitHub Security Advisories
|
38
|
+
- RubyGems.org
|
39
|
+
- Project mailing list (if applicable)
|
40
|
+
|
41
|
+
## Best Practices for Users
|
42
|
+
|
43
|
+
- Keep your gem version up to date
|
44
|
+
- Review the CHANGELOG for security updates
|
45
|
+
- Follow the principle of least privilege
|
46
|
+
- Report suspicious behavior
|
47
|
+
|
48
|
+
Thank you for helping keep Tastytrade and its users safe!
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Getting Started with Tastytrade Ruby SDK (Unofficial)
|
2
|
+
|
3
|
+
## ⚠️ Important Notice
|
4
|
+
|
5
|
+
This is an **UNOFFICIAL** SDK for the Tastytrade API. Please read the [DISCLAIMER](../DISCLAIMER.md) before proceeding.
|
6
|
+
|
7
|
+
## Prerequisites
|
8
|
+
|
9
|
+
Before you begin, ensure you have:
|
10
|
+
- Ruby 3.2.0 or higher
|
11
|
+
- Bundler gem installed
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
### Via Gemfile
|
16
|
+
|
17
|
+
Add to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'tastytrade'
|
21
|
+
```
|
22
|
+
|
23
|
+
Then run:
|
24
|
+
```bash
|
25
|
+
bundle install
|
26
|
+
```
|
27
|
+
|
28
|
+
### Direct Installation
|
29
|
+
|
30
|
+
```bash
|
31
|
+
gem install tastytrade
|
32
|
+
```
|
33
|
+
|
34
|
+
## Quick Start
|
35
|
+
|
36
|
+
TODO: Add quick start example
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
require 'tastytrade'
|
40
|
+
|
41
|
+
# Your first Tastytrade code
|
42
|
+
```
|
43
|
+
|
44
|
+
## Next Steps
|
45
|
+
|
46
|
+
- Read the [API Documentation](https://rubydoc.info/gems/tastytrade)
|
47
|
+
- Check out [examples](../examples)
|
48
|
+
- Learn about [advanced features](advanced_usage.md)
|