Skip to content
bitopan09Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

72 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– BTC Trading Bot - Advanced Dashboard

An intelligent BTC/USD paper trading bot with a modern web dashboard, Telegram notifications, and 24-hour continuous operation in IST timezone.

✨ Features

βœ… 24/7 Bot Operation - Runs continuously in IST timezone βœ… Real-time Dashboard - Live BTC price, trades, and balance tracking βœ… Telegram Notifications - Get alerts for every trade executed βœ… IST Timezone Support - All times displayed in Indian Standard Time βœ… Trade Journal - Comprehensive history with export to CSV βœ… Live Chart - Real-time BTC/USD price visualization βœ… Backtester - Test strategy on historical data βœ… Docker Ready - One-click deployment βœ… Remote Access - Deploy anywhere and access from any device βœ… Manual Trading - Execute trades manually when needed

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm
  • Telegram bot token from BotFather

Setup (2 minutes)

  1. Clone & Install
git clone <repo-url>
cd newtrade
bash setup.sh
  1. Configure Telegram Edit .env:
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
TELEGRAM_CHAT_ID=your-telegram-chat-id
SEND_TELEGRAM_ON_TRADE=true
  1. Start Bot
npm start
  1. Access Dashboard Open browser: http://localhost:5001

πŸ“Š Dashboard Features

Bot Status

  • Real-time bot status (Online/Offline)
  • Daily trade count
  • Last analysis timestamp (IST)

Live Price Chart

  • Real-time BTC/USD chart
  • 50-point data visualization
  • Current price display

Balance Tracker

  • USD balance
  • BTC balance
  • Total portfolio value

Active Trades

  • Live P&L updates
  • Entry/Exit levels
  • Stop Loss & Take Profit

Trade Journal

  • All trades with timestamps (IST)
  • P&L calculation
  • Export to CSV

Manual Trading

  • Execute Buy/Sell manually
  • Configurable quantity
  • Real-time feedback

Telegram Notifications

Receive instant alerts when:

  • A trade is executed
  • Daily summary sent at midnight
  • Errors or warnings occur

Setup Telegram

  1. Create a bot with BotFather.
  2. Add the token to .env or Railway Variables.
  3. Open your bot chat and send /start.
  4. Call POST /api/telegram/verify to discover TELEGRAM_CHAT_ID if needed.
  5. Add the chat ID and redeploy.

Required variables:

TELEGRAM_BOT_TOKEN=your-telegram-bot-token
TELEGRAM_CHAT_ID=your-telegram-chat-id
SEND_TELEGRAM_ON_TRADE=true

🐳 Docker Deployment

Quick Deploy

docker-compose up -d

Access

☁️ Cloud Deployment

Heroku

heroku create trading-bot
heroku config:set TELEGRAM_BOT_TOKEN=your-telegram-bot-token
heroku config:set TELEGRAM_CHAT_ID=your-telegram-chat-id
heroku config:set SEND_TELEGRAM_ON_TRADE=true
git push heroku main

AWS/DigitalOcean/Azure

See DEPLOYMENT.md for detailed instructions.

βš™οΈ Configuration

.env Options

# Server
PORT=5001
NODE_ENV=production

# Telegram
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
TELEGRAM_CHAT_ID=your-telegram-chat-id

# Bot
BOT_ENABLED=true
DAILY_TRADE_LIMIT=1
BOT_START_HOUR=0
BOT_END_HOUR=23

# Notifications
SEND_TELEGRAM_ON_TRADE=true
SEND_DAILY_SUMMARY=true
SEND_ERROR_ALERTS=true

# Timezone (always IST for this bot)
TIMEZONE=Asia/Kolkata

πŸ“Š API Endpoints

# Bot Status
GET /api/bot/status

# Get Current Price
GET /api/price

# Get Trades
GET /api/trades
GET /api/trades/active

# Manual Trade
POST /api/manual-trade
  { "action": "BUY", "quantity": 0.01 }

# Telegram Status
GET /api/telegram/status

# Test Telegram
POST /api/telegram/test

# Export Trades
GET /api/trades/export

πŸ”§ Development

Project Structure

newtrade/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ server.js              # Main server
β”‚   β”œβ”€β”€ tradingBot.js          # Bot core
β”‚   β”œβ”€β”€ analysisEngine.js      # Trading logic
β”‚   β”œβ”€β”€ decisionEngine.js      # Signal generation
β”‚   β”œβ”€β”€ executionEngine.js     # Trade execution
β”‚   └── emailService.js        # Telegram notifications
β”œβ”€β”€ frontend/
β”‚   └── src/
β”‚       β”œβ”€β”€ components/        # UI components
β”‚       β”œβ”€β”€ utils/
β”‚       β”‚   └── timeFormatter.js # IST formatting ✨ NEW
β”‚       └── services/
β”‚           └── api.js         # API calls
└── docker-compose.yml         # Docker setup ✨ NEW

Running Locally

# Terminal 1: Backend
npm run dev:backend

# Terminal 2: Frontend
npm run dev:frontend

Local Backtests

# Runs the same unified logic used by the live bot
node improved_backtest_cpr.js 90

The backtester uses the same closed-candle signal logic, realistic lifecycle accounting, and risk settings as the bot.

πŸ“ˆ Trading Logic

  • Strategy: Advanced 10-Factor Confluence Scoring (EMA, RSI, MACD, CPR, VWAP, Wyckoff, etc.)
  • Timeframe: 6-hour candles
  • Position Sizing: Confluence-scaled, two-decimal BTC lots only: 0.01 through 0.08 BTC; scores 8+ target larger lots while risk guards still cap oversized stops.
  • Risk Management: Smart Stop Loss, partial TP, final TP, and trailing stop logic.
  • Hours: Configurable session gate. Current defaults allow 24-hour analysis.

⚠️ Disclaimer

  • Paper Trading: Current implementation logs paper trades; it does not place real exchange orders
  • Not Financial Advice: Use at your own risk
  • Paper Trading: Test thoroughly before using real money
  • Monitor Actively: Always monitor bot performance

πŸ› Troubleshooting

Telegram alerts not sending?

# Check Telegram status
curl http://localhost:5001/api/telegram/status

# Verify bot/chat
curl -X POST http://localhost:5001/api/telegram/verify

# Send test alert
curl -X POST http://localhost:5001/api/telegram/test

Bot not starting?

# Check logs
docker-compose logs trading-bot

# Or run locally
npm start

Database issues?

# Reset database
rm trading.db
docker-compose restart

πŸ“š Documentation

🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

πŸ“„ License

MIT License - See LICENSE file

πŸ“§ Support

For issues or questions:

  1. Check DEPLOYMENT.md
  2. Review logs: docker-compose logs -f
  3. Test Telegram: curl -X POST http://localhost:5001/api/telegram/test

Last Updated: May 2026 Timezone: Asia/Kolkata (IST) βœ… Status: Production Ready βœ… Features: 24/7 Operation, Telegram Alerts, IST Support βœ…

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages