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.16.0.tar.gz (739.7 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.16.0-cp313-cp313-win_amd64.whl (30.8 MB view details)

Uploaded CPython 3.13Windows x86-64

csp-0.16.0-cp313-cp313-manylinux_2_28_x86_64.whl (38.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

csp-0.16.0-cp313-cp313-macosx_11_0_arm64.whl (31.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

csp-0.16.0-cp312-cp312-win_amd64.whl (30.8 MB view details)

Uploaded CPython 3.12Windows x86-64

csp-0.16.0-cp312-cp312-manylinux_2_28_x86_64.whl (38.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

csp-0.16.0-cp312-cp312-macosx_11_0_arm64.whl (31.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

csp-0.16.0-cp311-cp311-win_amd64.whl (30.7 MB view details)

Uploaded CPython 3.11Windows x86-64

csp-0.16.0-cp311-cp311-manylinux_2_28_x86_64.whl (38.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

csp-0.16.0-cp311-cp311-macosx_11_0_arm64.whl (31.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

csp-0.16.0-cp310-cp310-win_amd64.whl (30.7 MB view details)

Uploaded CPython 3.10Windows x86-64

csp-0.16.0-cp310-cp310-manylinux_2_28_x86_64.whl (38.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

csp-0.16.0-cp310-cp310-macosx_11_0_arm64.whl (31.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for csp-0.16.0.tar.gz
Algorithm Hash digest
SHA256 bbcfd85c9a57d86741d4862db6a83b8c8dfd2487b0e8a28beac2211b427eeb39
MD5 2c822c3d69a5b9828db50b83bdd16373
BLAKE2b-256 11b0733e9b45ff1d5316b2677c7c9174a4507d38ce139943fb8ab9a1283a2364

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.16.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 30.8 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.16.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d1d87e3c77c2985b8492c582bd6fd8f935b65f9e93f68166b6f04179e60d7cab
MD5 831ec2a7179baa96872c032d3690d09c
BLAKE2b-256 ab2fd6512f8c87da2ad3bc952d0d2a324d749988fa078ac0f0baceff05a4d5d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.16.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7284e74b9224b428e95e94393cf902b802cadcdf73e8e52a2fd49d5ab86faf60
MD5 14a53ff2cf4bf55e9632593f3d0d1bc8
BLAKE2b-256 014ef4dbb6ed836d2b3c58b3ca1767122af1bef8ecc1dd59dcb4b802994ca79d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.16.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50b4907708a45a5a519b18c668a2b383d87827bce022f018b67b65c3035175e2
MD5 d3ffb36d074047552ee064cfbc76162e
BLAKE2b-256 40b317a1dabd6b100804471ffedf9c07ff6662a3f599a0ea1dd178f923110b72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.16.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 30.8 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.16.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6ee88931ee11aa8b541649e0af0db6adb00d1ad1035dffa479648de301739b2f
MD5 180c12e71acce6f20fe9e53ce9ab53ec
BLAKE2b-256 cc2513932690633e14143b0db7d5eeb9380812cdc8a7856fd743678361c088be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.16.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e6b73faf0593d0e497b23bf9451d2421a1477021c7b49a0589e70a40a3f24742
MD5 7dbf791af48564ecb91ebb29714ec3f1
BLAKE2b-256 9be07c535842f1b8322a73eb6f28af0bc9de274a6a9b322092b8c2609d955007

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.16.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8544d3d3fa1645813a2a2838f9a143545365b7eb6e2ff1d4aeb593478e998107
MD5 1a6f610db8553daba8235e025b59df32
BLAKE2b-256 d4713abc03eaad32cd067e55734b57006da29827c24e25dd9a570171211de642

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.16.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 30.7 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.16.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7812e0b12c14d7cbb043531ba7049805fc14b7a88306b2873e31226cf1b9dae3
MD5 e1ba48e45fe41b392a616759e858f6b4
BLAKE2b-256 cf3907539d3403999f265855cc371eb633d4e9bb782e6079f008f7212525fd25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.16.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 00e429932ada4aee381e79b294eae31a071e56e6c3ed22051ba0eda994ab6317
MD5 a681fdcbe58867418c49f3125c7ef672
BLAKE2b-256 7f9054f7f78e74e84b9a331c9c55c24087cc2a7a6e7157d88781e13fc9aad5d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.16.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e6b8402f418ee6472fd7198e53daf79da13ef28292b689601715d4b34523df44
MD5 ecc21efe1e17970844f0fd8386286e14
BLAKE2b-256 05993583e6e496734307085a7e244281adf0988d015c04c30c56224f6a63af41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.16.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 30.7 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.16.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8b2f0e741a4408081fc47471860a063e0aa35e4ce10240fb71448aa838cfc62d
MD5 f366d5f0fa2c2811930516aabbef3da2
BLAKE2b-256 edb7b8dc0c7055441865ea0cad3b299f42d4ab1143a1ea3c0873541f186d7cf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.16.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7afaa52a8041452b00ec86da9f0ed5bc618a66dae674358113d62640cd9c1951
MD5 281ea691ea139e276adb1f563bf0b22a
BLAKE2b-256 492a52d3893269d30de92de3d17e7e7fdc3a99d761c47c4751e3b25d452f5985

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.16.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa6cdf95881d4b78f8d2f24863722e474711b45deddafae6c9497e11cf645e3a
MD5 0fae8679875cb757882b834f9e1f2797
BLAKE2b-256 a8a6ebcd4a2910a7f25ece3f3800b643078dc1a1a27a98e65a7b66648e898835

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