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 strategiesOrchestrator- Main orchestrator for coordinating data feeds, strategies, and brokersContext- Stores shared data and common functions for trading operationsBroker- Base broker class for handling trading operationsDataFeed- Base class for market data feeds
Orchestrators
BackTest- Backtesting orchestrator for testing strategies on historical dataRealTime- Real-time trading orchestrator for live market executionBackTestRapid- Fast backtesting orchestrator
Brokers
BacktestBroker- Broker for backtesting scenariosRealtimeBroker- Broker for live trading
Data Feeds
CryptoDataFeed- Cryptocurrency market data feedStockDataFeed- Stock market data feedCustomDataFeed- Custom data feed implementation
Exchange Clients
Binance:
BinanceClient- REST client for BinanceBinanceDataWebsocket- WebSocket client for market dataBinanceTradeWebsocket- WebSocket client for trading
Bybit:
BybitClient- REST client for BybitBybitDataWebsocket- WebSocket client for market dataBybitTradeWebsocket- WebSocket client for trading
Bitget:
BitgetClient- REST client for BitgetBitgetDataWebsocket- WebSocket client for market dataBitgetTradeWebsocket- WebSocket client for trading
OKX:
OKXClient- REST client for OKXOKXDataWebsocket- WebSocket client for market dataOKXTradeWebsocket- WebSocket client for trading
Utilities
Indicator- Technical indicator calculationsBarGenerator- Generate OHLCV bars from tick dataBarManager- Manage and aggregate bar dataPatterns- Pattern recognition indicatorsEventEngine- Event-driven architecture engineFundTracker- Track fund performance and NAVPortfolioManager- Manage portfolio allocationsSignalMQ- Message queue for trading signalsNotificationSender- Send notifications for trading events
Agent Classes (AI Trading Agents)
Agent- Main agent orchestratorBaseAgent- Base class for all trading agentsMarketDataAgent- Market data analysis agentSentimentAgent- Sentiment analysis agentValuationAgent- Asset valuation agentRiskManagementAgent- Risk management agentPortfolioManagementAgent- Portfolio management agentPricePatternAgent- Price pattern recognition agentQuantAgent- Quantitative analysis agentStatArbAgent- Statistical arbitrage agentLiquidityManagementAgent- Liquidity management agent
Alpha Research (Machine Learning)
AlphaDataset- Dataset for alpha researchAlphaModel- Base class for alpha modelsAlphaStrategy- Strategy class for alpha researchAlphaLab- Lab environment for alpha researchLgbModel- LightGBM model implementationMlpModel- Multi-layer perceptron modelLassoModel- Lasso regression modelDoubleEnsembleModel- Double ensemble model
Data Objects
OrderData- Order informationTradeData- Trade execution informationPositionData- Position informationAccountData- Account informationBarData- OHLCV bar dataTickData- Tick dataInstrumentData- Instrument information
Enums
Side- Buy/Sell sideOrderType- Order types (Limit, Market, etc.)Status- Order/trade statusExchange- Supported exchangesAssetType- Asset types (Spot, Future, Option, etc.)PositionSide- Position sides (Long, Short)TimeInForce- Order time in force
Database Classes
FilesystemDatabase- File-based databaseMysqlDatabase- 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.tomlfor 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8c348a0ef49c6084441c0ce57439afc4520cc8a76b66f3f5988c5622b5039ed
|
|
| MD5 |
f693379d16962a3e581defdd0ebc40d5
|
|
| BLAKE2b-256 |
5a519c710f65beb1c173ac6f459017c40862496548e1c8fbcec8c6d369505821
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
278a26ceb2f69f765ba722f0ecf3d16aacb39ddff10c375e1692a0c23f2eb58d
|
|
| MD5 |
cd08824a5b8e4181deab67bd2cec06a9
|
|
| BLAKE2b-256 |
7e8d550ff6d3eaddf9b0ca04e7c246089075725ac14960d65c52bb7c7964651a
|