Skip to content

xsa-dev/jesse-optimization-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Jesse Optimization CLI

CLI tool for creating and monitoring optimization sessions for Jesse Trading Bot trading strategies.

Features

  • πŸš€ Create optimizations for multiple trading pairs and exchanges
  • πŸ“Š Monitor optimization progress in real-time
  • βš™οΈ Flexible configuration through files and command line arguments
  • πŸ“ Load coin and exchange lists from files
  • πŸ”§ Override parameters through environment variables

Note: The cpu_cores parameter does not affect optimization operation - the server ignores its value but requires its presence in the request.

Installation

Requirements

  • Python 3.8+
  • uv for dependency management

Installing dependencies

# Install uv (if not installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install project dependencies
uv sync

Quick Start

1. Initialize configuration

# Create default configuration files
python main.py --init

This will create the following files:

  • config.json - main configuration
  • symbols.txt - list of trading pairs
  • exchanges.txt - list of exchanges

2. Run optimization

# Run with default configuration
python main.py

# Run with monitoring
python main.py --monitor

# Run single optimization
python main.py --single --symbol BTC-USDT --exchange "Bybit Spot"

Configuration

config.json file

{
  "base_url": "http://localhost:9000",
  "auth_token": "your_auth_token_here",
  "exchange": "Bybit Spot",
  "strategy": "CloudScalper",
  "timeframe": "15m",
  "data_timeframes": ["4h", "6h"],
  "training_start_date": "2023-03-29",
  "training_finish_date": "2024-12-31",
  "testing_start_date": "2025-01-01",
  "testing_finish_date": "2025-09-01",
  "trials": "200",
  "optimal_total": 50,
  "fast_mode": true,
  "debug_mode": false,
  "monitor_interval": 60,
  "max_monitor_attempts": 100
}

symbols.txt file

BTC-USDT
ETH-USDT
ADA-USDT
# Comments start with #

exchanges.txt file

Bybit Spot
Binance Spot
KuCoin Spot

Usage

Basic commands

# Create configuration files
python main.py --init

# Run with configuration files
python main.py --config config.json --symbols-file symbols.txt --exchanges-file exchanges.txt

# Run with custom parameters
python main.py --symbols BTC-USDT ETH-USDT --exchanges "Bybit Spot" "Binance Spot"

# Run single optimization
python main.py --single --symbol BTC-USDT --exchange "Bybit Spot" --monitor

# Override parameters
python main.py --strategy CloudScalper2024 --timeframe 1h --trials 500

Environment variables

You can override settings through environment variables:

export OPTIMIZATION_BASE_URL="http://your-server:9000"
export OPTIMIZATION_AUTH_TOKEN="your_token_here"
export OPTIMIZATION_STRATEGY="CloudScalper2024"
export OPTIMIZATION_TRIALS="500"

python main.py

Monitoring

# Monitoring with 30 second interval
python main.py --monitor --monitor-interval 30

# Monitoring with maximum 200 attempts
python main.py --monitor --max-attempts 200

Project structure

optimization_cli/
β”œβ”€β”€ main.py                 # Main CLI script
β”œβ”€β”€ pyproject.toml          # Project configuration and dependencies
β”œβ”€β”€ config.json             # Configuration (created via --init)
β”œβ”€β”€ symbols.txt             # List of trading pairs (created via --init)
β”œβ”€β”€ exchanges.txt           # List of exchanges (created via --init)
└── optimization_lib/       # Library
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ client.py           # Client for creating optimizations
    β”œβ”€β”€ api.py              # API for monitoring
    └── config.py           # Configuration management

Usage examples

Batch optimization

# Create symbols.txt file with your trading pairs
echo "BTC-USDT
ETH-USDT
ADA-USDT
DOT-USDT" > symbols.txt

# Create exchanges.txt file with exchanges
echo "Bybit Spot
Binance Spot" > exchanges.txt

# Run optimization for all combinations
python main.py --monitor

Custom configuration

# Create custom config
python main.py --init
# Edit config.json

# Run with custom config
python main.py --config config.json --monitor

Programmatic usage

from optimization_lib import OptimizationClient, OptimizationConfig

# Create client
client = OptimizationClient(
    base_url="http://localhost:9000",
    auth_token="your_token"
)

# Create optimization
result = client.create_optimization(
    exchange="Bybit Spot",
    symbol="BTC-USDT",
    strategy="CloudScalper"
)

if result["success"]:
    print(f"Optimization created: {result['optimization_id']}")

Development

Development installation

# Install with development dependencies
uv sync --dev

# Run tests
uv run pytest

# Code formatting
uv run black .
uv run isort .

# Type checking
uv run mypy .

Adding new dependencies

# Add dependency
uv add requests

# Add dev dependency
uv add --dev pytest

Troubleshooting

Server connection error

  1. Check the correctness of base_url in configuration
  2. Make sure the server is accessible
  3. Check the authorization token

File loading error

  1. Make sure symbols.txt and exchanges.txt files exist
  2. Check file format (one entry per line)
  3. Make sure files are not empty

Monitoring issues

  1. Increase monitor_interval to reduce load
  2. Increase max_monitor_attempts for long optimizations
  3. Check server logs for errors

License

MIT License

Support

For help, create an issue in the project repository.

About

CLI tool for creating and monitoring optimization sessions for Jesse Trading Bot trading strategies

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages