TradeX is a comprehensive trading journal and P&L tracking application built with React Native and Expo. It helps traders monitor their performance through detailed analytics, monthly tracking, and individual trade logging with real-time cloud synchronization.
- π Monthly P&L Tracking β Track capital, deposits, withdrawals, and net profit/loss
- π Individual Trade Logging β Log trades with entry/exit prices, quantities, and tags
- π― Goal Setting β Set yearly profit targets with visual progress tracking
- π± Cross-Platform β Runs on iOS and Android with native performance
- π Firebase Authentication β Secure Google Sign-In with real-time data sync
- π Dark/Light Mode β Adaptive theming based on system preferences
- π PDF Reports β Generate and share professional trading reports
- π Privacy Mode β Hide sensitive financial data with one tap
| Technology | Version | Purpose |
|---|---|---|
| React Native | 0.81.5 | Cross-platform mobile framework |
| Expo | 54.0 | Development platform & tooling |
| TypeScript | 5.9 | Type-safe JavaScript |
| Expo Router | 6.0 | File-based navigation |
| Technology | Purpose |
|---|---|
| Firebase Auth | User authentication (Google Sign-In) |
| Cloud Firestore | Real-time NoSQL database |
| React Context API | Global state management |
| Library | Purpose |
|---|---|
| React Native Reanimated | Fluid animations |
| React Native Gesture Handler | Touch gestures & swipe actions |
| Expo Linear Gradient | Gradient backgrounds |
| Expo Haptics | Tactile feedback |
| Tool | Purpose |
|---|---|
| Jest | Unit testing framework |
| ESLint | Code linting |
| TypeScript | Static type checking |
src/
βββ components/ # Reusable UI components
β βββ MonthCard.tsx # Monthly performance card
β βββ SwipeableRow.tsx # Swipeable list item
β βββ ...
βββ context/ # React Context providers
β βββ AuthContext.tsx # Authentication state
β βββ TradingContext.tsx # Trading data & operations
β βββ ThemeContext.tsx # Dark/Light mode
βββ services/ # Business logic & API
β βββ firestoreService.ts # Firebase operations
β βββ calculationService.ts # P&L calculations
β βββ tradeCalculationService.ts # Trade analytics
β βββ pdfService.ts # Report generation
βββ types/ # TypeScript interfaces
βββ utils/ # Helper functions
β βββ formatters.ts # Currency/date formatting
β βββ scaling.ts # Responsive scaling
βββ config/ # Configuration files
βββ firebaseConfig.ts
βββ fonts.ts
app/ # Expo Router pages
βββ (tabs)/ # Tab navigation screens
β βββ index.tsx # Home (Dashboard)
β βββ trades.tsx # Trade list
β βββ calendar.tsx # Calendar view
β βββ analytics.tsx # Performance analytics
β βββ history.tsx # Monthly history
βββ add-month.tsx # Add month form
βββ add-trade.tsx # Add trade form
βββ onboarding.tsx # First-time user flow
βββ login.tsx # Authentication
interface MonthRecord {
id: string;
month: string; // 'YYYY-MM' format
year: number;
startingCapital: number;
endingCapital: number;
deposits: number;
withdrawals: number;
grossChange: number; // Computed
netProfitLoss: number; // Computed
returnPercentage: number; // Computed
pnlSource: 'manual' | 'trades';
status: 'active' | 'closed';
}interface Trade {
id: string;
symbol: string;
tradeType: 'long' | 'short';
entryDate: string;
exitDate: string;
entryPrice: number;
exitPrice: number;
quantity: number;
pnl: number; // Computed
returnPercentage: number; // Computed
tags: string[];
monthKey: string; // Links to month
}All data is synchronized in real-time using Firestore's onSnapshot listeners:
- Instant updates across devices
- Offline-first with automatic sync when online
- Optimistic UI updates for responsive UX
The calculation services compute:
- Monthly Stats: Net P&L, ROI%, profit factor, win rate
- Trade Stats: Win streaks, best/worst trades, per-symbol performance
- Goal Progress: YTD performance vs. annual targets
Uses expo-print with custom HTML templates:
- Professional branded layout
- Monthly summary with key metrics
- Trade table with performance breakdown
- Automatic date formatting
Custom scaling utilities ensure consistent UI across screen sizes:
const scale = (size: number) => PixelRatio.roundToNearestPixel(size * SCALE_FACTOR);
const fontScale = (size: number) => scale(size) * FONT_SCALE;- Node.js 18+
- npm or yarn
- Expo CLI
- iOS Simulator (macOS) or Android Emulator
# Clone the repository
git clone https://github.com/AsinOmal/ReactNative-PnL-Tracker.git
cd ReactNative-PnL-Tracker
# Install dependencies
npm install
# Start the development server
npx expo start- Create a Firebase project at console.firebase.google.com
- Enable Authentication (Google Sign-In)
- Enable Cloud Firestore
- Add your
GoogleService-Info.plist(iOS) andgoogle-services.json(Android) - Update
src/config/firebaseConfig.tswith your config
# Run all tests
npm test
# Run with coverage
npm test -- --coverageCurrent test coverage includes:
- Calculation service (20 tests)
- Trade calculation service (24 tests)
| Command | Description |
|---|---|
npm start |
Start Expo development server |
npm run ios |
Run on iOS Simulator |
npm run android |
Run on Android Emulator |
npm test |
Run test suite |
npm run lint |
Run ESLint |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is private and not licensed for public use.
