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

Uploaded Source

Built Distributions

polars_qt-0.1.27-cp38-abi3-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.8+Windows x86-64

polars_qt-0.1.27-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.3 MB view details)

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

polars_qt-0.1.27-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (5.6 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ i686

polars_qt-0.1.27-cp38-abi3-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

polars_qt-0.1.27-cp38-abi3-macosx_10_12_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.27.tar.gz
Algorithm Hash digest
SHA256 65888bda736497ca3193a02a28ebab48c8ed175b135439eb80e07f31bdba3aac
MD5 ed9c913a8297d7b7b399f3fc18809a61
BLAKE2b-256 887ef4a2408607591dac3bf5b5fdd472ddb38fd31819b009252039be7b12daac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.27-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d6554a982ed71fef3dbe1c61b22e503483dfa36c6c50f87b83f77d678ff041ea
MD5 77ab2924c28b5e230d3ed402ead061cb
BLAKE2b-256 03691ec4dcc73dd6b0810c811186898daecd4cfd2cb10722204d72aecdc61648

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.27-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 35fa54bee2571aaa60606eb505c5692eee481ed849706710a47da1a7ac47e245
MD5 5822cd3debacee62b275fd06a49cfc4e
BLAKE2b-256 5e329438b1dc72d570c19377c8577efd13bf5cf73c2e31e0d647e3a179dd4858

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.27-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6e2615e1a0e484066c90f776461b45fbd7a63bc7f95f636414f3b48ec16aae3e
MD5 fdf2dc85841b75f55181144864444164
BLAKE2b-256 05de3ba0da25f76f38679a969f7a516c9644ed4d24bf82293b35493644cb7178

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.27-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e37ab291272a0312489b5898ea50c13071a6ec734908c7ace1ef07fb6ea2e3b
MD5 cffed0284f8f9775d6fe78214b57f400
BLAKE2b-256 c04bf9fcb997ac8df1792cee7575782519a4c3e2014970229c30e3584b0d8307

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.27-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 05f9f2203a447116cf7704af2dc58c30bd27bab0bbf26ece45935150c1eb3713
MD5 6625f589ca4d1a8de877d99bc039f5c5
BLAKE2b-256 b740326d806394eb7817793b20015c62a3418eb40627acc698c49ff717ddb2ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page