zeekay
e42f801472
feat: full FI asset field parsing — description, ticker, coupon, maturity
2026-04-17 10:07:17 -07:00
zeekay
cad59ba58a
feat(types): asset_class constants for ch_*, ae_*, eu_* (MiCA taxonomy)
...
Extends AssetClass vocabulary with 17 new constants:
- CH: ch_equity, ch_dlt_security, ch_crypto, ch_fi (FINMA)
- AE: ae_equity, ae_crypto, ae_fi, ae_tokenized_security, ae_funds (SCA/DFSA/VARA/FSRA)
- EU: eu_equity, eu_mifid_fi, eu_ucits, eu_aif, eu_art, eu_emt, eu_cas, eu_dlt_security (MiCA)
AllAssetClasses() and ValidAssetClass() updated, existing tests pass.
2026-04-13 12:25:57 -07:00
zeekay
986666f8b1
feat: complete Alpaca sign-off — ACATS, Fixed Income, Crypto, Omnibus
...
ACATS (7/7 items):
- ValidateACATSAccount/Assets, CreateACATSTransfer, GetACATSTransfer
- ListACATSTransfers, CancelACATSTransfer, ListACATSActivities
- GetACATSRejection, ACATSDisclosure constant
- 13 tests with subtests covering all validation paths
Fixed Income (11/11 items):
- ListCorporateBonds, ListTreasuryBonds (/v1/assets/fixed_income/*)
- CreateFixedIncomeOrder (market-only, TIF=day, decimal validation)
- GetFixedIncomeActivities (maturity filter), GetFixedIncomePositions
- CloseFixedIncomePosition, CancelFixedIncomeOrder
- 11 tests including 6 validation error subtests
Remaining Crypto (5/5 items):
- AddCryptoAgreement PATCH for existing accounts
- ListCryptoAssets with min_order_size/price_increment
- NonMarginableBuyingPower in Portfolio
- ListCryptoWallets, GetCryptoWallet stubs
- GetCountryInfo for regional license checks
Remaining Omnibus (5/5 items):
- ValidateTIF with per-asset-class TIF maps
- GetSubaccountConfirms for trade confirmations
- trading_blocked flag in SSE account events
- fractional_eh_enabled already in Asset struct
All 38 Alpaca provider tests pass. Full broker build clean.
2026-04-06 14:03:54 -07:00
zeekay
72facc0488
feat: overnight attributes, decimal validation, crypto order limits
...
Asset struct: add overnight_tradable, overnight_halted,
fractional_eh_enabled, min_order_size, price_increment,
min_trade_increment — parsed from Alpaca assets API.
CreateOrder: add pre-flight validation:
- Notional max 2 decimal places, qty max 9 decimal places
- Crypto: TIF must be gtc or ioc (rejects day)
- Crypto: max $200k notional, min $1 buy notional
- Crypto: min qty 0.000000002
CreateOrderRequest: add AssetClass field for asset-class-aware
validation without symbol heuristics.
Addresses Alpaca Tech Sign Off items across all 5 checklists.
2026-04-06 13:47:28 -07:00
zeekay
0bb03de5bf
feat: add Apex provider + futures/FX/bonds/margin interfaces
...
- FuturesProvider, FXProvider, FixedIncomeProvider, MarginProvider interfaces
- Apex Clearing provider (self-clearing, 1-4 leg options, futures, margin)
- 20 new types: FuturesContract, FXPair, Bond, AccountMargin, etc.
- Registered in envconfig (APEX_API_KEY, APEX_API_SECRET, APEX_SANDBOX)
- 17 providers total (Alpaca, Apex, IBKR, Tradier, CurrencyCloud, LMAX, etc.)
2026-03-30 16:11:00 -07:00
zeekay
5de9cbe333
feat: add options trading — Alpaca Level 3 multi-leg support
...
- OptionsProvider interface (7 methods): chain, expirations, quote,
single-leg orders, multi-leg orders, exercise, positions
- Alpaca implementation: order_class "mleg", ratio_qty, position_intent
- Fix 3 critical bugs: mleg class, ratio_qty field, position_intent
- Add DoNotExercise + SetOptionsApprovalLevel endpoints
- HTTP handlers: 10 new routes under /v1/options/*
- Security: OCC symbol validation, input sanitization, audit logging
- Tests: 16 provider + handler tests passing
2026-03-30 15:25:47 -07:00
zeekay
3c79a26fd0
fix: convert Bar timestamps to epoch ms (TimeMs field) for frontend charts
2025-12-23 15:20:26 -07:00
zeekay
4532862f22
fix: use query-param format for crypto bars (sandbox single path 404s)
...
Same issue as snapshots — Alpaca sandbox returns 404 for
/v1beta3/crypto/us/{sym}/bars but works with
/v1beta3/crypto/us/bars?symbols={sym}. Also handle the wrapped
response format {"bars":{"BTC/USD":[...]}} vs stock {"bars":[...]}.
2025-12-24 00:57:08 -07:00
zeekay
8073fd565c
test: add comprehensive unit tests for auth, risk, alpaca, types, router
2025-11-28 22:18:34 -08:00
zeekay
f897cd1f9c
feat: complete Alpaca Broker API — 100% endpoint coverage
...
Security fixes:
- Fix auth bypass: empty API key now returns 401 (unless BROKER_DEV_MODE=true)
- Fix risk engine recording $0 for all orders (now calculates qty*price)
- Fix hardcoded compliance fields in CreateAccount (pass-through from request)
P0 Trading Core:
- ReplaceOrder (PATCH), CancelAllOrders, GetPosition, ClosePosition, CloseAllPositions
- ListOrdersFiltered with status/limit/after/until/direction/nested params
- Extended CreateOrderRequest: trailing stops, bracket orders, extended hours
P1-P5 Complete API via composable interfaces:
- AccountManager: UpdateAccount, CloseAccount, GetAccountActivities
- DocumentManager: Upload, List, Get, Download documents
- JournalManager: Create, List, Get, Delete, Batch, ReverseBatch journals
- TransferExtended: CancelTransfer, DeleteACH, recipient bank CRUD
- CryptoDataProvider: GetCryptoBars/Quotes/Trades/Snapshots
- EventStreamer: SSE streaming for trade/account/transfer/journal events
- PortfolioAnalyzer: GetPortfolioHistory
- WatchlistManager: Full CRUD with asset management
Architecture: 8 optional capability interfaces on single Provider abstraction.
Providers implement what they support; router detects via type assertion.
Market data fixes:
- Crypto symbols now route to /v1beta3/crypto/us/ (not /v2/stocks/)
- GetBars pagination via next_page_token loop
2025-10-22 10:40:22 -07:00
zeekay
007cfd475d
feat: federated broker with 16 providers, smart order routing, institutional trading
...
Providers: Alpaca, IBKR, BitGo, FalconX, Finix, SFOX, Coinbase, Binance,
Kraken, Gemini, Fireblocks, Circle, Tradier, Polygon, CurrencyCloud, LMAX
Features: fee-aware SOR, order splitting, pre-trade risk, audit logging,
consolidated market data, SSE streaming, auth middleware
2025-05-29 05:29:54 -05:00