robinhood-options-mobile

Copy Trading Feature

Introduced in v0.16.0 and significantly enhanced in v0.22.0. Features manual and automated execution, a dedicated dashboard, approval workflows, and comprehensive audit trails.

Overview

The Copy Trading feature allows members of investor groups to automatically or manually copy trades from other group members. This feature supports both stock/ETF trades and options trades.

Features

1. Copy Trade Settings

Members can configure copy trading settings for each investor group they belong to:

2. Copy Trading Dashboard

New in v0.22.0, Enhanced in v0.24.0

A centralized hub for managing all copy trading activities:

3. Approval Workflow

New in v0.22.0

When “Auto-Execute” is enabled, trades may require approval before execution based on configuration:

4. Manual Copy Trading

Updated in v0.17.2: Selection-based workflow with single and batch copy modes.

When viewing another member’s portfolio in a private group, you can copy trades using two modes:

Single-Trade Copy (Default)

Batch Copy (Multi-Select Mode)

Note: Selection state persists across screen updates thanks to model equality improvements in v0.17.2.

3. Automated Copy Trading

When auto-execute is enabled:

4. Notifications (Rich Push)

Enhanced in v0.31.7

Users receive Rich Push Notifications containing actionable data when copy trades occur:

5. Selection-Based UI

New in v0.17.2

The member detail portfolio screen supports a selection-driven copy trading workflow:

This approach consolidates multiple copy buttons into a single contextual action, improving clarity and scalability for users managing many trades.

User Interface

Accessing Copy Trade Settings

  1. Navigate to an investor group
  2. If you’re a member, click the “Copy Trade Settings” button
  3. Enable copy trading and configure your preferences
  4. Select which member’s trades you want to copy
  5. Set your limits and save

Manual Copying a Trade

  1. Navigate to an investor group
  2. Click on a member’s portfolio
  3. Find a filled order you want to copy
  4. Click the copy icon next to the order
  5. Review the trade details and confirm

Implementation Details

Data Model

CopyTradeSettings

class CopyTradeSettings {
  bool enabled;
  String? targetUserId;
  bool autoExecute;
  double? maxQuantity;
  double? maxAmount;
  bool? overridePrice;
}

Stored in InvestorGroup.memberCopyTradeSettings as a map:

Map<String, CopyTradeSettings>? memberCopyTradeSettings;

Copy Trade Records

Created by backend functions in Firestore collection copy_trades:

{
  sourceUserId: string;
  targetUserId: string;
  groupId: string;
  orderType: 'instrument' | 'option';
  originalOrderId: string;
  symbol: string;
  side: string;
  originalQuantity: number;
  copiedQuantity: number;
  price: number;
  strategy?: string; // For options
  timestamp: Timestamp;
  executed: boolean;
}

Backend Functions

onInstrumentOrderCreated

Triggered when a new instrument (stock/ETF) order is created:

  1. Checks if the order is filled
  2. Finds all investor groups the user belongs to
  3. Identifies members who are copying from this user
  4. Applies quantity and amount limits
  5. Creates copy trade records
  6. Sends push notifications to target users with trade details

onOptionOrderCreated

Triggered when a new option order is created:

  1. Checks if the order is filled
  2. Finds all investor groups the user belongs to
  3. Identifies members who are copying from this user
  4. Applies quantity and amount limits (accounting for 100 shares per contract)
  5. Creates copy trade records
  6. Sends push notifications to target users with trade details

Notification System

Push notifications are sent using Firebase Cloud Messaging (FCM):

Security Rules

Firestore rules for copy_trades collection:

- Users can read their own copy trades (as source or target)
- Only backend functions can create copy trades
- Target users can update to mark as executed/rejected
- Admins can delete records

Future Enhancements

High Priority

  1. Auto-Execute for Copy Trades: Implement client-side automatic execution for flagged copy trades without manual approval (fully autonomous).
  2. Performance Tracking: Track success rate of copied trades.

Medium Priority

  1. Partial Copying: Support copying a percentage of the original trade.
  2. Time-based Filtering: Only copy trades during specific hours.
  3. Symbol Filtering: Allow/block specific symbols or sectors.
  4. Copy Stop Loss/Take Profit: Automatically copy exit strategies.

Low Priority

  1. Social Features: See which members are most copied.
  2. Copy Trade Templates: Save and reuse configuration presets.
  3. Multi-user Copying: Copy from multiple users simultaneously.
  4. Inverse Copying: Do the opposite of what someone else does.
  5. Copy Trading Groups: Create groups specifically for copy trading.

Testing

Unit Tests

Tests are included in test/investor_group_model_test.dart:

Manual Testing Checklist

Backend Function Testing

  1. Deploy functions: firebase deploy --only functions
  2. Create test orders in user collections
  3. Verify copy trade records are created
  4. Check logs for errors
  5. Verify security rules prevent unauthorized access

Deployment

Frontend Changes

The Flutter app includes a selection-based copy trading UI:

These changes are included in standard build artifacts; no special build steps required.

Backend Functions

Deploy the Firebase functions:

cd src/robinhood_options_mobile/functions
npm install
firebase deploy --only functions

Firestore Rules

Deploy the security rules:

firebase deploy --only firestore:rules

6. Copy Trading Dashboard

New in v0.22.0

A dedicated dashboard for managing copy trading activities:

7. Approval Workflow

New in v0.22.0

When “Auto-Execute” is enabled, trades may require approval before execution based on configuration:

Limitations

  1. No Actual Execution: The current implementation creates copy trade records but doesn’t execute orders.FIXED - Manual copy trades now execute immediately via brokerage API.

  2. Auto-Execute Client-Side: Fully automated execution without user intervention requires the app to be running or a background service (planned). Currently uses the Approval Workflow.

  3. Single Target: Users can only copy from one member per group at a time.

  4. No Inverse Copying: Cannot automatically do the opposite of another user’s trades.

  5. No Filtering: Cannot filter by symbol, time, or other criteria (yet).FIXED - Dashboard provides filtering.

  6. Manual Price Override: The “override price” setting requires fetching current quotes, not yet implemented.

Security Considerations

  1. User Consent: Users must explicitly enable copy trading
  2. Limits: Quantity and amount limits protect users from over-exposure
  3. Audit Trail: All copy trades are logged for compliance
  4. Access Control: Only group members can copy from each other
  5. Firestore Rules: Backend-only creation prevents abuse

Support

For issues or questions about copy trading:

  1. Check this documentation
  2. Review the code in:
    • lib/model/investor_group.dart
    • lib/widgets/copy_trade_settings_widget.dart
    • lib/widgets/copy_trade_button_widget.dart
    • functions/src/copy-trading.ts
  3. Contact the development team

License

This feature is part of the RealizeAlpha project and subject to the same license terms.