robinhood-options-mobile

Trade Signal Notifications

Configurable push notifications for trade signals generated by the agentic trading system.

Overview

This feature sends push notifications to users when new trade signals are created or when existing signals are updated to BUY or SELL. Users can configure their notification preferences to control which signals they receive.

Features

User Configuration Options

Users can customize their notification preferences with the following settings:

  1. Enable/Disable - Turn notifications on or off completely
  2. Signal Types - Choose to receive notifications for BUY, SELL, or both
  3. Include HOLD - Optionally receive notifications for HOLD signals
  4. Intervals - Filter notifications by time interval (1d, 1h, 30m, 15m)
  5. Symbol Filter - Receive notifications only for specific symbols
  6. Confidence Threshold - Only notify if signal confidence exceeds a threshold (stored as 0-1, displayed as 0-100%)

Notification Triggers

Notifications are sent when:

Notification Content (Rich Notifications)

Notifications are delivered as Rich Push Notifications containing:

This actionable format allows users to assess opportunities without opening the app fully.

Each notification includes:

Rich Notifications

New in v0.26.0, Expanded in v0.32.0

Rich notifications are now supported for:

Enhancements in v0.32.0:

Notifications now support rich media content to provide immediate context without opening the app.

App Navigation

When a user taps on a trade signal notification, the app will:

  1. Open the app (if not already open)
  2. Navigate directly to the Instrument Details page for the symbol in the signal
  3. Load the relevant instrument data and chart

Technical Implementation

Backend (Firebase Functions)

File: functions/src/trade-signal-notifications.ts

Two Firestore triggers:

Both triggers:

  1. Check if the signal is actionable (BUY, SELL, or HOLD)
  2. Query all users with notification settings enabled
  3. Filter users based on their notification preferences
  4. Send FCM push notifications to matching users

Frontend (Flutter)

Models:

Widget:

Navigation:

Data Storage

Notification settings are stored in the user document:

{
  "tradeSignalNotificationSettings": {
    "enabled": true,
    "signalTypes": ["BUY", "SELL"],
    "symbols": ["AAPL", "TSLA"],
    "intervals": ["1d", "1h"],
    "includeHold": false,
    "minConfidence": 0.7
  }
}

Usage

For Users

  1. Navigate to the Trade Signal Notification Settings screen
  2. Enable notifications with the toggle switch
  3. Configure your preferences:
    • Select which signal types to receive (BUY/SELL/HOLD)
    • Optionally filter by specific symbols
    • Optionally filter by intervals
    • Set a confidence threshold if desired
  4. Tap the save icon to persist your settings

For Developers

Accessing the Settings Widget

import 'package:robinhood_options_mobile/widgets/trade_signal_notification_settings_widget.dart';

// Navigate to settings
Navigator.push(
  context,
  MaterialPageRoute(
    builder: (context) => TradeSignalNotificationSettingsWidget(
      user: currentUser,
      userDocRef: userDocReference,
    ),
  ),
);

Updating Settings Programmatically

final updatedUser = currentUser;
updatedUser.tradeSignalNotificationSettings = TradeSignalNotificationSettings(
  enabled: true,
  signalTypes: ['BUY', 'SELL'],
  symbols: ['AAPL'],
  intervals: ['1d'],
  includeHold: false,
  minConfidence: 0.8,
);

await firestoreService.updateUser(userDocRef, updatedUser);

Deployment

Deploy Firebase Functions

cd src/robinhood_options_mobile/functions
npm install
firebase deploy --only functions:onTradeSignalCreated,functions:onTradeSignalUpdated

Update Firestore Rules

The rules are already updated in firebase/firestore.rules. Deploy with:

cd src/robinhood_options_mobile
firebase deploy --only firestore:rules

Testing

Test Notification Locally

  1. Create or update a trade signal document in Firestore:
// In Firebase Console or using admin SDK
db.collection('signals').add({
  symbol: 'AAPL',
  signal: 'BUY',
  interval: '1d',
  timestamp: Date.now(),
  confidence: 0.85,
  price: 150.00
});
  1. Ensure your user has:
    • FCM token stored in the devices array
    • Notification settings enabled
    • Settings that match the signal (symbol, interval, confidence)

Debug Notifications

Check Firebase Functions logs:

firebase functions:log --only onTradeSignalCreated,onTradeSignalUpdated

Notification Channels (Android)

The Android notification uses the trade_signals channel. Ensure this channel is created in your Android app:

// In MainActivity.kt or similar
val channel = NotificationChannel(
    "trade_signals",
    "Trade Signals",
    NotificationManager.IMPORTANCE_HIGH
)
channel.description = "Notifications for buy and sell trade signals"
notificationManager.createNotificationChannel(channel)

iOS Configuration

Ensure your iOS app is configured for push notifications:

  1. Enable Push Notifications capability in Xcode
  2. Configure APNs certificates in Firebase Console
  3. Request notification permissions in the app

Future Enhancements

Potential improvements: