tastytrade 0.2.0 → 0.3.1
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 +4 -4
- data/.claude/commands/plan.md +13 -0
- data/.claude/commands/release-pr.md +12 -0
- data/CHANGELOG.md +180 -0
- data/README.md +424 -3
- data/ROADMAP.md +17 -17
- data/lib/tastytrade/cli/history_formatter.rb +304 -0
- data/lib/tastytrade/cli/orders.rb +749 -0
- data/lib/tastytrade/cli/positions_formatter.rb +114 -0
- data/lib/tastytrade/cli.rb +701 -12
- data/lib/tastytrade/cli_helpers.rb +111 -14
- data/lib/tastytrade/client.rb +7 -0
- data/lib/tastytrade/file_store.rb +83 -0
- data/lib/tastytrade/instruments/equity.rb +42 -0
- data/lib/tastytrade/models/account.rb +160 -2
- data/lib/tastytrade/models/account_balance.rb +46 -0
- data/lib/tastytrade/models/buying_power_effect.rb +61 -0
- data/lib/tastytrade/models/live_order.rb +272 -0
- data/lib/tastytrade/models/order_response.rb +106 -0
- data/lib/tastytrade/models/order_status.rb +84 -0
- data/lib/tastytrade/models/trading_status.rb +200 -0
- data/lib/tastytrade/models/transaction.rb +151 -0
- data/lib/tastytrade/models.rb +6 -0
- data/lib/tastytrade/order.rb +191 -0
- data/lib/tastytrade/order_validator.rb +355 -0
- data/lib/tastytrade/session.rb +26 -1
- data/lib/tastytrade/session_manager.rb +43 -14
- data/lib/tastytrade/version.rb +1 -1
- data/lib/tastytrade.rb +43 -0
- data/spec/exe/tastytrade_spec.rb +1 -1
- data/spec/tastytrade/cli/positions_spec.rb +267 -0
- data/spec/tastytrade/cli_auth_spec.rb +5 -0
- data/spec/tastytrade/cli_env_login_spec.rb +199 -0
- data/spec/tastytrade/cli_helpers_spec.rb +3 -26
- data/spec/tastytrade/cli_orders_spec.rb +168 -0
- data/spec/tastytrade/cli_status_spec.rb +153 -164
- data/spec/tastytrade/file_store_spec.rb +126 -0
- data/spec/tastytrade/models/account_balance_spec.rb +103 -0
- data/spec/tastytrade/models/account_order_history_spec.rb +229 -0
- data/spec/tastytrade/models/account_order_management_spec.rb +271 -0
- data/spec/tastytrade/models/account_place_order_spec.rb +125 -0
- data/spec/tastytrade/models/account_spec.rb +86 -15
- data/spec/tastytrade/models/buying_power_effect_spec.rb +250 -0
- data/spec/tastytrade/models/live_order_json_spec.rb +144 -0
- data/spec/tastytrade/models/live_order_spec.rb +295 -0
- data/spec/tastytrade/models/order_response_spec.rb +96 -0
- data/spec/tastytrade/models/order_status_spec.rb +113 -0
- data/spec/tastytrade/models/trading_status_spec.rb +260 -0
- data/spec/tastytrade/models/transaction_spec.rb +236 -0
- data/spec/tastytrade/order_edge_cases_spec.rb +163 -0
- data/spec/tastytrade/order_spec.rb +201 -0
- data/spec/tastytrade/order_validator_spec.rb +347 -0
- data/spec/tastytrade/session_env_spec.rb +169 -0
- data/spec/tastytrade/session_manager_spec.rb +43 -33
- metadata +34 -18
- data/lib/tastytrade/keyring_store.rb +0 -72
- data/spec/tastytrade/keyring_store_spec.rb +0 -168
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc1c01296e2566f4fc37858644a653d88592959a377bf2170872e469a7364875
|
4
|
+
data.tar.gz: 1358a0e80d2cb413336edd44b0a38fdeecb21a57c6dafd23358b183f570a426f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2f378a230782d89ebaa843c155f6086c2d31bd1c21976179b8da38d7712533e3632a33d2ac5cdb41d88e5d24fa3fba1228e0c748f4efa2f6d41a9ce04af9854
|
7
|
+
data.tar.gz: ddbdcd65ef55e82501617202fdf9f3b6dbeb32f87b439fcbe04a357988c13097041662550450f57e31e608434e63ec4d9148ea09c50b09401298daa218ced886
|
@@ -0,0 +1,13 @@
|
|
1
|
+
We will implement issue $ARGUMENTS. Please review the issues first to understand what we're doing. You will
|
2
|
+
then spawn multiple concurrent subagents in parallel to do the following:
|
3
|
+
|
4
|
+
- one will review the codebase to research the integration points for the new code or code to modify. If
|
5
|
+
the feature has already been implemented they will make note of that.
|
6
|
+
- one will review the tastytrade python SDK reference to compare the implementation to fully explain
|
7
|
+
what features we are copying.
|
8
|
+
- one will review the tastytrade python SDK cli tool reference to fully explain what features we are
|
9
|
+
trying to copy.
|
10
|
+
|
11
|
+
You will then take the output from the subagents to compile an implementation plan and update the todos
|
12
|
+
to fully encapsulate the work down to the smallest possible unit of work. You will not continue until I
|
13
|
+
approve the plan.
|
@@ -86,6 +86,18 @@ Create a release PR following Ruby gem best practices.
|
|
86
86
|
After merging this PR:
|
87
87
|
1. \`git checkout main && git pull\`
|
88
88
|
2. \`bundle exec rake release\`
|
89
|
+
3. Create a GitHub Release:
|
90
|
+
\`\`\`bash
|
91
|
+
gh release create v<VERSION> \\
|
92
|
+
--title "v<VERSION>" \\
|
93
|
+
--generate-notes \\
|
94
|
+
--draft
|
95
|
+
\`\`\`
|
96
|
+
4. Edit the draft release to add a summary section at the top with key highlights
|
97
|
+
5. Publish the release:
|
98
|
+
\`\`\`bash
|
99
|
+
gh release edit v<VERSION> --draft=false
|
100
|
+
\`\`\`
|
89
101
|
|
90
102
|
Note: The rake release command will automatically create and push the git tag v<VERSION>"
|
91
103
|
```
|
data/CHANGELOG.md
CHANGED
@@ -25,6 +25,186 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
25
25
|
### Security
|
26
26
|
- Nothing yet
|
27
27
|
|
28
|
+
## [0.3.1] - 2025-08-08
|
29
|
+
|
30
|
+
### Removed
|
31
|
+
- VCR documentation files (vcr_implementation_plan.md, vcr_implementation_research.md) that were inadvertently included in v0.3.0
|
32
|
+
- VCR gem dependency from development dependencies
|
33
|
+
- VCR configuration and setup code from spec_helper.rb
|
34
|
+
- VCR-related test tags from spec files
|
35
|
+
|
36
|
+
### Fixed
|
37
|
+
- Cleaned up test suite to remove unused VCR references
|
38
|
+
|
39
|
+
## [0.3.0] - 2025-08-08
|
40
|
+
|
41
|
+
### Added
|
42
|
+
- Order time-in-force CLI support (#15)
|
43
|
+
- Added --time-in-force option to `order place` command
|
44
|
+
- Support for DAY and GTC (Good Till Cancelled) order durations
|
45
|
+
- Accepts shorthand aliases: "d" for DAY, "g" or "good_till_cancelled" for GTC
|
46
|
+
- Defaults to DAY order when not specified (backward compatible)
|
47
|
+
- Display time-in-force in order summaries and order history tables
|
48
|
+
- Added TIF column to order list and history displays
|
49
|
+
- Complete test coverage for time-in-force parameter handling
|
50
|
+
- Note: Core Order class already had full DAY/GTC support
|
51
|
+
- Comprehensive order validation framework (#14)
|
52
|
+
- OrderValidator class with multi-layer validation checks
|
53
|
+
- Symbol validation via Instruments API
|
54
|
+
- Quantity validation with min/max constraints (1-999,999)
|
55
|
+
- Price validation with tick size rounding
|
56
|
+
- Account permissions validation using TradingStatus
|
57
|
+
- Buying power validation via dry-run API calls
|
58
|
+
- Market hours validation with warnings
|
59
|
+
- Specific error classes (OrderValidationError, InvalidSymbolError, etc.)
|
60
|
+
- Integration into Account#place_order method
|
61
|
+
- Order#validate! and Order#dry_run helper methods
|
62
|
+
- CLI `order place` command with validation support
|
63
|
+
- Dry-run mode for testing orders without submission
|
64
|
+
- Confirmation prompts with buying power impact display
|
65
|
+
- Comprehensive test coverage for all validation scenarios
|
66
|
+
- Enhanced order status and history functionality (#13)
|
67
|
+
- Account#get_order_history method for retrieving orders beyond 24 hours
|
68
|
+
- Account#get_order method for fetching individual order details
|
69
|
+
- Date range filtering for order history with from/to parameters
|
70
|
+
- Pagination support for large order history queries
|
71
|
+
- JSON output format for all order CLI commands (--format json)
|
72
|
+
- LiveOrder#to_h method for JSON serialization
|
73
|
+
- `order history` CLI command with comprehensive filtering options
|
74
|
+
- `order get` CLI command for detailed single order information
|
75
|
+
- Enhanced display_order_details method showing fills and timestamps
|
76
|
+
- Complete test coverage for new order history methods
|
77
|
+
- Order cancellation and replacement functionality (#12)
|
78
|
+
- LiveOrder model for parsing existing orders from API
|
79
|
+
- OrderStatus module with status constants and validation helpers
|
80
|
+
- Account#get_live_orders method with status/symbol/time filtering
|
81
|
+
- Account#cancel_order method with proper error handling
|
82
|
+
- Account#replace_order method with partial fill support
|
83
|
+
- Custom exceptions for order operations (OrderNotCancellableError, OrderAlreadyFilledError, etc.)
|
84
|
+
- CLI `order` subcommands structure with list/cancel/replace operations
|
85
|
+
- `order list` command with real-time order display and status filtering
|
86
|
+
- `order cancel` command with confirmation prompt and order details
|
87
|
+
- `order replace` command with interactive price/quantity modification
|
88
|
+
- Partial fill tracking with filled/remaining quantity calculations
|
89
|
+
- Order status color coding in CLI output
|
90
|
+
- Comprehensive test coverage for all order management features
|
91
|
+
- Integration tests for complete order lifecycle (place, list, modify, cancel)
|
92
|
+
- Renamed existing `order` command to `place` for clarity
|
93
|
+
- Account trading status and permissions (#10)
|
94
|
+
- TradingStatus model with 35+ fields matching Python SDK structure
|
95
|
+
- Complete account state tracking (frozen, closed, margin call, PDT status)
|
96
|
+
- Trading permissions for options, futures, cryptocurrency, and short calls
|
97
|
+
- Options trading level parsing and validation
|
98
|
+
- Pattern Day Trader (PDT) status with reset dates and day trade counts
|
99
|
+
- Portfolio margin and risk-reducing mode indicators
|
100
|
+
- Account restrictions detection and listing
|
101
|
+
- Helper methods for permission checking (can_trade_options?, can_trade_futures?, etc.)
|
102
|
+
- CLI `trading_status` command with color-coded warnings
|
103
|
+
- Visual indicators for account restrictions and margin calls
|
104
|
+
- Display of fee schedule and margin calculation type
|
105
|
+
- Full test coverage for all trading status features
|
106
|
+
- Claude command for planning multi-issue implementations
|
107
|
+
- `.claude/commands/plan.md` command for structured issue planning
|
108
|
+
- Spawns concurrent subagents to research codebase, Python SDK, and CLI
|
109
|
+
- Compiles comprehensive implementation plans with detailed todos
|
110
|
+
- Requires user approval before proceeding with implementation
|
111
|
+
- Transaction history functionality (#8)
|
112
|
+
- Transaction model with comprehensive field support including fees and metadata
|
113
|
+
- Get all transactions with automatic pagination
|
114
|
+
- Filtering by date range, symbol, instrument type, and transaction types
|
115
|
+
- Manual pagination control with page_offset and per_page parameters
|
116
|
+
- Account#get_transactions convenience method
|
117
|
+
- CLI `history` command with table display and filtering options
|
118
|
+
- Grouping transactions by symbol, type, or date
|
119
|
+
- Transaction totals and summaries (credits, debits, fees, net cash flow)
|
120
|
+
- Interactive history menu with date and symbol filtering
|
121
|
+
- Full test coverage for Transaction model and API integration
|
122
|
+
- Buying power calculation and monitoring (#9)
|
123
|
+
- Extended AccountBalance model with buying power calculation methods
|
124
|
+
- Buying power usage percentage for equity, derivative, and day trading
|
125
|
+
- Check if sufficient buying power exists for orders
|
126
|
+
- Calculate buying power impact percentage for proposed orders
|
127
|
+
- BuyingPowerEffect model for dry-run order validation
|
128
|
+
- Dry-run orders now return detailed buying power impact information
|
129
|
+
- CLI `buying_power` command to display buying power status
|
130
|
+
- Buying power warnings when placing orders that use >80% of available BP
|
131
|
+
- Interactive confirmation for high buying power usage orders
|
132
|
+
- Integration with order placement workflow (both CLI and interactive)
|
133
|
+
- Comprehensive test coverage for all buying power calculations
|
134
|
+
- Order placement functionality for equities (#11)
|
135
|
+
- Order and OrderLeg classes for building orders programmatically
|
136
|
+
- Support for market and limit order types
|
137
|
+
- All four order actions: BUY_TO_OPEN, SELL_TO_CLOSE, SELL_TO_OPEN, BUY_TO_CLOSE
|
138
|
+
- Time in force options: DAY and GTC
|
139
|
+
- Automatic price-effect calculation (Debit for buys, Credit for sells)
|
140
|
+
- Account#place_order method for order submission
|
141
|
+
- OrderResponse model for parsing placement results
|
142
|
+
- Equity instrument class with build_leg helper method
|
143
|
+
- CLI `order` command with options for type, price, action, and dry-run
|
144
|
+
- Interactive order menu with vim navigation for order type and action
|
145
|
+
- Dry-run simulation capability for testing orders
|
146
|
+
- Improved error handling with helpful messages for common scenarios
|
147
|
+
- Comprehensive test coverage for all order functionality
|
148
|
+
- CLI positions command (#7)
|
149
|
+
- `positions` command to display account positions in table format
|
150
|
+
- Position filtering options: --symbol, --underlying-symbol, --include-closed
|
151
|
+
- Account selection with --account option
|
152
|
+
- Color-coded P/L display (green for profit, red for loss)
|
153
|
+
- Summary statistics showing total P/L and winners/losers count
|
154
|
+
- Option-specific display formatting (e.g., "AAPL 150C 1/19")
|
155
|
+
- Support for short positions with negative quantity display
|
156
|
+
- Integration with interactive mode and balance submenu
|
157
|
+
- Positions formatter for table display
|
158
|
+
- TTY::Table integration for professional formatting
|
159
|
+
- BigDecimal precision for monetary values
|
160
|
+
- Automatic symbol formatting for options
|
161
|
+
- Summary row with position statistics
|
162
|
+
- Environment variable authentication support
|
163
|
+
- Session.from_environment class method for creating sessions from env vars
|
164
|
+
- Support for TASTYTRADE_USERNAME, TASTYTRADE_PASSWORD (or TT_ prefixed)
|
165
|
+
- Optional TASTYTRADE_ENVIRONMENT for sandbox/production selection
|
166
|
+
- Optional TASTYTRADE_REMEMBER for automatic session refresh
|
167
|
+
- CLI automatically attempts env var login before prompting
|
168
|
+
- Fallback to interactive login if env var authentication fails
|
169
|
+
- Complete test coverage for all environment variable scenarios
|
170
|
+
- Enhanced CLI documentation
|
171
|
+
- Comprehensive login command help with environment variable examples
|
172
|
+
- README documentation for environment variable configuration
|
173
|
+
- Examples for CI/CD and automation use cases
|
174
|
+
- CLI login improvements
|
175
|
+
- Added --no-interactive flag to skip interactive mode after login
|
176
|
+
- Useful for scripting and CI/CD environments
|
177
|
+
- Correctly detects environment (sandbox/production) from env vars
|
178
|
+
- GitHub Release creation instructions in release workflow
|
179
|
+
- Added `gh release create` command to release-pr.md
|
180
|
+
- Automated release notes generation with --generate-notes flag
|
181
|
+
- Draft release workflow for review before publishing
|
182
|
+
|
183
|
+
### Changed
|
184
|
+
- Session storage switched from keyring to secure file-based storage
|
185
|
+
- Sessions now stored in ~/.config/tastytrade/credentials/ with 0600 permissions
|
186
|
+
- More reliable across different systems without keyring dependencies
|
187
|
+
- Credentials directory created with 0700 permissions for security
|
188
|
+
- User data (email, username, external_id) now saved with sessions for validation
|
189
|
+
|
190
|
+
### Fixed
|
191
|
+
- Session persistence issues between command invocations
|
192
|
+
- Fixed session corruption after first command execution
|
193
|
+
- Sessions now properly persist across multiple CLI commands
|
194
|
+
- Removed problematic session validation on load that was causing failures
|
195
|
+
- Removed stray error message "Failed to load current account" from positions/balance commands
|
196
|
+
- Error now only displays when DEBUG_SESSION environment variable is set
|
197
|
+
- Fixed all test failures related to file-based storage implementation
|
198
|
+
- Updated FileStore tests to properly mock temporary directories
|
199
|
+
- Fixed CLI auth tests to stub environment variable checks
|
200
|
+
- Added missing user attributes to test mocks
|
201
|
+
- Updated session manager tests for new user data saving/loading
|
202
|
+
|
203
|
+
### Removed
|
204
|
+
- Keyring gem dependency and KeyringStore implementation
|
205
|
+
- Replaced with more reliable file-based credential storage
|
206
|
+
- Eliminates cross-platform keyring compatibility issues
|
207
|
+
|
28
208
|
## [0.2.0] - 2025-08-01
|
29
209
|
|
30
210
|
### Added
|