All Market Conditions
| Strategy Type | Portfolio Infrastructure / Position Tracking |
| Market Outlook | All Market Conditions |
| Risk Level | Infrastructure - Essential for Risk Control |
| Time Horizon | Real-time Position Monitoring |
| Best Conditions | Required for any active trading or investment |
| Avoid When | Never - position management is always essential |
| Position Types | Day-trade positions - closed before market close • Cash-account positions - held in brokerage account • Futures positions - held until expiry or closure • Options positions - held until expiry, exercise, or closure |
| Custody Integration | Depository Trust Company - book-entry securities custody • National Securities Clearing Corporation - trade clearing • T+1 settlement reflects in the account |
| Margin Positions | SPAN-based initial margin for futures/options • Additional maintenance margin buffer • Highest intraday margin requirement • Daily mark-to-market for futures |
| Position Limits | SEC/exchange position limits per account • Overall open interest limits • Single-name position limits • Higher limits for index products |
| Corporate Actions | Record date determines eligibility • Automatic adjustment in brokerage account • Stock-dividend shares credited • Subscription rights for existing holders |
| Tax Tracking | Short-term capital gains (held ≤1 year) • Long-term capital gains (held >1 year) • Section 1256 contracts use a 60/40 blended rate • First-In-First-Out default (specific-ID also allowed) |
Your broker's platform shows positions but may not provide: multi-strategy tracking, detailed tax-lot information for short-term/long-term gains, custom alerts and limits, integration with your trading strategies, or consolidated view across multiple brokers. A dedicated position manager adds these capabilities. For basic trading, broker platforms suffice. For systematic trading or multi-account portfolios, dedicated position management adds significant value.
Your average cost doesn't change when you sell - it only changes when you buy more at a different price. When you sell 50 out of 100 shares, your remaining 50 shares still have the same average cost. However, for tax purposes, the cost basis of the shares sold is determined by FIFO (first shares bought are first sold), which may be different from your display average cost if you bought in multiple lots.
Key differences: (1) Futures/options use mark-to-market daily - gains/losses are settled to your account each day, not just when you close. (2) Margin requirements fluctuate based on position value. (3) Positions have expiry dates. (4) Tax treatment differs - many futures and broad-based index options fall under Section 1256 (60/40 blend) rather than ordinary stock capital-gains rules. (5) Contract sizes are fixed. Your position manager should track these differences and display appropriate information for each position type.
Common reasons: (1) Broker may include commission in average cost, you may not. (2) Different handling of partial fills. (3) Corporate actions may have been applied differently. (4) Your calculation might use average cost while broker uses FIFO for certain displays. Always reconcile and understand the methodology difference. For tax purposes, maintain your own accurate records.
Investigate immediately: (1) Check for pending settlement (T+1 means buy today shows tomorrow). (2) Look for recent corporate actions that might have adjusted quantities. (3) Check for any trades that might have failed to sync. (4) Review if there were partial fills that weren't fully captured. The broker record is authoritative - update your position manager to match, then fix the underlying sync issue to prevent recurrence.
Options: (1) Use each broker's platform separately and maintain a master spreadsheet. (2) Use portfolio tracking tools (Empower, Morningstar) that aggregate across brokers. (3) Build custom position manager that connects to each broker's API. (4) For consolidated view: import holdings from each broker (CSV or API), aggregate in your system, reconcile each account separately. The key is having one source of truth for total exposure while maintaining per-broker accuracy for execution and compliance.
For tax-loss harvesting: (1) Track each lot separately with acquisition date and cost. (2) Before year-end, identify lots with losses. (3) Sell loss-making lots to realize losses (offset against gains). (4) In the US, the wash-sale rule disallows the loss if you repurchase the same or a substantially identical security within 30 days - wait 31 days or use a non-identical replacement. (5) For long-term treatment: identify lots approaching the 1-year holding mark; holding past 1 year qualifies gains for the preferential 0/15/20% rates. Position manager should enable lot-level queries sorted by gain/loss and holding period.
Methods: (1) Tag at entry - when placing trade, specify strategy. Most accurate. (2) Rules-based - define rules (e.g., day-trade flag = intraday strategy, holdings >30 days = long-term). Automated but less precise. (3) Manual attribution - periodically assign unattributed positions. Flexible but requires effort. Best practice: tag at entry, use rules as backup, allow manual override. Track strategy separately from account - same account can have multiple strategies.
Key considerations: (1) Track days to expiry prominently. (2) Alert when expiry is within X days (e.g., 5 days). (3) Monitor time decay (theta) acceleration near expiry. (4) Understand exercise/assignment scenarios for ITM options. (5) Decision framework: close before expiry to capture remaining value, let expire worthless if OTM, or manage exercise/assignment if ITM. Position manager should highlight approaching expiries and provide decision-support data.
When positions are transferred (e.g., broker to broker): (1) Document original acquisition date and cost before transfer. (2) After transfer, manually input original lot details into new system. (3) Keep paper trail (old trade confirmations) for tax evidence. (4) If history is truly lost, use first statement from new broker as cost basis, but this may result in higher tax. For ACATS transfers, original cost-basis details should travel with the securities - verify this happened correctly.
Key design elements: (1) In-memory position store - database too slow for HFT. Use Redis or custom in-memory structure. (2) Lock-free updates - use atomic operations, avoid blocking. (3) Aggregate tracking - track net position, not every micro-lot. Lot details can be computed later. (4) Async persistence - write to database asynchronously, don't block trading. (5) Snapshot + journal - periodically snapshot state, journal changes, enables fast recovery. (6) Pre-computed limits - check limits without database queries. Target: position update <1ms, limit check <100μs.
HA architecture: (1) Primary-standby with synchronous replication for position store. (2) Failover within seconds using leader election (Zookeeper, etcd). (3) Stateless application servers - multiple instances behind load balancer. (4) Event sourcing enables standby to catch up from event log if needed. (5) Health checks and automatic failover. (6) Geographic redundancy for disaster recovery - async replicate to secondary region. (7) Graceful degradation - read-only mode if primary fails but standby isn't ready. Test failover regularly.
Corporate action automation: (1) Subscribe to corporate action feed (exchange data, vendor like Reuters). (2) Parse action details: type, ratio, ex-date, record date. (3) On ex-date, identify affected positions. (4) Calculate adjustments: Split/Bonus - multiply quantity by ratio, divide cost by ratio. Dividend - no position change, log income separately. Rights - create rights position, handle subscription choice. (5) Apply adjustments transactionally. (6) Reconcile against broker statement post-adjustment. (7) Handle edge cases: fractional shares, positions opened between record and ex-date.
Reservation prevents over-allocation when multiple orders compete for limited position capacity: (1) When order is submitted, reserve capacity: available_capacity -= order_quantity. (2) Store reservation with order ID and timestamp. (3) On fill, convert reservation to position. (4) On cancel/reject, release reservation. (5) Handle partial fills - convert filled portion, keep reservation for remainder. (6) Timeout stale reservations (if order status unknown for too long). (7) Atomic operations - check capacity and reserve in single transaction. (8) Include reservations in limit calculations. This prevents scenarios where two strategies both think they can take 100-share positions when only 100 shares of capacity remain.
Consistency challenges and solutions: (1) Single source of truth - one authoritative position store, read replicas for queries. (2) Event ordering - use message queue with ordering guarantees (Kafka partitioned by account). (3) Idempotent updates - same event applied multiple times yields same result. Use event ID to detect duplicates. (4) Eventual consistency - accept temporary inconsistency, reconciliation catches up. (5) Conflict resolution - if two systems have different values, use timestamps (latest wins) or broker as arbiter. (6) Saga pattern for multi-step updates - compensating transactions if part fails. (7) Validation at boundaries - verify consistency when crossing service boundaries.
Full guided lessons, quizzes, and a complete strategy library for the United States market. One-time purchase. No subscription, ever.
Get United States access →