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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.19-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.2 MB view details)

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

polars_qt-0.1.19-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.19-cp38-abi3-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.19-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.19.tar.gz.

File metadata

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

File hashes

Hashes for polars_qt-0.1.19.tar.gz
Algorithm Hash digest
SHA256 1b86d70fa3350ec1adcc8ed751f1ddb08dd425b1d7509f3a71d3b185eca718c1
MD5 4c70977bf081ad863abc98c1af6e0682
BLAKE2b-256 1c1640d79c9d997d880a71752eb6c65101b4e4f4353b14b1ee7bf4122eb3412b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.19-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 384a14812f2a0f5ca6766325fab4a68405852a71c441a7f365b757167b75892e
MD5 2b922b8128145a1063a78c827251ad6c
BLAKE2b-256 e878d43ac07c0270a4891c1fdceaf60c38f2a432cc234985d5240abe2e252bfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.19-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d68077d8eeeddf9ab984a32a2d325770493a757162f98debcd48c38763f8ee0a
MD5 d0e403edcd968ab321034be38ebff649
BLAKE2b-256 79bb68f4604dfd70851206ac49eb0cc132aa7ce8f86ca77a0b533bf1b303f6f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.19-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 379eaaf66ecef96b07387253946651bb27963714fea1fcdaa12d6ede9b277875
MD5 5909eddced242eaef0831bea82c143e8
BLAKE2b-256 fed9d95b0b8870282e11364057f8d80a3c5111910c3b867c5d8ba8f2fd6fa4f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.19-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07be75cb1f3c64f983410d443b7b02ee221aaa1ac252a68f8072f7d79b786f91
MD5 3adaff5794a6015b59d7e4f90cc351f7
BLAKE2b-256 50c92cd6c2daf49cfb48c7321a9be8136707b264bdd4253f0fc984e480c418fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.19-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8dc095863dda0fba6f1ae9bfd78277fdfc4a85f824168b68a9aa5c12ce2a8618
MD5 e31a9d809b381c59984c0714a4f690df
BLAKE2b-256 9f9671b568a4868f3b83054293a0cb8affcda1bc85457563357a981f0dd391d0

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