Skip to main content

Introduction

This is the Python binding for msd. msd is a high-performance financial time series database.

For high level usage, it provides MsdClient class, which uses requests and a DataFrame (pandas or polars) as the data format. You should install requests, pandas or polars manually.

High level API return DataFrame (pandas or polars) as the data format.

Installation

pip install pymsd

High Level Usage

  1. install requests by pip install requests
  2. choose a DataFrame library, pandas or polars, and install it by pip install pandas or pip install polars
  3. create a MsdClient instance by pymsd.create_msd_pandas or pymsd.create_msd_polars with the url of msd server
  4. use the MsdClient.load method to query data from msd

Low Level Usage

The transport layer is based on HTTP, and the data format can be JSON or Binary. The Binary format is more efficient and recommended for non-browser clients, binary format is parsed by pymsd._msd native library.

Because of the HTTP request library is very common, this package does not provide a client, instead it provides parse_reader and parse_reader_async functions to parse the HTTP response. With these functions, you can use any HTTP request library to query data from msd. For example, you can use requests for synchronous requests, and aiohttp for asynchronous requests.

It also provides pymsd.query and pymsd.query_async functions to query data from msd, which just demonstrate how to use pymsd.parse_reader and pymsd.parse_reader_async. When your want use these functions, your should install requests or aiohttp manually.

Performance

The performance of parse_reader and parse_reader_async is just same as the Rust based client, with about 1~2% overhead. For a test node, it can query about 6M rows of 1800 different symbols in about 1 second. The following table is the result of pytest .

RESULT_OBJECTS = 1789
RESULT_ROWS = 6245835
SQL_TO_TEST = "select * from kline where obj='SH60*'"
Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations
test_query_many_ndarray 972.8022 (1.0) 978.1467 (1.0) 976.1578 (1.0) 2.1991 (1.0) 975.8558 (1.0) 3.0612 (1.0) 1;0 1.0244 (1.0) 5 1
test_query_many_dataframe 972.8057 (1.00) 987.1984 (1.01) 980.0452 (1.00) 6.8454 (3.11) 980.4594 (1.00) 13.2980 (4.34) 2;0 1.0204 (1.00) 5 1
test_query_many_polars 973.1088 (1.00) 995.1073 (1.02) 982.3909 (1.01) 9.5757 (4.35) 979.7399 (1.00) 16.7033 (5.46) 1;0 1.0179 (0.99) 5 1
test_query_concat_polars 991.4861 (1.02) 999.8344 (1.02) 994.1573 (1.02) 3.3793 (1.54) 993.7752 (1.02) 3.8383 (1.25) 1;0 1.0059 (0.98) 5 1
test_query_concat_pandas 1,161.1306 (1.19) 1,186.2676 (1.21) 1,172.4941 (1.20) 11.3836 (5.18) 1,167.3264 (1.20) 20.0729 (6.56) 1;0 0.8529 (0.83) 5 1

see the test_query.py for more details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pymsd-0.1.16-cp312-abi3-win_amd64.whl (909.4 kB view details)

Uploaded CPython 3.12+Windows x86-64

pymsd-0.1.16-cp312-abi3-manylinux_2_34_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.34+ x86-64

pymsd-0.1.16-cp312-abi3-macosx_11_0_arm64.whl (387.8 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file pymsd-0.1.16-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: pymsd-0.1.16-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 909.4 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pymsd-0.1.16-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ca02f4ef2686ed765f48d514282ac3fea2f601d01fba4a019814cadcd246c166
MD5 4eb9151a494ba779d3fa9e8d1dc98d95
BLAKE2b-256 a5953dfd1cb5373160666af063df6e1f74bf00ca32ec0fb03a5edacac3616b0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymsd-0.1.16-cp312-abi3-win_amd64.whl:

Publisher: build.yml on msd-rs/msd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymsd-0.1.16-cp312-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pymsd-0.1.16-cp312-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 42a17f1764c8aacc1f39ed254d70498c392dfa4b8b9b91a457a8d66df410b466
MD5 cf5aeedc5d3df14ead92f005e3e1bde4
BLAKE2b-256 0ae93cbb78067f48a34df38550e71f9303eefbb43426018d158144b2972baf39

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymsd-0.1.16-cp312-abi3-manylinux_2_34_x86_64.whl:

Publisher: build.yml on msd-rs/msd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymsd-0.1.16-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pymsd-0.1.16-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1fd9499bfb7303a3667d29ef4cd18b12a004b8b7db38fa5362946683b0554476
MD5 b0b08f9b70cf1c5ec33f1cc409b9a92e
BLAKE2b-256 14cb27c5835d93caa3b6621553510cc0ef0d227977b794a7bb139dd165fa8fff

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymsd-0.1.16-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: build.yml on msd-rs/msd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.16 This release

3 files

0.1.15

3 files

0.1.14

3 files

0.1.13

3 files

0.1.12

3 files

0.1.11

3 files

0.1.10

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page