Skip to Content
Tinga TingaGetting Started

Getting Started

This guide walks you through setting up the Tinga Tinga trading strategy.

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Binance account (for live trading)

Installation

# Clone or navigate to project cd tinga-tinga # Install dependencies npm install # Or with yarn yarn install

Configuration

Environment Variables

Create a .env file:

# Binance API (for live/paper trading) BINANCE_API_KEY=your_api_key BINANCE_API_SECRET=your_api_secret BINANCE_TESTNET=true # Notifications (optional) TELEGRAM_BOT_TOKEN=your_bot_token TELEGRAM_CHAT_ID=your_chat_id

Strategy Configuration

Edit config/default.json:

{ "strategy": { "rsiPeriod": 14, "rsiOversold": 30, "rsiOverbought": 70, "atrPeriod": 14, "atrStopMultiplier": 1.5, "atrTargetMultiplier": 3.0 }, "risk": { "riskPerTrade": 0.02, "maxPositionSize": 0.10, "maxOpenTrades": 3 }, "trading": { "symbols": ["BTCUSDT", "ETHUSDT"], "timeframe": "1h" } }

Running the Strategy

Backtesting

# Run backtest with default settings npm run backtest # Specify date range npm run backtest -- --start 2023-01-01 --end 2024-01-01 # Specific symbol npm run backtest -- --symbol BTCUSDT

Paper Trading

# Start paper trading (testnet) npm run paper # With specific symbols npm run paper -- --symbols BTCUSDT,ETHUSDT

Live Trading

Warning: Live trading involves real financial risk. Always test thoroughly first.

# Set testnet to false in .env BINANCE_TESTNET=false # Start live trading npm run live

Backtest Output

======================================== TINGA TINGA BACKTEST RESULTS ======================================== Symbol: BTCUSDT Period: 2023-01-01 to 2024-01-01 Timeframe: 1h ---------------------------------------- Initial Balance: $10,000 Final Balance: $12,850 Net Profit: $2,850 (28.5%) ---------------------------------------- Total Trades: 68 Winning Trades: 41 (60.3%) Losing Trades: 27 (39.7%) ---------------------------------------- Profit Factor: 1.65 Max Drawdown: 8.7% Sharpe Ratio: 1.38 Average Trade: $41.91 ========================================

Project Scripts

ScriptCommandDescription
backtestnpm run backtestRun historical backtest
papernpm run paperPaper trading mode
livenpm run liveLive trading (use caution)
testnpm testRun unit tests
lintnpm run lintCode linting

Troubleshooting

API Connection Issues

# Test Binance connection npm run test:connection

Common Errors

ErrorSolution
ENOTFOUNDCheck internet connection
Invalid API-keyVerify API key in .env
Timestamp errorSync system clock

Next Steps

Last updated on