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 customizeable 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.1.tar.gz (812.0 kB view details)

Uploaded Source

Built Distributions

csp-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

csp-0.0.1-cp311-cp311-macosx_11_0_arm64.whl (20.0 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

csp-0.0.1-cp311-cp311-macosx_10_13_x86_64.whl (22.0 MB view details)

Uploaded CPython 3.11 macOS 10.13+ x86-64

csp-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

csp-0.0.1-cp310-cp310-macosx_11_0_arm64.whl (20.0 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

csp-0.0.1-cp310-cp310-macosx_10_13_x86_64.whl (22.0 MB view details)

Uploaded CPython 3.10 macOS 10.13+ x86-64

csp-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

csp-0.0.1-cp39-cp39-macosx_10_13_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.9 macOS 10.13+ x86-64

csp-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

csp-0.0.1-cp38-cp38-macosx_10_13_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.8 macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: csp-0.0.1.tar.gz
  • Upload date:
  • Size: 812.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.1.tar.gz
Algorithm Hash digest
SHA256 d43d91d2eb2863c7460cd0982d5c5ebc96d846263ea44440d485dd734b92971a
MD5 bec8073ddde2ec7d536eff2c47f36a7f
BLAKE2b-256 ea3fd7957d6299d6eca85bff193b487b62b39cb3a5e8de550bf6fa9cb86b9a65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a14b61ee7a51d3bce7e079c5e204de0c6baeecdb3ca31a6744996bdb4de91266
MD5 833da8e5e8b1cd35cb60c4ad186ffa32
BLAKE2b-256 fdb9bb2c64485a1f7140ea2f70e646b0b23e7ce5604ad37772ccaafd15dce146

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09ae28524f790c5270ea64167aa6c406e5e6f9159dfb07483f4cd91488709c7a
MD5 8838b734c5680ee5f5eac8f421420667
BLAKE2b-256 6b7934580ae60a03d75f8359d5fa9589f54f67ba7c4f09c29f2e30ad1c6d92b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e93a2bd481d2df97625aaeb9b0c0f59e04876da6c72c0f2f43bbda80dbbc97ef
MD5 9a3d9b51361b0f517b88dd9a80deb3f1
BLAKE2b-256 17e5d05a04074d7f73cb0101de9012d4f86d7837a846c9202c797b1f4848758e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 21c5148a6f04b7f059fe1941727d1603307eb35ff0d274e460febb4b56666de6
MD5 688c92b1b14fa7ddea5ea31f6bfe528e
BLAKE2b-256 44f6cde09390c91d0df21e0e1934fd1648cb8d543c8a17c0e5e88f746681e587

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee2b15b71dd09cfda59cc7f461574653aeec729cc93ffbb5e50d24219bd2bffa
MD5 2280a95a6481b0b1aac7a854780bf902
BLAKE2b-256 e92a3f92eaee22647473bd92c59f77c16b0dc03653dd25bba1eb4badea569016

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c579eec3b04106eed0bca4c98aff75d5405b83ecf443bbfa3242b5886830b98e
MD5 b410ad9af06ca9c4962199d00cc71221
BLAKE2b-256 620e1f607f84ca8bb438cc5bc51457a62817e085e8f132ad971a20eda48ae0bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c2b1281019b2257c804fa5628467a5720a08d49a4780295dab8975e6d4ded48a
MD5 d74447112ca1152f87238a2e507f1f45
BLAKE2b-256 8a5cc17141df6205f77eaa02cf687e575758bdb742f20e46fe0720d7012e2fcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9417719a79686f634ac247c1c0fe5f0553204136d2a042e012bffd1e6d2f207a
MD5 7b3ec2d33f5af2a1b70f2a2416d26d5f
BLAKE2b-256 232d55848995ed0b7e29277b1f3b0d36d3ab3893b74dc434090ef9a15b2e79ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8eed76aab2751ca3c4b00ee301289474ac5acdd69f40b2ff50240e545e39cf68
MD5 d254bfe39498ad5df8c9bff99eaecf70
BLAKE2b-256 b063d7b149e364d0732e18a0e75f217b2b5ed85956be53fd98b593745ee2e3d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.0.1-cp38-cp38-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6d32e15351f29b32a553554f493fdf9bb1c953471afd1203cdf796c6e8a56730
MD5 f122a3112bb2cffb11eac469c5be1dea
BLAKE2b-256 02dd43b0c1ee94af7c0a20623d3e2d9b8c071a08d022ca81f7aa736ab79bc34e

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