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

Uploaded Source

Built Distributions

polars_qt-0.1.12-cp38-abi3-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.12-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.12-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.3 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ i686

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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.12-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.12.tar.gz.

File metadata

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

File hashes

Hashes for polars_qt-0.1.12.tar.gz
Algorithm Hash digest
SHA256 d03bec4eaee18d2b09474a27119f8f34196bd06031cf656a31d6dc7a8d92c605
MD5 053e7436c54652d693c09289dd383dc4
BLAKE2b-256 ad3deb31faafc50af3c7c4d91eb80ae7248d265cfdbd28bd1f13cec47a0dc62f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.12-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d3a7debb89d2273c5de3e08a0ca3f92988e75376507e6ec4d4c9133d351af028
MD5 3c20daef819714513d7f8059f10401b2
BLAKE2b-256 6c0be62f518bee6008cd19184da737e7561ba027c2a632273df840ced83cdadd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b4b36965a8126075fd50ee461c29773244dc80e387348f30afb8abf5b57a9e6
MD5 f5009fdd3feb9c53a087180456f7a11a
BLAKE2b-256 9a0c99cb04460ebd336dc64caa6b75fa6b2a8340534233bcd46b3eace6f26113

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.12-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ebe3d6893bfbcecaf559d2931b7f2ebdcbafbfa2b84857c6e9bf35c1aef4f389
MD5 a4ad185bf7965a8248d3d0ad65514930
BLAKE2b-256 fc2fd4eecbe9131542a436be7fd2bd65be542f6d15040a8e1dbe45ded505c78d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.12-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe441bbd6f20bcdc3938d53126b389e544c6de5f024153cab8c8ee4b3a04121f
MD5 5701245015f3156fbafbcb63166614ca
BLAKE2b-256 bed5c0799c1646f42b3e2e807cd5e86bc81597c4845d99b4229ba23b916e2daf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.12-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f032f8a35d19651ddb8cb117595013f18396b61320a6c3c710816ccc44bab6de
MD5 117ea98d70c9d23afca3ba7a07da6988
BLAKE2b-256 1cbfbd87c70f20e70e7ae9ab002933961d3da4982c7e9d001a23955d6a244922

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