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

Uploaded CPython 3.13Windows x86-64

csp-0.17.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (31.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

csp-0.17.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (31.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

csp-0.17.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (31.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

csp-0.17.1-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.1-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.1.tar.gz.

File metadata

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

File hashes

Hashes for csp-0.17.1.tar.gz
Algorithm Hash digest
SHA256 6d0d547c8b279c5587f585c36ed8260967e5efff98bff95626909738ef15c3f1
MD5 5033705c2d8cbf076247efc0766bfc0f
BLAKE2b-256 94616480a2f221893b9f6a01f93fdc4cfb0159e96d6939c3e8c98e0f559a2b35

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.17.1-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.1.0 CPython/3.12.8

File hashes

Hashes for csp-0.17.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5a40b647fd0f3107260dca2ee328be77e7bebb22798a87cef3d3ceb85379ee74
MD5 857a723b71dd25793cf40c0a058d873a
BLAKE2b-256 c6b7af3a0cd4c051a2f795ea4c9d91e3f877adc90979cb3df5fd15ad516556df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a51d0045cdeb41195cf2d25b456e5d43429f6ef20a5c072ce4ee65508b4e9abc
MD5 6e03794b9e7c8bd69e333cab7b4d02d4
BLAKE2b-256 a22a2f1032595dacf24504d5a5185889b76d9c226ed4ddfcee8e27ab1fe39f68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6238a4da5dd92b8272c03c94abae22b77121403f760b3b7de988fd957b38bf6e
MD5 7192cb225279f3162b774daa459e7e8f
BLAKE2b-256 61e41c05d6dd859346ff6e6476c11e6863aca34ac2a8a4a242803e9e267cb47d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.17.1-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.1.0 CPython/3.12.8

File hashes

Hashes for csp-0.17.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9dad49b6ee8657d8029c6a616b386f7c46d76442e623f42af13e3c4ea247dd60
MD5 a06961d5b773b0f48b4464a2e8a092e9
BLAKE2b-256 b1d998f4cb0b745ce9fb8009735bbeb0b4948c9fe5a01c2fe57668568cc70ff5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 830943b33f292570df8962e3d13f63a91a160e2cb392dc68478ea6bc128ccb37
MD5 2a94701147235931a33c9bf9260a12ff
BLAKE2b-256 61df00cef22f550fd41259cd55032364c17c16ac5e987ab040ae35df3ec9de81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 074bed64540cf8ce323808d56d96a178842379faa3e8639949a4286fccdbc4e7
MD5 2fcec957d7f1cd55a7dc2bd11a506b97
BLAKE2b-256 222be590d2f193e8fdd682542deab3cdd5fbc177b49e1ae261e0a3c7757821cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.17.1-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.1.0 CPython/3.12.8

File hashes

Hashes for csp-0.17.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cc76b336dde52e410eff34b55a0291e9f4e9c228a737b663a86bef8ff2e066c6
MD5 406849c22eac1b7d8e6da2fe2b653e56
BLAKE2b-256 b9e90f55199e2c6eba0d6502a99a15095e694a5a71e11816603c60c0fca0f851

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e5e2d393afb87a139d97c91653274fe08dfca15321f6055c29764eab7001020a
MD5 c346aa266f2c6d2b09b0e58c9ae48af2
BLAKE2b-256 97ae8f90e5bcb8919f28d2514117feb02fb4880c8d1b936c134cb71d1287fdd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02031148fe7fba502e9bcbb9be43e864ed4e14e6c02225a402945f22f7990284
MD5 112480e3359995e8204a3304117b5b76
BLAKE2b-256 bdee109d718b14bb79f8828fd7511d015e7246bfe91ab3d2842934678af9e029

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csp-0.17.1-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.1.0 CPython/3.12.8

File hashes

Hashes for csp-0.17.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6c7b030285b8165bb5715de51102405814ecfa7288e845838787b28a61d5d725
MD5 aff3d50d017a544a0fd33808039e7b24
BLAKE2b-256 e74b621ea0b1800d3d3a8f094a378d50ae9916db7569d8c81e4e42e792c031b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ba4c7b4df192c61aac094e2353859469b63001c0568e3ee90cc8b2207dc29c0f
MD5 09f265fc3da7689c16fe6872e9fd3694
BLAKE2b-256 743ba121a935536cf4a418c8c078c774e56b3c935b20a2665e01c9b697d5ffc9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for csp-0.17.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 08703371d8b7324ce3a13358013acb40f2bbd806ab5cf62028915307dc6c0674
MD5 49df23682789495c82add3b70ad90d5b
BLAKE2b-256 de92f46c77fa33c558cf8cff4e2bc234ab566fd5ee2d6b8be3fc514d7be05842

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