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

Uploaded Source

Built Distributions

polars_qt-0.1.21-cp38-abi3-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.21-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

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

polars_qt-0.1.21-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.5 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ i686

polars_qt-0.1.21-cp38-abi3-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.21-cp38-abi3-macosx_10_12_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.21.tar.gz
Algorithm Hash digest
SHA256 d456e5bdba2b1deac1c797182f1d512e64af2c5f651bf5ec82eedab3d7938c9d
MD5 56f536b7b214809ee8fcec4ade0e0819
BLAKE2b-256 8f034bb84c7ce2a32ce8dfb50d99d986b96d27e1ff0ddc16defb8113343551b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.21-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 79060e73f69462957a928e4c9c9c7228b7edcfb8c69267dd115557cde1124d69
MD5 73e5bfff5accc97169009e71c67da81d
BLAKE2b-256 5dfab46c16f6bec238bffaa89351cb6ccd23d6d5f18119c63dd190b8c72db96f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.21-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30a943beeb45b20d0df194d43f6ae3477feb46d36e01602f57a91b2b0460b7ef
MD5 fcef2c8e2585c24aa1f2dc385f694821
BLAKE2b-256 fdf4c5f8db904fe5b86cea6baeb756a829a47a5ff6793064da3268aa01719943

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.21-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 0b4d8980c98d4f0d0ce82f8839d629f39f13b767545e7fcf2be46f09565232ad
MD5 6b87debb8ecf12ce4c534b25802df4ae
BLAKE2b-256 35969e5cdadccb4201b58c01c7433d262f0138d9c07d3217b3899ddbd907686a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.21-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02d68356940febcfaab1972644d308de0035c53dfdd381212c89190904eb23fc
MD5 088580d6082a3a73576700cce4d68a1b
BLAKE2b-256 a4c4fbbca8a6319f7f302c3fe676a8fd0d1dbb4b81762c248bccd6013e1b6374

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.21-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 53f748c3c35472a37c6ec55c86f0564a857e9d0cda6767000ece6960b58154c7
MD5 b730478938f324821ab1086a4373ca6c
BLAKE2b-256 28bf75842a4aca88f88f2eab053fbed3b7a6e046763c91ba431a0e624568782c

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