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

Uploaded Source

Built Distributions

polars_qt-0.1.7-cp38-abi3-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.7-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.7-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl (4.9 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.12+ i686

polars_qt-0.1.7-cp38-abi3-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.7-cp38-abi3-macosx_10_12_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.7.tar.gz
Algorithm Hash digest
SHA256 7075058f0fe4f9703e917a904949d727fce8c747ff283a901e9b1a4b0466f6d8
MD5 998af9ec5650f3654922812fac7f1866
BLAKE2b-256 3343450220390ea6f8586f9c178bc66f7372999013a60708134cfe6acf5db821

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.7-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5df4d4fe08048fba3904a3ef8194ab2e896da407b35b8c50fc69878c2a170dbc
MD5 59573853ff17273484f24cac85e8107e
BLAKE2b-256 35537ff166ac482550bb52d41ff1b7b6481500216b6063670d98f6dae1c84d9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a7879b257a1aabcd4c8838769d42ea39cfef52f98d6e9be90cd6884edbc82a2
MD5 c2e09e21f9b8f268ce3d8dc9346259d5
BLAKE2b-256 80fab864a1b289d7ede0943b406cd7fadde8a3a8bee03b5a014536ae62d0f4f6

See more details on using hashes here.

File details

Details for the file polars_qt-0.1.7-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for polars_qt-0.1.7-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 7859b790cd828462d3eea591b2b63dbf7c41b8480e4d1763a8408f904c4d893c
MD5 049b7eed65927a98ecdbba1a268ca346
BLAKE2b-256 c6763f0358639adb40a036662ef98b9e08dc2bb184d9f203d1ba438eea827dae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.7-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 525a2c0cfe317ac0dbb1b8d627876be1d16e5cc2d0ae585ee550437b6e19da19
MD5 b8bdb39b740ca263d67f3e10f73bad11
BLAKE2b-256 812d296f717f3f4ff3bc7ac1cbde7387b5c37171d9ce5ea0e39d1062c59cdecd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.7-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6e01e94d65a078153a118f0e29070212f881e8a6806a7e05a6a28eda67940eb3
MD5 146463ce03cac031f91d6c91637a8632
BLAKE2b-256 d5dd82828e4933249ed26c3c8ca4e9383b3d1b460cabb6fbfd04c60e4288aa5b

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