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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.22-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

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

polars_qt-0.1.22-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.22-cp38-abi3-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.22-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.22.tar.gz.

File metadata

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

File hashes

Hashes for polars_qt-0.1.22.tar.gz
Algorithm Hash digest
SHA256 247ff26a7dcf29c40c312c028a032653cca36b8831cd044108add87e35d045d7
MD5 1d869531934131bb1169d26172fa3cba
BLAKE2b-256 fadcee85d7e1767d7d8acd5635e7dbcb378afa65217c858b778aab05f1f4786b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.22-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b1d30fe8a86e595c813b26be4f01320a4a97c09c02ed59b6f13c14eac91df0c2
MD5 24a598cfe238093526f2c8a1388726ad
BLAKE2b-256 cc29229c7fb9125e4762c6f02cfcafdb7489cb3978a8abcd9b366bdb5eaed1bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.22-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8cdab270b1cb4c1fe566c62f87d523eb991f6374f7c396af408743e471d5f1fc
MD5 62d4c99fd5b73492a15af8f192bcf52a
BLAKE2b-256 7945848315f7723e54c04bcc09df882cb85570ed4d3db572c89b612d9d894094

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.22-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e5d256cdf2f17e5d210b38fa2e8f0f33cc87960dfb14abba7dfa139bf09fd286
MD5 674251b771d98f42ef871904292f16a1
BLAKE2b-256 5ab8411d27b2ecacabb964ad4e058249b67f529e25ebe9c10dca0ca07760e41a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.22-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d7930d93b3290f2cd1a6a55fc8c4371fdd822e1ea4620c9b389ae16018a0bde
MD5 a934dcc3f69c7dc282482776abd25410
BLAKE2b-256 dd18b690d41392979ec6e265492c14657e512a08a5de56c1e7dcbbff7b2f6236

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.22-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 185328f04969c6cc8d724b7b550f790b48526f9db208a38fdf8b30174f8d6b27
MD5 d21f4e1f9ebefcdc217813392d4808a5
BLAKE2b-256 3a6dbec1e2dc43a22a4309527c6bc8a9fb66b293b3498fac5384b9c04152b1f1

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