sitetooling.space
Marketplace/lirium-trading

lirium-trading

lirium-trading

Lirium is a modern live trading platform that uses AI to automatically calculate optimal Take Profit (TP) and Stop Loss (SL) levels. Users simply click BUY or SELL, and Claude AI analyzes market conditions to determine the best risk management levels.

Repository Details

Languages
Vue62.2%
TypeScript25.6%
PLpgSQL5.2%
Shell4.4%
CSS1.5%
0stars
Last updated 3 months ago

README

šŸš€ Lirium - AI-Powered Live Trading Platform

<div align="center">

Lirium Logo

One-Click Trading with AI-Calculated TP/SL Levels

Nuxt.js Supabase Claude AI MetaAPI

</div>

šŸ“‹ Table of Contents


šŸŽÆ Overview

Lirium is a modern live trading platform that uses AI to automatically calculate optimal Take Profit (TP) and Stop Loss (SL) levels. Users simply click BUY or SELL, and Claude AI analyzes market conditions to determine the best risk management levels.

How It Works:

  1. User selects symbol (EUR/USD or XAU/USD)
  2. User clicks BUY or SELL
  3. AI analyzes recent price history, volatility, and trends
  4. AI calculates optimal TP/SL with minimum 2:1 risk-reward ratio
  5. Trade executes on MT5 via MetaAPI
  6. Live price updates via Supabase Realtime

✨ Features

  • šŸ¤– AI-Powered TP/SL - Claude AI calculates optimal levels
  • šŸ“Š TradingView Charts - Professional lightweight charts
  • ⚔ Real-Time Prices - Live updates via Supabase Realtime
  • šŸŽØ Beautiful UI - Tailwind CSS + shadcn-vue components
  • šŸ“ˆ MT5 Integration - Execute trades on real MT5 accounts
  • šŸ”’ Secure - Row-level security with Supabase
  • šŸ“± Responsive - Works on desktop and mobile

šŸ› ļø Tech Stack

Frontend

  • Nuxt.js 4 - Vue 3 framework
  • Tailwind CSS - Utility-first styling
  • TradingView Lightweight Charts - Financial charts
  • shadcn-vue - UI components
  • Lucide Icons - Icon library

Backend

  • Supabase - PostgreSQL database + real-time + auth
  • Supabase Edge Functions - Serverless Deno functions
  • MetaAPI - MT5 broker integration
  • Anthropic Claude API - AI TP/SL calculation

šŸ“ Project Structure

lirium-trading/
ā”œā”€ā”€ frontend/                    # Nuxt.js 4 application
│   ā”œā”€ā”€ assets/
│   │   └── css/main.css        # Tailwind styles
│   ā”œā”€ā”€ components/
│   │   ā”œā”€ā”€ TradingChart.vue    # TradingView chart
│   │   └── ui/                 # shadcn components
│   ā”œā”€ā”€ pages/
│   │   └── index.vue           # Main trading page
│   ā”œā”€ā”€ plugins/
│   │   └── supabase.client.ts  # Supabase plugin
│   ā”œā”€ā”€ nuxt.config.ts
│   ā”œā”€ā”€ tailwind.config.js
│   └── package.json
│
ā”œā”€ā”€ backend/                     # Supabase backend
│   ā”œā”€ā”€ supabase/
│   │   └── functions/
│   │       ā”œā”€ā”€ calculate-tpsl/ # AI TP/SL calculator
│   │       ā”œā”€ā”€ execute-trade/  # Trade execution
│   │       └── price-feed/     # Price updates
│   └── supabase-schema.sql     # Database schema
│
└── README.md

šŸš€ Setup Instructions

Prerequisites

  • Node.js 18+ and npm
  • Supabase account
  • MetaAPI account (for MT5)
  • Anthropic API key (for Claude)

Step 1: Clone the Repository

git clone <your-repo>
cd lirium-trading

Step 2: Frontend Setup

cd frontend
npm install
cp .env.example .env

Edit .env:

SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key
METAAPI_TOKEN=your_metaapi_token
METAAPI_ACCOUNT_ID=your_mt5_account_id

Step 3: Supabase Setup

  1. Create Supabase Project

    • Go to supabase.com
    • Create new project
    • Copy Project URL and Anon Key
  2. Run Database Schema

    # In Supabase SQL Editor, run:
    cd ../backend
    # Copy contents of supabase-schema.sql and run in Supabase SQL Editor
    
  3. Deploy Edge Functions

    # Install Supabase CLI
    npm install -g supabase
    
    # Login
    supabase login
    
    # Link project
    supabase link --project-ref your-project-ref
    
    # Set secrets
    supabase secrets set ANTHROPIC_API_KEY=your_claude_api_key
    supabase secrets set METAAPI_TOKEN=your_metaapi_token
    supabase secrets set METAAPI_ACCOUNT_ID=your_account_id
    
    # Deploy functions
    supabase functions deploy calculate-tpsl
    supabase functions deploy execute-trade
    supabase functions deploy price-feed
    
  4. Setup Realtime

    • In Supabase Dashboard → Database → Replication
    • Enable realtime for prices table
  5. Setup Cron Job (Price Feed)

    • Go to Database → Cron Jobs (pg_cron extension)
    • Add job to run price-feed every 2 seconds

Step 4: Get API Keys

MetaAPI (MT5 Integration)

  1. Go to metaapi.cloud
  2. Sign up and create account
  3. Get API token from Dashboard
  4. Connect your MT5 account (demo recommended for testing)
  5. Copy Account ID

Anthropic Claude API

  1. Go to console.anthropic.com
  2. Create API key
  3. Copy key (starts with sk-ant-...)

Step 5: Run the Application

# Frontend
cd frontend
npm run dev
# Open http://localhost:3000

šŸ”‘ API Keys Required

| Service | Purpose | Get It From | |---------|---------|-------------| | Supabase URL | Database & Realtime | supabase.com | | Supabase Anon Key | Client auth | Supabase Dashboard | | MetaAPI Token | MT5 connection | metaapi.cloud | | MetaAPI Account ID | Your MT5 account | MetaAPI Dashboard | | Anthropic API Key | Claude AI | console.anthropic.com |


šŸ“¦ Deployment

Frontend (Vercel/Netlify)

cd frontend
npm run build

# Deploy to Vercel
vercel

# Or Netlify
netlify deploy

Backend (Supabase)

  • Edge Functions auto-deploy via Supabase CLI
  • Database hosted on Supabase

šŸ“– Usage Guide

Making a Trade

  1. Select Symbol: Click EUR/USD or XAU/USD button
  2. Adjust Lot Size: Use +/- buttons or type directly
  3. Review AI Signal: Check AI recommendation (BUY/SELL)
  4. Click BUY or SELL: Opens confirmation modal
  5. Review TP/SL: AI-calculated levels shown
  6. Confirm: Trade executes on MT5

Monitoring Trades

  • Live Chart: Real-time price updates every 2 seconds
  • Recent Trades: See last 3 trades with P&L
  • Balance: Top-right corner shows account balance

Understanding AI Analysis

The AI considers:

  • Recent price volatility (ATR)
  • Support/Resistance levels
  • Risk-Reward ratio (min 2:1)
  • Market trend direction

🚨 Important Notes

  • āš ļø Test First: Use MetaAPI demo account before live trading
  • šŸ’° Risk Management: AI suggests levels but always review
  • šŸ“Š Costs: MetaAPI ~$50/month, Anthropic pay-per-use
  • šŸ” Security: Never commit .env files
  • šŸ“œ Regulations: Check local trading platform laws

šŸ› Troubleshooting

Price Updates Not Working

  • Check Supabase Realtime is enabled for prices table
  • Verify price-feed Edge Function is deployed
  • Check cron job is running

Trades Not Executing

  • Verify MetaAPI credentials in Supabase secrets
  • Check MT5 account is connected in MetaAPI dashboard
  • Review Edge Function logs: supabase functions logs execute-trade

AI Not Calculating TP/SL

  • Verify Anthropic API key in Supabase secrets
  • Check Edge Function logs: supabase functions logs calculate-tpsl
  • Ensure you have API credits

šŸ“„ License

MIT License - See LICENSE file


šŸ¤ Contributing

Pull requests welcome! Please read CONTRIBUTING.md first.


šŸ“ž Support


<div align="center">

Built with ā¤ļø using Nuxt.js, Supabase, and Claude AI

⭐ Star this repo if you found it helpful!

</div>