Tutorials

Tutorials

Step-by-step guides for building with LX - from your first trade to production deployment

LX Tutorials

Welcome to the LX tutorial series. These guides take you from beginner to production-ready, covering everything from placing your first trade to building sophisticated trading systems.

Learning Path

Follow this recommended progression to build your skills systematically:

                    LEARNING PATH
                         |
          +--------------+--------------+
          |                             |
    [Beginner]                    [Intermediate]
          |                             |
    1. First Trade                5. Orderbook Sync
    2. Authentication             6. Streaming Data
    3. Testing                    7. Market Maker Bot
          |                             |
          +--------------+--------------+
                         |
                   [Advanced]
                         |
                 8. Arbitrage Strategies
                 9. Production Deployment
                10. Exchange Migration

Beginner Tutorials

Start here if you are new to LX.

TutorialDurationWhat You Will Learn
Your First Trade15 minPlace orders, check fills, understand basics
Authentication Setup10 minAPI keys, JWT tokens, secure connections
Testing on Testnet20 minSafe environment for development

Intermediate Tutorials

Build on the basics with real-time data and automation.

TutorialDurationWhat You Will Learn
Orderbook Synchronization30 minKeep local orderbook in sync with exchange
Real-time Streaming25 minWebSocket feeds, event handling
Market Maker Bot45 minBuild a basic market making strategy

Advanced Tutorials

Production-grade systems and professional strategies.

TutorialDurationWhat You Will Learn
Arbitrage Strategies40 minCross-market and triangular arbitrage
Production Checklist30 minDeploy with confidence
Migration Guide35 minMove from other exchanges

Prerequisites

Before starting these tutorials, ensure you have:

Development Environment

# Required
node --version    # v18.0.0 or higher
python --version  # 3.10 or higher
go version        # 1.21 or higher

# Optional (for advanced tutorials)
docker --version  # 24.0 or higher

LX Node Running

# Clone the repository
git clone https://github.com/luxfi/dex
cd dex

# Build and run
make build
./bin/lxd --testnet

SDK Installation

Choose your preferred language:

# TypeScript/JavaScript
npm install @luxfi/trading

# Python
pip install lux-dex

# Go
go get github.com/luxfi/dex/sdk/go

Tutorial Format

Each tutorial follows a consistent structure:

  1. Objectives - What you will accomplish
  2. Prerequisites - What you need before starting
  3. Step-by-step Instructions - Detailed walkthrough
  4. Complete Code Examples - Working code in all supported languages
  5. Expected Output - What success looks like
  6. Common Pitfalls - Mistakes to avoid
  7. Next Steps - Where to go from here

Code Examples

All tutorials include complete, working code examples in:

  • TypeScript - Web and Node.js applications
  • Python - Data analysis and algorithmic trading
  • Go - High-performance server applications
  • cURL - Command-line testing

Support

If you get stuck:

  1. Check the FAQ for common issues
  2. Review the API Reference for detailed specifications
  3. Join our Discord for community help
  4. Open an issue on GitHub

Quick Reference

Endpoints

EnvironmentJSON-RPCWebSocketgRPC
Testnethttp://localhost:8080/rpcws://localhost:8081localhost:50051
Mainnethttps://api.lux.network/rpcwss://api.lux.network/wsgrpc.lux.network:443

Common Operations

import { DEX } from '@luxfi/trading'

// Quick reference - TypeScript
const dex = await DEX({ rpcUrl: 'http://localhost:8080/rpc' })

// Place order
await dex.limitBuy('BTC-USD', '0.1', '50000')

// Cancel order
await dex.cancelOrder(orderId)

// Get orderbook
const book = await dex.getOrderBook('BTC-USD', 20)

Ready to start? Begin with Your First Trade.