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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.14-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.14-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.14-cp38-abi3-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.14-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.14.tar.gz.

File metadata

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

File hashes

Hashes for polars_qt-0.1.14.tar.gz
Algorithm Hash digest
SHA256 3fe52ae278f7d3c66134f432894d7332b5733a2c33f74d4673944d7b147517c6
MD5 83e383d8a3f0380b3d3bbf859f460082
BLAKE2b-256 92a45ba55a45637d7e0de83530db5ff403abe3284f173a4b2b0a8098a386d4f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.14-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 342d36259394ea7628833196229b21fd0de81ea0a9d58f816a771f69f7a6406d
MD5 17c317bcb1aba54dbb1829ef5698440e
BLAKE2b-256 a794161db4bd091712f40edcee95bc1fa05ab798db21031e10772c70c556cc8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.14-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1cc36ea929042b870cf1fe0f45125dab54e57f4c4096d7a6dd6b986482529cc0
MD5 ea0776347c782515bfdf864e853ba6fd
BLAKE2b-256 87a23e89096a6bfd42c7e2ba51880d82ae293a4250cfc58e71cacece425391a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.14-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 a14e276760f49d85c8205e7ccf624fc86faaa514391b6480c672ef45ca02b7e1
MD5 860fb0aeaaf1707e89a4d67094e90bb2
BLAKE2b-256 49fef18e01d6c28ba5bcacb565cc64d537bada9c78c88850e2c38dbcd8f6a56f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.14-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68598105919c8b48a9da2d299e5ee44f75696f3ecc1c8fe887677f2ea6858035
MD5 fcdc5dac3522a6212c302edba72c7fba
BLAKE2b-256 ba5192c8cf9db3bf5659e3ec4015bc95e6e235e0bd1c7abb52b6802b6a788d1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.14-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4ce8cdc7168b82d0ca6fb24a4db117ab85e2aabc9f76cc0bc926f72a8b0b8cca
MD5 8341032675b38b6de80626496c9e7e69
BLAKE2b-256 ab33b77cc4b6841b9fdce1e563328f71e0021493423b65a955f5115c0adf2324

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