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

Uploaded Source

Built Distributions

polars_qt-0.1.25-cp38-abi3-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.25-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.25-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.7 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ i686

polars_qt-0.1.25-cp38-abi3-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.25-cp38-abi3-macosx_10_12_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.25.tar.gz
Algorithm Hash digest
SHA256 a209a6ff79f0c295872d8291d93dcddf5c904975a6cc6bcd30cc97bee0a36403
MD5 a0ac01f8aa543794802295b1808ce8d2
BLAKE2b-256 ddfc49bda49ddffc9933f6d4132888ca9946814a72cd41250032ad4a29250530

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.25-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 feb3abc9060ca1465261231b3efc1c15cc65ea2d040cbc11a1400f260800b848
MD5 4038c8c95310eb8912f8c5c715d3708a
BLAKE2b-256 f20ec1739fb9bb24825f67757323f58d6cf274a612b477ac78ec88216d411d9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.25-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ee254bfcfa70506e4d3b998a380daad7838b2c0457dde0b7ca80ebb36417620
MD5 cf0019c367e190b5ab166174a4582bab
BLAKE2b-256 34695cc061757f0b9566a09867ae3ec5b856b578a99026b941d2937911a6d681

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.25-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 8789a0a3b1acaa74c1ec13950847e090bd18888a617d81732d45ed935fefb0e7
MD5 d784578d460eb74a7669b2914ca9d43b
BLAKE2b-256 f772347998537153acc0395efe4bb6a0c7f90bf49b29c04d0a1e065a3c854d05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.25-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11e722611a9b4a45cdb45603654535e82a654e69b42b87c8dd664e5f401eba23
MD5 9ad73991c86c8426f8adfaf85401b2e9
BLAKE2b-256 1b7fb3e8afde2467b4381f541af382534ad8c4b03f84e22a1b127d7f721ba847

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.25-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 95b743041ff9e4b685d3d64dacd524a77a1a6b6e5863d758ea3a83758904a8b3
MD5 7e43dee5319970cfe1d0dd57178cc096
BLAKE2b-256 b10f49b5805185c244045e05c5d01b3afe7e19ca21f22cdd633788ece423e4c4

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