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

Uploaded Source

Built Distributions

polars_qt-0.1.13-cp38-abi3-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.13-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

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

polars_qt-0.1.13-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.3 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ i686

polars_qt-0.1.13-cp38-abi3-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.13-cp38-abi3-macosx_10_12_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.13.tar.gz
Algorithm Hash digest
SHA256 a98803408f0aaf6903a399475956a842991a43ed2d767c2baebc96309c89ef5c
MD5 7281e8a90c2d8d3f13dbab1337ff3780
BLAKE2b-256 c9c1e160fb2533a5a03eec4a9262b1ca7a3070becaccd96b0d6011b169fa8f50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.13-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 47bb9a8a64c8523f546a148f19f6769ac5956950c56304d4e12a55110a06454e
MD5 a848f20b217db5807caa5c10415dfa62
BLAKE2b-256 c5cd692ade5c04884ea5c3b046efe451c4e96ec004fa648a433432e6e43900a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.13-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc22cf42e7019c96a8423cd67435ed9198f9657872ec1d41689bc62e93a27750
MD5 8790869423adc339f2f5a235e0091ee0
BLAKE2b-256 c97fff4410878082cd01637a0024cfb59c4b745e292fb46bb8e018d8733793bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.13-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 815493c06368700711a02f2aed03cbf779284bf6ca3e27cb009b2eb9c4e0bf95
MD5 73fbe7cf55f545cc0ba0bb77a650f142
BLAKE2b-256 86edeb643eeaa2cb36b916532f2253c21fdb908b80cf266f9fd6a19e0c6fdc6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.13-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 40965c3505b0c5a1f9df91d9dd924b35c944953e8c4743f1269ba0c2780162dd
MD5 a22fb30989a3d5b613e96bff35ca6a7c
BLAKE2b-256 0c6199d317778cd1465a6a0a7ba634115745e7e25083b93bb7b952ad6fb5bfd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.13-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5dfabc80d0bf33c32890d5e65000b1620a98ab3206dc43a83b7c0b6a0bd74e9c
MD5 a8f4916f86eee926100915dc4cc049d8
BLAKE2b-256 8a81e27d2d7fd7db9b24c23fd1a67e9779392e493addc67df6e40512fb2023df

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