Skip to main content

csp is a high performance reactive stream processing library, written in C++ and Python

Project description


csp csp

PyPI License Build Status Python Versions


csp is a high performance reactive stream processing library. The main engine is a C++ complex event graph processor, with bindings exposed into Python. Its key features include switchable simulation/realtime timesteps for both offline and online processing, custom input and output adapters for integration with static and streaming data sources and sinks, and extensible acceleration via customizable C++ nodes for calculations.

The high level goal of csp is to make writing realtime code simple and performant. Write event driven code once, test it in simulation, then deploy as realtime without any code changes.

Here is a very simple example of a small csp program to calculate a bid-ask spread. In this example, we use a constant bid and ask, but in the real world you might pipe these directly into your live streaming data source, or into your historical data source, without modifications to your core logic.

import csp
from csp import ts
from datetime import datetime


@csp.node
def spread(bid: ts[float], ask: ts[float]) -> ts[float]:
    if csp.valid(bid, ask):
        return ask - bid


@csp.graph
def my_graph():
    bid = csp.const(1.0)
    ask = csp.const(2.0)
    s = spread(bid, ask)

    csp.print('spread', s)
    csp.print('bid', bid)
    csp.print('ask', ask)


if __name__ == '__main__':
    csp.run(my_graph, starttime=datetime.utcnow())

Running this, our output should look like (with some slight variations for current time):

2024-02-07 04:37:13.446548 bid:1.0
2024-02-07 04:37:13.446548 ask:2.0
2024-02-07 04:37:13.446548 spread:1.0

Getting Started

See our wiki!

Development

Check out the Developer Documentation

Authors

csp was developed at Point72 by the High Frequency Algo team, with contributions from users across the firm.

robambalu jacarr4 AdamGlustein stephenmarkacs

License

This software is licensed under the Apache 2.0 license. See the LICENSE file for details.

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

csp-0.0.2.tar.gz (933.0 kB view details)

Uploaded Source

Built Distributions

csp-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.5 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

csp-0.0.2-cp311-cp311-macosx_11_0_arm64.whl (19.9 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

csp-0.0.2-cp311-cp311-macosx_10_13_x86_64.whl (21.3 MB view details)

Uploaded CPython 3.11 macOS 10.13+ x86-64

csp-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.5 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

csp-0.0.2-cp310-cp310-macosx_11_0_arm64.whl (19.9 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

csp-0.0.2-cp310-cp310-macosx_10_13_x86_64.whl (21.4 MB view details)

Uploaded CPython 3.10 macOS 10.13+ x86-64

csp-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.5 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

csp-0.0.2-cp39-cp39-macosx_10_13_x86_64.whl (21.4 MB view details)

Uploaded CPython 3.9 macOS 10.13+ x86-64

csp-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.5 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

csp-0.0.2-cp38-cp38-macosx_10_13_x86_64.whl (21.4 MB view details)

Uploaded CPython 3.8 macOS 10.13+ x86-64

File details

Details for the file csp-0.0.2.tar.gz.

File metadata

  • Download URL: csp-0.0.2.tar.gz
  • Upload date:
  • Size: 933.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for csp-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3dec890ec0f626115f6ee1513d6db467f0d6bbabe3309d591bdfdffee23dfaa2
MD5 bddb0fa9f3a4779388d05f405c6094b9
BLAKE2b-256 75de4c1319e99861669ab93c7e173b08452e7270dc07bf00e9fd316601efa6c5

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0cd8130cd9474d6ee4831c64e8113c341adcc4aa64e68c9b05d3954cb35ef5ac
MD5 8b78fb199614cab9c91e0b6b336534ca
BLAKE2b-256 e19236dda84e1fdefcb36c72f405930d4b57ae49a1f93be792144201a5f03465

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bdd632dac1e98d593f80f0b9f92e17685e0bae917ef030169920ddee89db3d7b
MD5 e42f868e81a874baa72e921b86a8c665
BLAKE2b-256 56ad328b28dab2341d4e03c1e48987ca487c3064f803f423724dd71d65e85299

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp311-cp311-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 835fa6b9f28086957194407e3a29c8577edc63f3a10a90536eae876820a78d0b
MD5 5fd74840ae48942df6f7044436e7beb4
BLAKE2b-256 9d3ce4ff9bb8bda3acb6660bf586d156dab578c047e5de79d1a106c8a510a766

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8b1b8264530b7d208452873992a98540d696c16b7d251fbc7076ecc02f758c91
MD5 120933138c866591284a0def24048302
BLAKE2b-256 258277e4633821963bbd07885c652fedc096f03f08d66f6abfd69fd185556742

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 535f3fc42586522d23604f480d9c47e958b45dc6088d4937d6ba114e630b40ab
MD5 6ff62aefd9e1a8ec50d9e106dfaea038
BLAKE2b-256 94108fa989d223977ceaf27b9a3db188584d946a7fd3fb0c8c78f19561e4e070

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c426aac81b5b23a71c085b30bfca8c4ccda05032b256e56ceba62925bc0ec4a3
MD5 9f7342647b24f314fc5983762cd4f62c
BLAKE2b-256 902830fc02e33451ec224dbe1f78210f790265e8365687f0ad6f8ae1ece83459

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 903a06d55f9fcfb196f3428a138b997d2bd4cc7680e3dae1ad147ec82aa9d8cc
MD5 7802a4cce495becdd81b47c0d99c3372
BLAKE2b-256 904d32947ebf630ff69d198c2de5ffb4efd4f64c3fee8fe4d2789787d43171d0

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp39-cp39-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3d2c6b3ed286593c09232b9bbbfd2f422c10c8a2d01c5b5732d99fc3738f3089
MD5 21153b340898630b1da524dbf176d69e
BLAKE2b-256 f5d4938613130b6cd759766d4cebd05e57c04fac1c06af6f655b82fb007ffd3d

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a29767bcf98510a3ceddaaf19a1f1c4f4c92acb21ccc41ab942e875e83a51d1
MD5 3976b8011abba3db75bff50428bde6d1
BLAKE2b-256 24312e473aa0a3958f818189d0a4ff1c305404ff79eb8cd85ddd59f91f5d378e

See more details on using hashes here.

File details

Details for the file csp-0.0.2-cp38-cp38-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.0.2-cp38-cp38-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 00b90fed44bbec1c8357a656d7c9e9a264aee0c34152ba8d4dbc30cc762c0b85
MD5 246f27ff91822c5e121456ed657d7d62
BLAKE2b-256 2235d3ee48889bd039ee28c68c63d68e8fef8cf82add31c07d4bb40f9cbe6acd

See more details on using hashes here.

Supported by

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