Skip to main content

A comprehensive algorithmic trading platform for cryptocurrency and stock markets with backtesting and real-time trading capabilities

Project description

PyAlgoture

A comprehensive algorithmic trading platform for cryptocurrency and stock markets with backtesting and real-time trading capabilities.

Developed by Algoture

Features

  • Backtesting: Test your trading strategies on historical data
  • Real-time Trading: Execute strategies in live markets
  • Multiple Exchanges: Support for Binance, Bybit, Bitget, OKX, and more
  • Data Feeds: Crypto and stock data feed support
  • Portfolio Management: Advanced portfolio management tools
  • Risk Management: Built-in risk management agents
  • AI Agents: LLM-powered trading agents for sentiment analysis, valuation, and more
  • Technical Indicators: Comprehensive technical analysis tools

Installation

pip install pyalgoture

Quick Start

Create a Strategy

from pyalgoture import Strategy, BackTest, BacktestBroker, CryptoDataFeed
from datetime import datetime

class MyStrategy(Strategy):
    def on_init(self):
        # Initialize indicators and parameters
        pass
    
    def on_bar(self, bar):
        # Your trading logic here
        pass

# Create a data feed
datafeed = CryptoDataFeed(
    code="BTCUSDT",
    exchange="binance",
    asset_type="SPOT",
    start_date=datetime(2024, 1, 1),
    end_date=datetime(2024, 12, 31),
    interval="1d"
)

# Create a broker
broker = BacktestBroker(
    balance=10000,
    trade_at="close",
    slippage=0.001
)

# Run backtest
backtest = BackTest(
    feeds=[datafeed],
    StrategyClass=MyStrategy,
    broker=broker
)

backtest.start()

Main Classes

Core Classes

  • Strategy - Base class for implementing trading strategies
  • Orchestrator - Main orchestrator for coordinating data feeds, strategies, and brokers
  • Context - Stores shared data and common functions for trading operations
  • Broker - Base broker class for handling trading operations
  • DataFeed - Base class for market data feeds

Orchestrators

  • BackTest - Backtesting orchestrator for testing strategies on historical data
  • RealTime - Real-time trading orchestrator for live market execution
  • BackTestRapid - Fast backtesting orchestrator

Brokers

  • BacktestBroker - Broker for backtesting scenarios
  • RealtimeBroker - Broker for live trading

Data Feeds

  • CryptoDataFeed - Cryptocurrency market data feed
  • StockDataFeed - Stock market data feed
  • CustomDataFeed - Custom data feed implementation

Exchange Clients

Binance:

  • BinanceClient - REST client for Binance
  • BinanceDataWebsocket - WebSocket client for market data
  • BinanceTradeWebsocket - WebSocket client for trading

Bybit:

  • BybitClient - REST client for Bybit
  • BybitDataWebsocket - WebSocket client for market data
  • BybitTradeWebsocket - WebSocket client for trading

Bitget:

  • BitgetClient - REST client for Bitget
  • BitgetDataWebsocket - WebSocket client for market data
  • BitgetTradeWebsocket - WebSocket client for trading

OKX:

  • OKXClient - REST client for OKX
  • OKXDataWebsocket - WebSocket client for market data
  • OKXTradeWebsocket - WebSocket client for trading

Utilities

  • Indicator - Technical indicator calculations
  • BarGenerator - Generate OHLCV bars from tick data
  • BarManager - Manage and aggregate bar data
  • Patterns - Pattern recognition indicators
  • EventEngine - Event-driven architecture engine
  • FundTracker - Track fund performance and NAV
  • PortfolioManager - Manage portfolio allocations
  • SignalMQ - Message queue for trading signals
  • NotificationSender - Send notifications for trading events

Agent Classes (AI Trading Agents)

  • Agent - Main agent orchestrator
  • BaseAgent - Base class for all trading agents
  • MarketDataAgent - Market data analysis agent
  • SentimentAgent - Sentiment analysis agent
  • ValuationAgent - Asset valuation agent
  • RiskManagementAgent - Risk management agent
  • PortfolioManagementAgent - Portfolio management agent
  • PricePatternAgent - Price pattern recognition agent
  • QuantAgent - Quantitative analysis agent
  • StatArbAgent - Statistical arbitrage agent
  • LiquidityManagementAgent - Liquidity management agent

Alpha Research (Machine Learning)

  • AlphaDataset - Dataset for alpha research
  • AlphaModel - Base class for alpha models
  • AlphaStrategy - Strategy class for alpha research
  • AlphaLab - Lab environment for alpha research
  • LgbModel - LightGBM model implementation
  • MlpModel - Multi-layer perceptron model
  • LassoModel - Lasso regression model
  • DoubleEnsembleModel - Double ensemble model

Data Objects

  • OrderData - Order information
  • TradeData - Trade execution information
  • PositionData - Position information
  • AccountData - Account information
  • BarData - OHLCV bar data
  • TickData - Tick data
  • InstrumentData - Instrument information

Enums

  • Side - Buy/Sell side
  • OrderType - Order types (Limit, Market, etc.)
  • Status - Order/trade status
  • Exchange - Supported exchanges
  • AssetType - Asset types (Spot, Future, Option, etc.)
  • PositionSide - Position sides (Long, Short)
  • TimeInForce - Order time in force

Database Classes

  • FilesystemDatabase - File-based database
  • MysqlDatabase - MySQL database (lazy import)
  • DuckdbDatabase - DuckDB database (lazy import)
  • SqliteDatabase - SQLite database (lazy import)

Statistics

  • Statistic - Statistical analysis and performance metrics

Documentation

For detailed documentation and API reference, please visit the project repository.

Requirements

  • Python >= 3.8
  • See pyproject.toml for full list of dependencies

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please open an issue on GitHub.


Algoture - Advanced Algorithmic Trading Solutions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyalgoture-0.5.1.tar.gz (563.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyalgoture-0.5.1-py3-none-any.whl (617.5 kB view details)

Uploaded Python 3

File details

Details for the file pyalgoture-0.5.1.tar.gz.

File metadata

  • Download URL: pyalgoture-0.5.1.tar.gz
  • Upload date:
  • Size: 563.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pyalgoture-0.5.1.tar.gz
Algorithm Hash digest
SHA256 c8c348a0ef49c6084441c0ce57439afc4520cc8a76b66f3f5988c5622b5039ed
MD5 f693379d16962a3e581defdd0ebc40d5
BLAKE2b-256 5a519c710f65beb1c173ac6f459017c40862496548e1c8fbcec8c6d369505821

See more details on using hashes here.

File details

Details for the file pyalgoture-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pyalgoture-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 617.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pyalgoture-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 278a26ceb2f69f765ba722f0ecf3d16aacb39ddff10c375e1692a0c23f2eb58d
MD5 cd08824a5b8e4181deab67bd2cec06a9
BLAKE2b-256 7e8d550ff6d3eaddf9b0ca04e7c246089075725ac14960d65c52bb7c7964651a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page