sterunets 0.5.0

Capabilities for processing data with Arrow and Polars
Documentation

sterunets

Python Client Example

requirements.txt

numpy==2.3.1
pandas==2.3.0
pyarrow==20.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
six==1.17.0
tzdata==2025.2

client.py

import pyarrow.flight


client = pyarrow.flight.FlightClient("grpc+tcp://[::1]:50051")

ticket = pyarrow.flight.Ticket(
    b"trading_system:def456:instrument:00237200-fee8-45ce-81c3-cc7d9e4b5262")
headers = [
    (b"n-rows", b"11"),
    (b"exclude", b"instrument_id:volume"),
]
call_options = pyarrow.flight.FlightCallOptions(headers=headers)
reader = client.do_get(ticket, options=call_options)

schema = reader.schema
print(f"schema: {schema}\n")

table = reader.read_all()
print(f"table: {table}\n")

df = table.to_pandas()
print(f"df: {df.tail()}")
print(df.shape)

ticket = pyarrow.flight.Ticket(
    b"trading_system:def456:instrument:00237200-fee8-45ce-81c3-cc7d9e4b5262")
headers = [
    (b"n-rows", b"11"),
    (b"exclude", b"instrument_id:volume"),
]
call_options = pyarrow.flight.FlightCallOptions(headers=headers)
reader = client.do_get(ticket, options=call_options)

schema = reader.schema
print(f"schema: {schema}\n")

table = reader.read_all()
print(f"table: {table}\n")

df = table.to_pandas()
print(f"df: {df.tail()}")
print(df.shape)

ticket = pyarrow.flight.Ticket(
    b"trading_system:def456:instrument:958070c7-8e18-4e13-9d40-13f7ba8dcaa0")
headers = [
    (b"n-rows", b"25"),
]
call_options = pyarrow.flight.FlightCallOptions(headers=headers)
reader = client.do_get(ticket, options=call_options)

schema = reader.schema
print(f"schema: {schema}\n")

table = reader.read_all()
print(f"table: {table}\n")

df = table.to_pandas()
print(f"df: {df.tail(20)}")
print(df.shape)