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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.17-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.17-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.17-cp38-abi3-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.17-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.17.tar.gz.

File metadata

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

File hashes

Hashes for polars_qt-0.1.17.tar.gz
Algorithm Hash digest
SHA256 5449cf0bdfa5fe5503ce277c510c3d6786578f39ff7d2f4a8dcee2150109a836
MD5 b4686c6638abb70825a66b7e72fdde91
BLAKE2b-256 90378217b3ac1707ddb147ecaac484047289071ccb7cad4ba102e9b5678f974e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.17-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4b1a8fd66a1dcf27f38d248bdc44bba6a1fc4b23d1a97a682d23b8d34759c028
MD5 9606ef47ab90b633bf63b8762b0b6895
BLAKE2b-256 eb0e900f2f8d4aa6e2d803125534b9365068c7fbaf5eac5bb6a1167207ed7ca5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.17-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 53e4028751051406702f1e8433e74787006f6181d429b9905ae7726056302c26
MD5 4ab947411cace2ea1b455433bcf1e458
BLAKE2b-256 c6f764069e86f4c41c5f3642932498ada50bc383d26c2117a04c51174e695a6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.17-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 bbf82706d7570186e93ccf78668b1b903a82c8717cdcf7e3d6fd3a03204ed3aa
MD5 e36981f0919ec1ec362bd94701977277
BLAKE2b-256 6d6c17399f5c7ebe4384c717b0fb0cd1279d5a6762f59dee4e564a0b6639f482

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.17-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e8a14cdd31f2bf5586ffa6b6ce95e96ad7c1b45e8d92c7a31b23897125025fca
MD5 0a7f5015e3afb62c9ba66d0b409c5a76
BLAKE2b-256 4820c38da3b1202b9536d06927522379b910e8b313bb094a3ae3a0807a6d2a36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.17-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 738ee3b66b852f7d47c2f9d672e2f16e482d8366f199dcb4f5811ec73d4acb61
MD5 ba3af0285d171dd5ffe7971e2b378b20
BLAKE2b-256 335db74c6bbdcc7504b7373f1f9741e87797979c93a282ecdb802e8000be0313

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