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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.8-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.8-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.8-cp38-abi3-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.8-cp38-abi3-macosx_10_12_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.8.tar.gz
Algorithm Hash digest
SHA256 eff5ac9b6a48f8ee02428082f4435526131af04c431a5eb71df08861fb8fa41b
MD5 aa7b2f7553f6760d65ba5dedb16c8dd4
BLAKE2b-256 eebc4973f1e5557e28230eab9637758c3c632dc8c3510d8715540c6e927b7f81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.8-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5a38b19c5d6dbcb2e0a7075aa5f5496757893a96415db7f314cb1b2f47ab8251
MD5 ffa73487e4d3a4e7b82f48d958340950
BLAKE2b-256 6ed1cf7732b78cb1a6f8a301b3791e9ac3913a6f2df2903493e4f7533839c310

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e4464426ed4249fc788ee56e5740c997309e983ad76b875b892927b50bf30006
MD5 1c81bcbf7f9c6a5d95dca7c95b741b92
BLAKE2b-256 3fcf16df8152c992e2a3d6bae27a5f42806b0992240f92449f9d2518853b574b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.8-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 8da1fcddf8b57ca493e1eeb47a4adc6bc8c314a74d11cbde294ee4969ca77e30
MD5 b3a269aa1f84ff9f691cf821ecbc2526
BLAKE2b-256 a37538ae0e2a6c68c79efb35694f41eb7a5e917f2d7b5fa85199020a4644abaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.8-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c716b1523fa054a0d76d754a36dfd3720247113db1c93ad206be5804b7566f2b
MD5 5449660db8c188e46724b50966f0a31a
BLAKE2b-256 01d7aeac1224718d4d1d3097fa51460635cc0d41558bd3f6fb656bd0359a434d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.8-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0cf10216c18f8495592b4e8c2833e00a63d9e66bd48a3708eec9430958862a11
MD5 e81dbd4ac1f4d686c3ac94e870947d5e
BLAKE2b-256 9f4c6f13cf48ded364b10ddf7b85992bbfd497ae041e4f495adac849f6709510

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