Skip to content

feat: Add Account Configuration API support#70

Merged
TexasCoding merged 1 commit intov3.0.0from
feature/account-config
Sep 15, 2025
Merged

feat: Add Account Configuration API support#70
TexasCoding merged 1 commit intov3.0.0from
feature/account-config

Conversation

@TexasCoding
Copy link
Owner

Summary

  • Implemented comprehensive Account Configuration API support
  • Added methods to get and update account configuration settings
  • Created AccountConfigModel for type-safe configuration handling

Changes

  • Updated Module: trading/account.py with configuration methods
  • New Model: AccountConfigModel with all configuration fields
  • Methods: get_configuration() and update_configuration()
  • Testing: 14 unit tests + 8 integration tests with full coverage
  • Documentation: Updated DEVELOPMENT_PLAN.md

Features

  • ✅ Get current account configuration
  • ✅ Update individual or multiple configuration settings
  • ✅ Support for all Alpaca configuration options:
    • dtbp_check - Day trade buying power check
    • fractional_trading - Enable/disable fractional shares
    • max_margin_multiplier - Maximum leverage (1, 2, or 4)
    • no_shorting - Disable short selling
    • pdt_check - Pattern day trader check
    • ptp_no_exception_entry - PTP no exception entry
    • suspend_trade - Suspend trading activity
    • trade_confirm_email - Trade confirmation emails

Validation

  • Comprehensive parameter validation
  • Clear error messages for invalid values
  • Type safety with mypy strict mode

Test Results

  • All 22 tests passing (14 unit, 8 integration)
  • Type checking passes
  • Code formatted with ruff
  • Pre-commit hooks passing

Notes

This completes the first feature of Phase 2 (Important Enhancements). Progress update:

  • Phase 1: ✅ Complete (100%)
  • Phase 2: 🟦 In Progress (33%)
  • Overall v3.0.0: 35% Complete

🤖 Generated with Claude Code

- Implemented get_configuration() and update_configuration() methods in Account class
- Created AccountConfigModel dataclass with all configuration fields
- Added support for all account settings: dtbp_check, fractional_trading, max_margin_multiplier, no_shorting, pdt_check, ptp_no_exception_entry, suspend_trade, trade_confirm_email
- Comprehensive validation for configuration parameters
- Added 14 unit tests and 8 integration tests
- Full type safety with mypy strict mode
- Updated DEVELOPMENT_PLAN.md

This completes the first feature of Phase 2 (Important Enhancements)
@TexasCoding TexasCoding merged commit 1399c77 into v3.0.0 Sep 15, 2025
3 checks passed
@TexasCoding TexasCoding deleted the feature/account-config branch September 15, 2025 23:36
TexasCoding added a commit that referenced this pull request Sep 17, 2025
* feat: Initialize v3.0.0 development with comprehensive plan

- Create DEVELOPMENT_PLAN.md with detailed roadmap for v3.0.0
- Add CHANGELOG.md to track version history
- Create GitHub issue templates for feature tracking
- Establish 4-phase development plan:
  * Phase 1: Critical missing features (Corporate Actions, Trade Data, Snapshots)
  * Phase 2: Important enhancements (Account Config, Market Metadata)
  * Phase 3: Performance improvements (Batch Ops, Caching, Feed Management)
  * Phase 4: Advanced features (WebSocket, Async support)
- Set up branching strategy with v3.0.0 as base branch

This provides a clear roadmap for achieving 100% Alpaca Stock API coverage

Co-Authored-By: Claude <noreply@anthropic.com>

* Add claude GitHub actions 1757898251914 (#66)

* "Claude PR Assistant workflow"

* "Claude Code Review workflow"

* feat: Add comprehensive Corporate Actions API support (#67)

Implements Phase 1.1 of v3.0.0 development plan:

- Create corporate_actions.py module with full API coverage
- Add get_announcements() with date range and type filtering
- Add get_announcement_by_id() for specific announcements
- Support for dividends, splits, mergers, and spinoffs
- Create specialized model classes for each action type
- Add comprehensive unit tests (13 test cases)
- Add live integration tests with real API calls
- Update documentation with usage examples

Key features:
- Full type safety with dataclass models
- Proper date validation (90-day limit)
- Support for symbol and CUSIP filtering
- Date type filtering (declaration, ex-date, record, payable)
- Handles API response format (list or object)
- Documents actual pagination behavior (returns all results)

Tests:
- All unit tests passing (13/13)
- All integration tests passing (9/9)
- Covers error handling, validation, and real API calls

Co-authored-by: Claude <noreply@anthropic.com>

* Add comprehensive Trade Data API support (#68)

Implements Phase 1.2 of the v3.0.0 development plan with full trade-level market data functionality.

Features:
- Historical trades retrieval with time range filtering
- Latest trade data for single and multiple symbols
- Automatic pagination support with get_all_trades()
- Multi-symbol batch operations
- Data feed selection (IEX, SIP, OTC)
- As-of parameter for historical point-in-time data
- RFC-3339 date validation and error handling

Models:
- TradeModel: Individual trade data with exchange, price, size, conditions
- TradesResponse: Paginated response with next_page_token support
- Full type safety with proper validation

API Coverage:
- GET /v2/stocks/{symbol}/trades - Historical trades
- GET /v2/stocks/trades/latest - Latest trades
- GET /v2/stocks/trades - Multi-symbol trades

Tests:
- 12 comprehensive unit tests with mocking
- 10 integration tests for live API validation
- Error handling and edge case coverage
- Pagination and feed parameter validation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>

* feat: Add comprehensive Market Snapshots API support (#69)

- Created snapshots.py module with get_snapshot() and get_snapshots() methods
- Implemented SnapshotModel and BarModel dataclasses for snapshot data
- Added support for latest trade, quote, minute bar, daily bar, and previous daily bar
- Integrated snapshots into Stock module
- Added comprehensive unit tests (15 test cases)
- Added integration tests (10 test cases)
- Supports multiple data feeds (iex, sip, otc)
- Handles single and multiple symbol requests efficiently
- Updated DEVELOPMENT_PLAN.md to mark feature as complete

Completes Phase 1 (Critical Features) of v3.0.0 development

* feat: Add Account Configuration API support (#70)

- Implemented get_configuration() and update_configuration() methods in Account class
- Created AccountConfigModel dataclass with all configuration fields
- Added support for all account settings: dtbp_check, fractional_trading, max_margin_multiplier, no_shorting, pdt_check, ptp_no_exception_entry, suspend_trade, trade_confirm_email
- Comprehensive validation for configuration parameters
- Added 14 unit tests and 8 integration tests
- Full type safety with mypy strict mode
- Updated DEVELOPMENT_PLAN.md

This completes the first feature of Phase 2 (Important Enhancements)

* feat: Add Market Metadata API support (#71)

- Created metadata.py module with exchange and condition code lookups
- Implemented get_exchange_codes() for stock exchange mappings
- Implemented get_condition_codes() with tape and ticktype support
- Added get_all_condition_codes() for bulk retrieval
- Added lookup methods for easy code-to-name resolution
- Implemented intelligent caching with cache management
- Added 16 unit tests and 11 integration tests
- Full type safety with mypy strict mode
- Updated DEVELOPMENT_PLAN.md

Supports:
- All stock exchange codes (NYSE, NASDAQ, IEX, etc.)
- Trade condition codes for all tapes (A, B, C)
- Quote condition codes for all tapes
- Caching for improved performance
- Cache clearing and management

This completes the second feature of Phase 2 (Important Enhancements)

* feat: Add Enhanced Order Management features (#72)

- Implement replace_order() method for updating existing orders
- Add client_order_id support to all order methods
- Add order_class parameter for OTO/OCO/bracket orders
- Enhance order validation logic
- Add comprehensive tests (13 unit, 10 integration)
- Update DEVELOPMENT_PLAN.md

Note: Client order ID operations use order list filtering as Alpaca API
removed direct :by_client_order_id endpoints

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>

* feat: Add batch operations for multi-symbol data fetching (#73)

* feat: Add batch operations for multi-symbol data fetching

- Update history.py to support multi-symbol bars with automatic batching for 200+ symbols
- Update latest_quote.py to support batch quotes with automatic batching
- Implement concurrent request handling using ThreadPoolExecutor
- Add comprehensive tests (20 test cases: 11 unit, 9 integration)
- Update README with batch operation examples and features
- Optimize DataFrame operations for better performance
- Maintain backward compatibility for single-symbol requests
- Update DEVELOPMENT_PLAN.md to mark batch operations as complete

* fix: Correct order validation logic and OCO test parameters

- Remove overly strict validation in orders.py that required both take_profit AND stop_loss
- Different order classes have different requirements:
  - Bracket orders need both take_profit and stop_loss
  - OTO orders need EITHER take_profit OR stop_loss
  - OCO orders are exit-only and have specific validation rules
- Update OCO test to handle expected behavior (exit-only orders)
- All order enhancement integration tests now passing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>

* feat: Add Feed Management System for automatic feed selection and fallback (#74)

- Create comprehensive feed_manager.py module with smart feed handling
- Implement automatic subscription level detection (Basic/Unlimited/Business)
- Add intelligent feed fallback mechanism (SIP → IEX → OTC)
- Support per-endpoint feed configuration
- Track and cache failed feeds to avoid repeated failures
- Add FeedConfig dataclass for customizable feed preferences
- Implement 47 tests (36 unit, 11 integration) with 100% coverage
- Fix timestamp comparison in trades test to handle different precision levels

Features:
- Auto-detects user's Alpaca subscription level
- Automatically falls back to available feeds on permission errors
- Configurable feed preferences with endpoint-specific overrides
- Smart caching to avoid repeated failed requests
- Clear logging for feed selection and fallback decisions

This completes Phase 3.2 of the v3.0.0 development plan.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>

* feat: Add Caching System (Phase 3.3) (#75)

* feat: Add comprehensive Caching System for performance optimization

- Create cache/ module with LRU memory cache and optional Redis support
- Implement CacheManager with configurable TTL per data type
- Add cache invalidation by pattern and prefix clearing
- Support for dataclass serialization and decorator-based caching
- Implement cache statistics tracking (hit/miss rates)
- Add 40 comprehensive tests (29 unit, 11 integration)
- Configure sensible TTLs: 1 day for market hours, 1 hour for assets, etc.

Features:
- LRU in-memory cache with size limits
- Optional Redis backend with automatic fallback
- Per-data-type TTL configuration
- Cache key generation with hash for long keys
- Thread-safe concurrent access
- Decorator for easy function result caching
- Pattern-based cache invalidation
- Detailed statistics tracking

This completes Phase 3 of the v3.0.0 development plan.
All Performance & Quality features are now implemented.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: Update README.md with v3.0.0 features and bump version

- Add comprehensive documentation for all v3.0.0 features
- Document Market Snapshots API support
- Document Account Configuration API support
- Document Market Metadata API support
- Document Enhanced Order Management features
- Document Feed Management System
- Document Caching System
- Update project structure to reflect new modules
- Update roadmap with completed v3.0.0 features
- Defer Phase 4 features to v3.1.0 and v3.2.0
- Update version to 3.0.0 in pyproject.toml

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: Clean up DEVELOPMENT_PLAN.md for future versions

- Remove all completed v3.0.0 tasks
- Reorganize for v3.1.0 (WebSocket) and v3.2.0 (Async)
- Add summary of completed features
- Update roadmap with future versions
- Simplify structure for ongoing development

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant