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.17.0.tar.gz (767.4 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.17.0-cp313-cp313-win_amd64.whl (30.2 MB view details)

Uploaded CPython 3.13Windows x86-64

csp-0.17.0-cp313-cp313-manylinux_2_28_x86_64.whl (38.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

csp-0.17.0-cp312-cp312-win_amd64.whl (30.2 MB view details)

Uploaded CPython 3.12Windows x86-64

csp-0.17.0-cp312-cp312-manylinux_2_28_x86_64.whl (38.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

csp-0.17.0-cp311-cp311-win_amd64.whl (30.2 MB view details)

Uploaded CPython 3.11Windows x86-64

csp-0.17.0-cp311-cp311-manylinux_2_28_x86_64.whl (38.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

csp-0.17.0-cp310-cp310-win_amd64.whl (30.2 MB view details)

Uploaded CPython 3.10Windows x86-64

csp-0.17.0-cp310-cp310-manylinux_2_28_x86_64.whl (38.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

csp-0.17.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.17.0.tar.gz.

File metadata

  • Download URL: csp-0.17.0.tar.gz
  • Upload date:
  • Size: 767.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for csp-0.17.0.tar.gz
Algorithm Hash digest
SHA256 becaf1b7f5cc9021d333bcda82ed36e970fb18fe3eeeeb21ceb7aa7928f50fb2
MD5 b97296c8ff9d570e47b5a15b1244c853
BLAKE2b-256 22d160280bfb37e4c8b2fa2cb6ff15a5e8986b2a6de2e6bf36826dcc649d5bb3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.17.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 30.2 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for csp-0.17.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8692515098a3fc5db407f97de5014dc5e02ec664542b4a12ad17337b85a58bf9
MD5 6eb9225f0a1782c897427f0ebc288186
BLAKE2b-256 05dfe76788ffe1bec84b6d9c0579b8b614b57d684025f70165de613b69d759a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c24db24f61c26604171fac303cb95ce7979aa4925580ceb32004110166161ba7
MD5 5ad5f7e963614d088734b4a372159459
BLAKE2b-256 9d8b7d1e49e5f37464d55810b4791156af067d563041456db16aa5983b48af42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7673fe2b01bb4abb77f8c7d4395874246c179bcdfc08514b4d50e538ff5945ec
MD5 e3a4290b868afcc4ecd4b6b5ca7842e0
BLAKE2b-256 ecede76fa4b39019cebd613441160a9aa1194952225705a14b3f826782021a73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.17.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 30.2 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for csp-0.17.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b461981b95d46138e2c949438d2afcb2f06022d8248df7a83bc9eae5b45464ca
MD5 52c5f55bcdc2060dc48335fdf88dd756
BLAKE2b-256 8f1423299b90f2649d30b9c237675c85fe7521f4ec74cb93bb4fb8419b59d50b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7a5fa7f349f8069cc35b88ba1592ae93b674e166648d7487ee30b3109d69fd1b
MD5 db8f16b207bb25c82af5d878a3a39259
BLAKE2b-256 1e24cb10ed56f3ab311ca1e2a8e70353d2d679cc025cf504f68a41c4bd6cadc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 65378230d531ecd9dacf5bba04fdf8c6a0286fc90143ce17c47bd066c5b907d5
MD5 2bff5a93669e8ac1e10b492a5278e6cc
BLAKE2b-256 a5b0f439b1e72498982c740f3bd377a6682d2e66f4e1b093ee471894994f9fcf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.17.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 30.2 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for csp-0.17.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a60e03c15566d07a4edb800c93094d17b3e379c15b8280552d683823e698cde1
MD5 c142433cd7b056c034a0c9c0bb85b76d
BLAKE2b-256 0a53e16fa7bed6ddc5b64052e0c2083bce0389ff1f118c5a578646c4fce71c75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 28bf8010f95b2d6c848baf10925c789d2fd8f159885840b257b83f7d01c005d9
MD5 a91e6587ecca6ec6446a3f5c94938324
BLAKE2b-256 97920c127e6cabefb9b93fd6770ee8167814c614abe6df0c535071fd4c380fa2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b30a623490d60f4276dcf4d315adb245ed36d4b7e6a9187e7b3e530f6b2cf1fa
MD5 5da68e52d23150d1321aa7f85b11d10f
BLAKE2b-256 bc124c08b57d48933fc61787b6d6979d923138fa68a674a16de8f3c952e3b5a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.17.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 30.2 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for csp-0.17.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9afff6c2bb2c68953c52e30351ffada32892df0fa66aba8282741bf9ddcd501a
MD5 973b93317348e559d6eeb210ec6e0827
BLAKE2b-256 53d918223e8cc2027c09438da09276faff36cec5aad87ad0286a2bb1c0634abb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b88880aa4a86440251dc2f857ea87f9c544beccf041c710e854b898548f9db24
MD5 05ddf746656336c9e0179f86847f4dc4
BLAKE2b-256 4b9bce684ea7db75a029aa1e401f0b0c191ffb3bc73d5d16cbdf51ae5e2a6c32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0890038ef831bd530a8a332c4d800f7225e8c90e3a884a6e49eae6cdbbcc0d5f
MD5 6649fd5ef64511c978f8819d383fc9b0
BLAKE2b-256 b79e88b286349f162ca0b5c74b138b24fb0973795f330f8e183e43da0b8485d2

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