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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.15-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

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

polars_qt-0.1.15-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.4 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ i686

polars_qt-0.1.15-cp38-abi3-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.15-cp38-abi3-macosx_10_12_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.15.tar.gz
Algorithm Hash digest
SHA256 fafb732202195c9df1bcd4a6366c714f607d075c955e7baeb3ef098d695b583d
MD5 5f9a4f02027745eaeab61e14022c5891
BLAKE2b-256 bb381d03fa461f374a4ec33cff7a44e2af1544fc6fce71eef1beb7db94eed5f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.15-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 db6836947ba0690d74c25fe1b4f2d89f7f907d224e8d55a93d0b609ec0b45d01
MD5 36371d51517ed2d9d556179c8e591436
BLAKE2b-256 f79d2c8f36e0438e87485178f85aa6cf3620f3a3452ef9711cea4fc369d7d6c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.15-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b13d7c3bf4b708e34f1d4f3e8b240dfb71a75112a0c790c9641734c6b61580b7
MD5 1f1f625e33bb5b6c35a0d3436cdd2e96
BLAKE2b-256 d5824abcf05fd3cbe0621645655e84f5233d52293f180d9d1f03b7b1501e923f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.15-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b120bc503f8c58d4415e2a99f0f173ac5d2e05d922a407a1b6d2b90f47246a6d
MD5 bd249d2ed49e77997239ecf7a738d480
BLAKE2b-256 44076c767bed1ff618e59ee23e46424261c0665448aafade0d9a5ade562e5d5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.15-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f68f937edd77428d9ebee239bfe7c164c5dabdb50de735e7498a747dbd1aec9c
MD5 00a784fc67570e7da9e2f9c69fc16c46
BLAKE2b-256 a808abed52d63d30ecc7ac7937b5090280b706778aca877f93291ebdd94c3468

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.15-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8a1588edc5583aed0e3d1a7b34ddd75a3d357dfc1b40d2beac7ec717de8fb103
MD5 cfdb60b1aceba40f9468a09b45529cd4
BLAKE2b-256 4472ca21bb677d916d7b307495c65d869c7684b6419ade79964b7d606612d6a5

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