A flexible clock implementation for real-time and backtesting scenarios
Project description
Chrono Pypeline
A flexible clock implementation for real-time and backtesting scenarios in Python. chronopype provides a robust framework for managing time-based operations with support for both real-time processing and historical data backtesting.
Features
- 🕒 Flexible Clock System: Support for both real-time and backtesting modes
- 🔄 Processor Framework: Extensible system for implementing time-based operations
- 🌐 Network-Aware: Built-in network processor with retry and backoff capabilities
- ⚡ Async Support: Full async/await support for efficient I/O operations
- 🛠️ Easy to Use: Simple API for managing time-based operations
- 📊 Performance Monitoring: Built-in performance tracking and statistics
- 🔒 Type Safe: Fully typed with MyPy strict mode
- 🧪 Well Tested: Comprehensive test suite with high coverage
Installation
# Using pip
pip install chronopype
# Using poetry
poetry add chronopype
Quick Start
Here's a simple example of using chronopype:
import asyncio
from chronopype import ClockConfig
from chronopype.clocks import RealtimeClock
from chronopype.processors import TickProcessor
class MyProcessor(TickProcessor):
async def async_tick(self, timestamp: float) -> None:
print(f"Processing at {timestamp}")
async def main():
# Configure the clock
config = ClockConfig(
start_time=time.time(),
tick_size=1.0 # 1 second ticks
)
# Create and configure the clock
async with RealtimeClock(config) as clock:
# Add your processor
clock.add_processor(MyProcessor())
# Run for 10 seconds
await clock.run_til(config.start_time + 10)
if __name__ == "__main__":
asyncio.run(main())
Core Components
-
Clocks: Base implementations for time management
RealtimeClock: For real-time processingBacktestClock: For historical data processing
-
Processors: Framework for implementing time-based operations
TickProcessor: Base class for all processorsNetworkProcessor: Network-aware processor with retry capabilities
Development
chronopype uses Poetry for dependency management and packaging:
# Install dependencies
poetry install
# Run tests
poetry run pytest
# Run type checks
poetry run mypy .
# Run linting
poetry run pre-commit run --all-files
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 chronopype-0.2.3.tar.gz.
File metadata
- Download URL: chronopype-0.2.3.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Darwin/24.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9b8b20ceb0b839c4f7d829295386081bddc6a431fe88ce12a46976fed6ebb07
|
|
| MD5 |
9632a006ebddc8b2d40d06fbaff400ff
|
|
| BLAKE2b-256 |
a0091e1d7438d80e05c3785a502927679bb5f965d135cb3d161e443a22493041
|
File details
Details for the file chronopype-0.2.3-py3-none-any.whl.
File metadata
- Download URL: chronopype-0.2.3-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Darwin/24.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fc8c92824067e5191836ecb1409674bc2d2eeec0d049c749279669f8ebfdb87
|
|
| MD5 |
7d075044738edbec0e8d98e892439fbb
|
|
| BLAKE2b-256 |
1084b912537308942c43f7a0e4eb0c100fa56d41f0ca5856d63ae3c9f88f7450
|