Nija

NIJA Getting Started Guide

This guide will help you get NIJA up and running quickly, whether you want to trade with just the platform account or enable multi-user trading.

Table of Contents


Prerequisites

Before you begin, you’ll need:

  1. Python 3.11+ installed
  2. API credentials from one or more exchanges:
    • Coinbase (recommended for beginners)
    • Kraken (optional, for expanded market access)

Quick Setup (5 minutes)

Step 1: Clone and Install

# Clone the repository
git clone https://github.com/dantelrharrell-debug/Nija.git
cd Nija

# Install dependencies
pip install -r requirements.txt

Step 2: Create Your .env File

# Run the setup helper script
python3 setup_env.py

This creates a .env file from the template with placeholder values.

Step 3: Configure Coinbase (Platform Account)

  1. Get API credentials from Coinbase:
    • Go to https://www.coinbase.com/
    • Navigate to API settings
    • Create a new API key with trading permissions
    • Save your credentials securely
  2. Edit .env file:
    nano .env  # or use your preferred editor
    
  3. Fill in Coinbase credentials:
    COINBASE_ORG_ID=your-org-id-here
    COINBASE_JWT_PEM="-----BEGIN EC PRIVATE KEY-----\nYOUR_KEY_HERE\n-----END EC PRIVATE KEY-----"
    COINBASE_JWT_KID=your-kid-here
    COINBASE_JWT_ISSUER=organizations/your-org-id-here
    

Step 4: Run NIJA

python3 bot.py

You should see:

✅ PLATFORM ACCOUNT: TRADING (Broker: coinbase)
❌ USER #1 (Daivon Frazier): NOT TRADING (Connection failed or not configured)
❌ USER #2 (Tania Gilbert): NOT TRADING (Connection failed or not configured)

This is normal! User accounts are optional. NIJA will trade with the platform account.


Adding Kraken Platform Account (REQUIRED for Production)

⚠️ CRITICAL: Kraken Platform account credentials are REQUIRED for stable operation, even if you only trade with user accounts.

Configuring Platform Kraken credentials (even with $0 balance) provides:

The Platform account does not need trading capital - it just needs to exist and connect.

Quick Setup for Kraken Platform

🚀 NEW: Quick Guide Available!

For the fastest setup, check out:

Manual Setup (5 minutes)

  1. Get Kraken API credentials:
    • Log in to Kraken: https://www.kraken.com/u/security/api
    • Click “Generate New Key”
    • Name it “NIJA Trading Bot - Platform”
    • IMPORTANT: Use “Classic API Key” (NOT OAuth)
    • Enable permissions:
      • ✅ Query Funds
      • ✅ Query Open Orders & Trades
      • ✅ Query Closed Orders & Trades
      • ✅ Create & Modify Orders
      • ✅ Cancel/Close Orders
    • Save both the API key and private key
  2. Add to .env file (local) OR Railway/Render (production):
    # REQUIRED for stable operation
    KRAKEN_PLATFORM_API_KEY=your-platform-api-key
    KRAKEN_PLATFORM_API_SECRET=your-platform-private-key
    
  3. Restart NIJA

You should now see:

✅ Kraken Platform credentials detected
🔷 PLATFORM ACCOUNTS (Primary Trading Accounts):
   • KRAKEN: ✅ CONNECTED
✅ ACCOUNT HIERARCHY STATUS:
   ✅ All user accounts have corresponding Platform accounts (correct hierarchy)

For Railway/Render deployments: See SETUP_MASTER_KRAKEN.md for platform-specific instructions.


Enabling User Accounts

User accounts allow NIJA to manage multiple trading accounts independently. This is useful for:

Why You See “No user accounts configured”

If you see:

⚪ No user accounts configured

This is normal and expected when user accounts are disabled in the configuration files. User accounts are completely optional - NIJA works perfectly with just the platform account.

User accounts in config/users/*.json files are disabled by default ("enabled": false) and should only be enabled after:

  1. You have API credentials for that user
  2. You’ve added those credentials to your environment variables
  3. You want NIJA to manage that account

To Enable User #1 (Daivon Frazier)

  1. Get Kraken API credentials:
    • Log in to Kraken: https://www.kraken.com/u/security/api
    • Click “Generate New Key”
    • Name it “NIJA Trading Bot - Daivon”
    • Enable permissions:
      • ✅ Query Funds
      • ✅ Query Open Orders & Trades
      • ✅ Query Closed Orders & Trades
      • ✅ Create & Modify Orders
      • ✅ Cancel/Close Orders
    • Save both the API key and private key
  2. Add to .env file:
    KRAKEN_USER_DAIVON_API_KEY=your-daivon-api-key
    KRAKEN_USER_DAIVON_API_SECRET=your-daivon-private-key
    
  3. Enable the user in config file:

    Edit config/users/retail_kraken.json and find the Daivon Frazier user object. Change "enabled" from false to true:

    Before:

    {
      "user_id": "daivon_frazier",
      "name": "Daivon Frazier",
      "account_type": "retail",
      "broker_type": "kraken",
      "enabled": false,
      "description": "Retail user - Kraken crypto account (disabled - set to true after adding credentials)"
    }
    

    After:

    {
      "user_id": "daivon_frazier",
      "name": "Daivon Frazier",
      "account_type": "retail",
      "broker_type": "kraken",
      "enabled": true,
      "description": "Retail user - Kraken crypto account"
    }
    
  4. Restart NIJA:
    python3 bot.py
    

You should now see:

✅ USER: Daivon Frazier: TRADING (Broker: Kraken)

To Enable User #2 (Tania Gilbert)

Follow the same process as User #1:

  1. Get Kraken API credentials for Tania
  2. Add to .env file:
    KRAKEN_USER_TANIA_API_KEY=your-tania-api-key
    KRAKEN_USER_TANIA_API_SECRET=your-tania-private-key
    
  3. Enable in config/users/retail_kraken.json by changing "enabled" to true
  4. Restart NIJA

Verify Configuration

Run the verification script:

python3 kraken_deployment_verify.py

Expected output when all accounts are configured:

✅ Platform Account: READY to trade on Kraken
✅ User #1 (Daivon Frazier): READY to trade on Kraken
✅ User #2 (Tania Gilbert): READY to trade on Kraken

Troubleshooting

“NOT TRADING (Connection failed or not configured)”

This is normal if you haven’t configured that account yet. User accounts are optional.

To fix (if you want that account to trade):

  1. Get API credentials from Kraken
  2. Add them to .env file
  3. Restart NIJA

To ignore: If you don’t need user accounts, you can safely ignore these messages. NIJA will trade with the platform account only.

“Invalid nonce” errors

Already fixed in the code! If you still see this:

  1. Make sure each account uses separate API keys
  2. Don’t share API keys between accounts
  3. Check that system clock is accurate

“Permission denied” errors

Your API key doesn’t have the required permissions:

  1. Go to https://www.kraken.com/u/security/api
  2. Edit your API key
  3. Enable all required permissions (see list above)
  4. Save and restart NIJA

Environment variables not loading

  1. Make sure .env file exists in the project root
  2. Check there are no syntax errors in .env
  3. Verify python-dotenv is installed: pip install python-dotenv
  4. Try loading environment manually:
    export $(cat .env | xargs)
    python3 bot.py
    

Still having issues?

  1. Check the main README.md for detailed setup instructions
  2. Review KRAKEN_ENV_VARS_REFERENCE.md for variable names
  3. See MULTI_USER_SETUP_GUIDE.md for advanced multi-user setup
  4. Open an issue on GitHub with your error logs (remove API keys!)

Deployment to Production

For deploying to Railway or Render:

  1. Railway:
    • Go to https://railway.app
    • Create new project from GitHub repo
    • Add environment variables in Variables tab
    • See: KRAKEN_ENV_VARS_REFERENCE.md for exact variable names
  2. Render:
    • Go to https://render.com
    • Create new Web Service from GitHub repo
    • Add environment variables in Environment tab
    • See: KRAKEN_ENV_VARS_REFERENCE.md for exact variable names
  3. Verify deployment:
    python3 kraken_deployment_verify.py
    

Security Best Practices

⚠️ IMPORTANT:


Next Steps

Once NIJA is running:

  1. Monitor the logs to see trading activity
  2. Check account balances regularly
  3. Review strategy documentation in APEX_V71_DOCUMENTATION.md
  4. Adjust parameters in your .env if needed
  5. Set up TradingView webhooks (see TRADINGVIEW_SETUP.md)

Summary

Minimum setup for trading:

Optional user accounts:

The “NOT TRADING” messages are normal if you haven’t configured those accounts. NIJA will work fine with just the platform account!


Need help? See the documentation in: