Skip to content

RayforceDB/rayforce-py

Repository files navigation

⚡ High-Performance Python Interface for RayforceDB

Documentation Tests Coverage Release Python Version

Features

  • Pythonic API - Chainable, fluent query syntax that feels pythonic
  • High Performance - Minimal overhead between Python and RayforceDB runtime thanks to C API usage
  • Active Development - Continuously expanding functionality

📦 Installation

Package is available on Pypi

pip install rayforce-py

🚀 Quick Start

>>> from datetime import time
>>> from rayforce import Table

>>> quotes = Table(
        columns=["symbol", "time", "bid", "ask"],
        values=[
            ["AAPL", "AAPL", "AAPL", "GOOG", "GOOG", "GOOG"],
            [
                time.fromisoformat("09:00:00.095"),
                time.fromisoformat("09:00:00.105"),
                time.fromisoformat("09:00:00.295"),
                time.fromisoformat("09:00:00.145"),
                time.fromisoformat("09:00:00.155"),
                time.fromisoformat("09:00:00.345"),
            ],
            [100.0, 101.0, 102.0, 200.0, 201.0, 202.0],
            [110.0, 111.0, 112.0, 210.0, 211.0, 212.0],
        ],
    )

>>> result = (
        quotes
        .select(
            max_bid=quotes.bid.max(),
            min_bid=quotes.bid.min(),
            avg_ask=quotes.ask.mean(),
            records_count=quotes.time.count(),
            first_bid=quotes.time.first(),
        )
        .where((quotes.bid >= 110) & (quotes.ask > 100))
        .by("symbol")
        .execute()
    )
>>> print(result)
┌────────┬─────────┬─────────┬─────────┬───────────────┬──────────────┐
│ symbolmax_bidmin_bidavg_askrecords_countfirst_bid    │
├────────┼─────────┼─────────┼─────────┼───────────────┼──────────────┤
│ GOOG202.00200.00211.00309:00:00.145 │
├────────┴─────────┴─────────┴─────────┴───────────────┴──────────────┤
│ 1 rows (1 shown) 6 columns (6 shown)                                │
└─────────────────────────────────────────────────────────────────────┘

Full documentation available at: https://raypy.rayforcedb.com/


Built with ❤️ for high-performance data processing