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 in from your live streaming data source, or in from 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 contribution guide and local development instructions.

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.14.0.tar.gz (686.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

csp-0.14.0-cp313-cp313-win_amd64.whl (30.1 MB view details)

Uploaded CPython 3.13Windows x86-64

csp-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl (38.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

csp-0.14.0-cp313-cp313-macosx_11_0_arm64.whl (31.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

csp-0.14.0-cp312-cp312-win_amd64.whl (30.1 MB view details)

Uploaded CPython 3.12Windows x86-64

csp-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl (38.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

csp-0.14.0-cp312-cp312-macosx_11_0_arm64.whl (31.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

csp-0.14.0-cp311-cp311-win_amd64.whl (30.1 MB view details)

Uploaded CPython 3.11Windows x86-64

csp-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl (38.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

csp-0.14.0-cp311-cp311-macosx_11_0_arm64.whl (31.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

csp-0.14.0-cp310-cp310-win_amd64.whl (30.1 MB view details)

Uploaded CPython 3.10Windows x86-64

csp-0.14.0-cp310-cp310-manylinux_2_28_x86_64.whl (38.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

csp-0.14.0-cp310-cp310-macosx_11_0_arm64.whl (31.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: csp-0.14.0.tar.gz
  • Upload date:
  • Size: 686.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for csp-0.14.0.tar.gz
Algorithm Hash digest
SHA256 569cf198a24c26539b3c8746a644a710868413d509c051b51492c62b5da79d13
MD5 a4c12ed5be191a1ead3d9d4923d3c16e
BLAKE2b-256 66596df68745bf9c67aaee76871ecf5b96667f7a5cb28fb19643d809cc58319f

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: csp-0.14.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 30.1 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for csp-0.14.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e656b296fa51edbc21d168e18153bc1e4f15c18eb05aa276041f30b70b8e68f5
MD5 9e7de849c2df206477790391453b51c5
BLAKE2b-256 2aaa26c42c66ddbe9a0de34d1f6ec0093ced682ff2514e431dce09fd7aacba1d

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4d815a29ef0dde898cfef1123617e8eff034ca8c9e4356859b580684398e0dff
MD5 c897f405c13cb0116da16fd4b411cff6
BLAKE2b-256 0e59ab0599e9e00e6afb26ab7f8dffc8b603ea2b2e5f8554fe11e29ccbe421c1

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for csp-0.14.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ca7733bb09eb07365f6f6969c6288702e2cac29617a4e748567b0a80caa4c14
MD5 836550975ff787aeba19adfde4137573
BLAKE2b-256 f6d6b8cc369048a3bb9ba4dd2347707b07b3d5ddaec88ced45d451575777ab5b

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: csp-0.14.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 30.1 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for csp-0.14.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 76a2c477872d278056d3d202113a550b5b22ce15afd5510e037ecda147dc3a82
MD5 78710b49a57f4ce059b5771a86e5f03a
BLAKE2b-256 ff08f4de0f26d0f7a3032cabccf7bc2682b8ba6139d9702e603de95e6b4fe582

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2c76953dcd78a4643ab3eab6758f7fe5de9b539e200f9931680f8061c46cf70a
MD5 108d5f77cd42a70e294a0e2d2a624b7b
BLAKE2b-256 64f6445b3ca853d137897ea3ca88427381b5a085ebab16545417438366252d65

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for csp-0.14.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b76fadbeeb2b85138cde32fcd0ad78372ddc622f7ccbf2059d919924be7510e
MD5 b0c8a173974d73b35381c4cefd86c3e0
BLAKE2b-256 5b207ba5d2a78a32c159ad8bb21da254cf1a6f805ca7eeb8a18a3ca8082e8e0e

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: csp-0.14.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 30.1 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for csp-0.14.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fb460132a8e6b8a67eead7b32c8c1032378dafb1c8e4ee3ff3a31ffae8170d5f
MD5 140d65e0046f700653e84ba64595c14b
BLAKE2b-256 7e519f220c1d7bedfe402b55a97450791154a8c923f69a4fefddae05f114ee39

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b4795eaf61ad2b84a70f7829d57e233ff2d9a5503546c218b655b40a7f2c9a8
MD5 54635f6a720b19b2915fcada0c0e71f8
BLAKE2b-256 4e279afa4259543e254ace0c2c8507af8edb4234584424826be187b28e713f85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.14.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b67eb2aa09239723940f5bc542c09d29cea4ee99580fe12736f53ed0e892db69
MD5 acc01c662b8ae6a064f0b78d052a8014
BLAKE2b-256 57d74314f83c035456eb976aba3fdf30615c526042f76adcca2f2acd1d62d58c

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: csp-0.14.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 30.1 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for csp-0.14.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6f77fa99c2b4db955bf9c0b2920968324145ea6f7c304154f09083ae325c1b21
MD5 76d4eee8c2cf36f2917a1582b47e89fe
BLAKE2b-256 df275e153a2106dac68bb4673d706218700a1985c7cbd6dbb7d7deeb6643569f

See more details on using hashes here.

File details

Details for the file csp-0.14.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for csp-0.14.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9f8c32e803e1c7c61271f49dc733b998ecadaa4744c93ca616d8b432c688a1cd
MD5 5b0bc6ee85004f59eeee51ee7a4868e7
BLAKE2b-256 5b97ed025355f808407d265d5b95d4c0dd6f988adaa43d738306c9b2e77a7716

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.14.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dfc51c26024dda371e20472d749d6e3bfbbb7cdccc3baaf19e7b13dcefadf1f1
MD5 e477ad944f54212459a23869b54eabed
BLAKE2b-256 0121a0ce7716b70bffa437cbe5d48d0778ad0e6278f725e319f3bc78182415c8

See more details on using hashes here.

Supported by

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