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.24.tar.gz (29.5 kB view details)

Uploaded Source

Built Distributions

polars_qt-0.1.24-cp38-abi3-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.24-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

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

polars_qt-0.1.24-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.7 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ i686

polars_qt-0.1.24-cp38-abi3-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.24-cp38-abi3-macosx_10_12_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.24.tar.gz
Algorithm Hash digest
SHA256 3be1d50cc66e0f3c5fdc892028e3f8d4477d849dc88f1bbdfa4898a9cd938738
MD5 e1fee9019b787e705597f929d468ec09
BLAKE2b-256 efcea94f87583ac159852f66982068bc465852c7404beef989fc3403b5de268e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.24-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6cbe55797bad70b76a1bef67f3f2698bb12c22d8e01385b84fa0d2a90c2a4966
MD5 b329ddeef9bab2f96e2ee256ce641341
BLAKE2b-256 84f4b296344daa7c37fb60c9943fe4753a65d77195557cdd5f08c13f3afeaf42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.24-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d07ba096bcdc37ef5b5ff9ccccade9f843062feeb9ce2848b7daad8e4bef7a94
MD5 ccb5157343ee3e65158c908e86878a9b
BLAKE2b-256 04b67e55aedd307fc0ac5fd2870eb327e4152fea389e158cb202bcc3d7bb8054

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.24-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 8ed587e8efb0468e68a3ac496d0d3d5fb5f7ebbc2fa83f90e19597c919155121
MD5 8b727ca65133c5813a8e99e0e5e4ce9c
BLAKE2b-256 c83fe68592cc92eef6cdbca8b0ed43c428555ede309d7e401943075411026d41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.24-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3cbf8a396cf06ff464ab57b6ef2903d20df54e762409e0397961d1b52adc261a
MD5 46b6c5c7caf5b53ae4bacd1c65a352b6
BLAKE2b-256 dd4d85b448b29143189f40755922d6f6b514d67bdefd812946511cda4efc34b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.24-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e9842f52665adf1d6c8d1c571d46bd5b03319b1b482ddd1040c57afdb3fddf58
MD5 b7e8ace1223385be71aea0eaca162658
BLAKE2b-256 9dad78922f542382b366bb7c2e024cf9ae0b8a8ea4d412c27cd4cf4d740d534e

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