Skip to content

riccorohl/trading-journal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

58 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Zella Trade Scribe πŸ“ˆ

A modern, feature-rich trading journal application built with React, TypeScript, and Firebase. Inspired by professional trading platforms like Tradezella, Tradervue, and TraderSync.

✨ Features

πŸ“Š Trading Management

  • Trade Logging: Comprehensive trade entry with all essential fields
  • Real-time Synchronization: Automatic data sync across devices
  • Trade Analytics: P&L tracking, win rate, profit factor, and more
  • Trade Status: Track open and closed positions
  • Risk Management: R-multiple calculation and risk tracking

πŸ“– Journal & Documentation

  • Daily Journal: Record thoughts, market observations, and lessons learned
  • Trading Playbooks: Create and manage trading strategies and setups
  • Trade Notes: Detailed notes for each trade including emotions and market conditions

πŸ“ˆ Analytics & Insights

  • Performance Metrics: Total P&L, win rate, profit factor, average win/loss
  • Visual Charts: Performance visualization with Recharts
  • Calendar Integration: Track trading activity by date
  • Filtering & Sorting: Advanced trade filtering and sorting capabilities

πŸ” Authentication & Security

  • Email/Password Authentication: Secure user registration and login
  • Google OAuth: Quick sign-in with Google
  • Password Reset: Secure password recovery
  • User Profiles: Personalized user experience

πŸ”„ Data Migration

  • Automatic Migration: Seamless transition from localStorage to Firebase
  • Data Backup: Export and backup capabilities
  • Real-time Updates: Live data synchronization across devices

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • Firebase account

Installation

  1. Clone the repository

    git clone <repository-url>
    cd zella-trade-scribe
  2. Install dependencies

    npm install
  3. Install Firebase

    npm install firebase
  4. Set up Firebase

    • Follow the Firebase Setup Guide
    • Create a Firebase project
    • Enable Authentication and Firestore
    • Get your Firebase configuration
  5. Configure environment variables

    cp .env.example .env

    Fill in your Firebase configuration in the .env file:

    VITE_FIREBASE_API_KEY=your-api-key
    VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
    VITE_FIREBASE_PROJECT_ID=your-project-id
    VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
    VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
    VITE_FIREBASE_APP_ID=your-app-id
  6. Start the development server

    npm run dev

πŸ—οΈ Tech Stack

Frontend

  • React 18 - Modern React with hooks
  • TypeScript - Type-safe development
  • Vite - Fast build tool and dev server
  • Tailwind CSS - Utility-first CSS framework

UI Components

  • shadcn/ui - Beautiful and accessible React components
  • Radix UI - Low-level UI primitives
  • Lucide React - Beautiful icons
  • Recharts - Composable charting library

Backend & Data

  • Firebase - Backend-as-a-Service
  • Firestore - NoSQL document database
  • Firebase Auth - Authentication service
  • Firebase Storage - File storage (for screenshots)

State Management

  • React Context - Global state management
  • React Query - Server state management
  • React Hook Form - Form state management

Validation & Forms

  • Zod - TypeScript-first schema validation
  • React Hook Form - Performant forms with easy validation

πŸ“ Project Structure

src/
β”œβ”€β”€ components/          # React components
β”‚   β”œβ”€β”€ ui/             # shadcn/ui components
β”‚   β”œβ”€β”€ AuthForm.tsx    # Authentication component
β”‚   β”œβ”€β”€ Dashboard.tsx   # Main dashboard
β”‚   β”œβ”€β”€ TradeLog.tsx    # Trade listing and management
β”‚   β”œβ”€β”€ AddTrade.tsx    # Trade entry form
β”‚   └── ...
β”œβ”€β”€ contexts/           # React contexts
β”‚   β”œβ”€β”€ AuthContext.tsx # Authentication state
β”‚   └── TradeContext.tsx # Trade data state
β”œβ”€β”€ lib/               # Utility libraries
β”‚   β”œβ”€β”€ firebase.ts    # Firebase configuration
β”‚   β”œβ”€β”€ firebaseService.ts # Firebase CRUD operations
β”‚   β”œβ”€β”€ authService.ts # Authentication services
β”‚   └── dataMigration.ts # Migration utilities
β”œβ”€β”€ types/             # TypeScript type definitions
β”‚   └── trade.ts       # Trade-related types
β”œβ”€β”€ hooks/             # Custom React hooks
└── pages/             # Page components

πŸ”₯ Firebase Setup

Required Services

  1. Authentication - Email/Password and Google providers
  2. Firestore Database - Document storage
  3. Storage (Optional) - For trade screenshots

Security Rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
      
      match /{document=**} {
        allow read, write: if request.auth != null && request.auth.uid == userId;
      }
    }
  }
}

πŸ“Š Data Structure

Trade Model

interface Trade {
  id: string;
  symbol: string;
  date: string;
  timeIn: string;
  timeOut?: string;
  side: 'long' | 'short';
  entryPrice: number;
  exitPrice?: number;
  quantity: number;
  pnl?: number;
  commission: number;
  stopLoss?: number;
  takeProfit?: number;
  strategy?: string;
  marketConditions?: string;
  timeframe?: string;
  confidence?: number;
  emotions?: string;
  notes?: string;
  screenshots?: string[];
  status: 'open' | 'closed';
  riskAmount?: number;
  rMultiple?: number;
}

πŸ”„ Migration from localStorage

The app automatically migrates existing localStorage data to Firebase:

  1. Automatic Detection: Checks for existing localStorage data on sign-in
  2. One-time Migration: Migrates trades, journal entries, and playbooks
  3. Data Validation: Ensures data integrity during migration
  4. Cleanup: Removes localStorage data after successful migration

πŸš€ Deployment

Build for Production

npm run build

Deploy to Firebase Hosting

npm install -g firebase-tools
firebase login
firebase init hosting
firebase deploy

Environment Variables for Production

Set up environment variables in your hosting platform or use Firebase configuration.

πŸ› οΈ Development

Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

Code Style

  • ESLint - Code linting
  • TypeScript - Type checking
  • Prettier - Code formatting (recommended)

πŸ” Features Roadmap

βœ… Completed

  • User authentication (email/password, Google)
  • Trade CRUD operations
  • Real-time data synchronization
  • Dashboard with key metrics
  • Data migration from localStorage
  • Responsive design

🚧 In Progress

  • Trade import/export functionality
  • Advanced analytics and reporting
  • Trading strategy backtesting
  • Performance comparison tools

πŸ“‹ Planned

  • Mobile app (React Native)
  • Advanced charting integration
  • AI-powered trade insights
  • Multi-timeframe analysis
  • Community features
  • API integrations with brokers

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

πŸ™ Acknowledgments


Made with ❀️ for traders, by traders.

About

My Generated trading journal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published