API Reference

This section provides comprehensive documentation for all Planar.jl modules and functions. Each module page includes function signatures, detailed descriptions, working code examples, and usage patterns.

Quick Navigation

Core Trading Components

  • Strategies - Strategy base classes, interfaces, and core functionality
  • Engine - Core execution engine for backtesting, paper trading, and live trading
  • Executors - Order execution and trade management
  • Instances - Strategy instance management and asset handling

Data Management

  • Data - Data structures, persistence, and OHLCV data handling
  • Fetch - Data fetching and retrieval utilities
  • Processing - Data processing and transformation functions
  • Collections - Specialized collection types and utilities

Exchange Integration

Analysis & Optimization

Visualization & Utilities

Getting Started with the API

Basic Usage Pattern

Most Planar functions follow these common patterns:

# Activate PlanarInteractive project
import Pkg
Pkg.activate("PlanarInteractive")

try
    using PlanarInteractive
    @environment!

    # Example API usage patterns
    println("Common Planar API patterns:")
    
    # Load a strategy (example)
    println("s = strategy(:MyStrategy)  # Load strategy")
    
    # Access strategy data (examples)
    println("assets_list = assets(s)    # Get assets")
    println("exchange_info = exchange(s) # Get exchange")
    println("current_cash = freecash(s)  # Get cash")
    
    # Work with data (examples)
    println("ohlcv_data = load_ohlcv(s)  # Load OHLCV data")
    println("fetch_ohlcv!(s)            # Fetch new data")
    
    # Note: Real usage requires proper strategy configuration
    
catch e
    @warn "PlanarInteractive not available: $e"
end

Common Function Categories

  1. Strategy Functions: Functions that operate on Strategy objects
  2. Data Functions: Functions for loading, processing, and managing market data
  3. Order Functions: Functions for creating and managing orders
  4. Analysis Functions: Functions for calculating metrics and statistics
  5. Utility Functions: Helper functions for common operations

Function Naming Conventions

  • Functions ending with ! modify their arguments in-place
  • Functions starting with is return boolean values
  • Functions starting with get retrieve information
  • Functions starting with set modify configuration or state

Error Handling

Most API functions use Julia's standard error handling:

Performance Considerations

  • Use in-place functions (ending with !) when possible to avoid allocations
  • Batch operations when working with multiple assets
  • Consider using @async for independent operations
  • Cache frequently accessed data

See Also

Contributing to API Documentation

If you find missing or incorrect information in the API documentation, please:

  1. Check the source code for the most up-to-date function signatures
  2. Test any code examples before submitting changes
  3. Follow the established documentation format and style
  4. Include working examples for new functions

For more information on contributing, see the Contributing Guide.