Skip to content

WORKING_EXAMPLES

Alxy Savin edited this page Oct 21, 2025 · 1 revision

Working Examples of Hyperliquid Backtester

This file contains information about the working examples in the project.

Available Examples

1. simple_example – Basic Example

Demonstrates the core functionality of the library:

  • Creation of positions and orders
  • Use of the risk manager
  • Simulation of order execution
  • Handling of funding payments
  • Generation of risk‑management orders

Run:

cargo run --example simple_example

2. mode_reporting_example – Reporting Example

Demonstrates:

  • Order validation through the risk manager
  • Generation of stop‑loss and take‑profit orders
  • Checking order triggers based on price

Run:

cargo run --example mode_reporting_example

3. unified_data_example – Data‑Structure Example

Demonstrates:

  • Creation and management of positions
  • Working with orders (market and limit)
  • Creation of market data
  • Configuration of trading parameters
  • Order validation

Run:

cargo run --example unified_data_example

Disabled Examples

Most examples in the examples/ folder are disabled because they require modules that are not implemented in the current minimal version of the library. These examples are commented out in Cargo.toml and include:

  • basic_backtest – requires back‑testing modules
  • comprehensive_example – requires full functionality
  • csv_export_example – requires an export module
  • funding_* examples – require funding‑rates modules
  • live_trading_* examples – require live‑trading modules
  • strategy_* examples – require strategy modules
  • And many others…

Current Library Functionality

The library contains only the basic modules:

  • backtest – basic structures for back‑testing
  • risk_manager – risk‑management
  • unified_data – unified data structures

Recommendations

  1. Start with simple_example to understand the basic functionality.
  2. Study mode_reporting_example to grasp risk‑management.
  3. If full functionality is needed, consider extending the library or using alternative solutions.