Skip to main content

No project description provided

Project description

polars_qt

PyPI

Useful Quant expressions for polars implemented by polars plugin.

Currently :

  • Rolling_rank expression

  • If-Then expression.

  • Calculate return of future using strategy signal

rolling_rank

import polars as pl
import polars_qt as pq
df = pl.DataFrame({
    'a': [5.2, 4.1, 6.3, None, 10, 4, 5],
})
df.with_columns(
    pq.rolling_rank(pl.col('a'), 4, min_periods=1, pct=True).alias('a_rank'),
    pl.col('a').qt.rolling_rank(4, pct=False, rev=True).alias('a_rank2')
)

shape: (7, 3)
┌──────┬──────────┬─────────┐
 a     a_rank    a_rank2 
 ---   ---       ---     
 f64   f64       f64     
╞══════╪══════════╪═════════╡
 5.2   1.0       null    
 4.1   0.5       2.0     
 6.3   1.0       1.0     
 null  null      null    
 10.0  1.0       1.0     
 4.0   0.333333  3.0     
 5.0   0.666667  2.0     
└──────┴──────────┴─────────┘

If-then

df = pl.DataFrame({
    'g': ['a', 'a', 'b', 'a', 'b'],
    'v': [1, 3, 5, 2, 4],
})
df.select(pl.col('v').qt.if_then((pl.len()>2), pl.col('v')*2).over('g'))

shape: (5, 1)
┌─────┐
 v   
 --- 
 i64 
╞═════╡
 2   
 6   
 5   
 4   
 4   
└─────┘

适用于金融量化领域的polars表达式扩展,使用polars plugin实现。

目前支持:

  • 滚动排序
  • if_then表达式
  • 利用策略信号回测收益

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

polars_qt-0.1.18.tar.gz (25.7 kB view details)

Uploaded Source

Built Distributions

polars_qt-0.1.18-cp38-abi3-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

polars_qt-0.1.18-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.2 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ i686

polars_qt-0.1.18-cp38-abi3-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.18-cp38-abi3-macosx_10_12_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

Details for the file polars_qt-0.1.18.tar.gz.

File metadata

  • Download URL: polars_qt-0.1.18.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.6.0

File hashes

Hashes for polars_qt-0.1.18.tar.gz
Algorithm Hash digest
SHA256 0e942ec504602d68e2861d8b905965f793c47b4fb687497f8468aacc9d6dd83c
MD5 15b153af60c3d7daa602a17cd1fd25ac
BLAKE2b-256 11530e76f42a35c59027b88882d70244075a306e78f2572d307b6d76e34056e3

See more details on using hashes here.

File details

Details for the file polars_qt-0.1.18-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for polars_qt-0.1.18-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 19c82c9509596fd0300ab726bde499ff8ba7e841023046219240abdfb17418b6
MD5 b10a5e8f1c6f047b7a5d02f6cc219299
BLAKE2b-256 411ca1e515d1ff4558396d6021c26f10e2e5b80e14b0c89f0ce7e515ddcfc335

See more details on using hashes here.

File details

Details for the file polars_qt-0.1.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_qt-0.1.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49258cd021a15322ae827f1efa83a6e86cee92d3129f099d82951faca5e3e24b
MD5 7668ccb136b2c7f5134295f503570942
BLAKE2b-256 2beafa8d5e2668d0020098aa71a0d131f2b11f128f11ba3cf463c1aa81b83fad

See more details on using hashes here.

File details

Details for the file polars_qt-0.1.18-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for polars_qt-0.1.18-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 0e5f109eb669e9fc23d34407edb8c0b93abd5b71f4114127dae99570608b29f0
MD5 ed3ec47625dce2c1be9ae97e63628562
BLAKE2b-256 fc1fdc9f09bd010c8f4e2a9fd514722e442a5d3c067c59111bd5d5ae03eae36a

See more details on using hashes here.

File details

Details for the file polars_qt-0.1.18-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_qt-0.1.18-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ca7b80bd6f045558491372299ff7f77c07b72b29fc291635b26ac083456e454
MD5 29540adde414f4ba1b84510761280e66
BLAKE2b-256 39a7d07d83abbad901054554a3d86860832c82314436d3af297b43cf8c418470

See more details on using hashes here.

File details

Details for the file polars_qt-0.1.18-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for polars_qt-0.1.18-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d91aebc5e0bda88a08587323afe25d68cf00095236b51ed6afd1ebc662b859de
MD5 fc190d9d17b16fdbe0baa03cc0aa0420
BLAKE2b-256 0f457662cf47c49b80f3e2c315105e304d7adbd2d8fc0199187d7c160a8bc4ca

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