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

Uploaded Source

Built Distributions

polars_qt-0.1.6-cp38-abi3-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.6-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.6-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl (4.8 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.12+ i686

polars_qt-0.1.6-cp38-abi3-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.6-cp38-abi3-macosx_10_12_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.6.tar.gz
Algorithm Hash digest
SHA256 b908c28503aa6a159402f1d493fd1c9a7c9b770185981583b32ac24c21396c73
MD5 44096e0b5c2b52f3b8269b05e27ad5a0
BLAKE2b-256 ca3fa99d43890172e755c9c64ec5399e0b5eef6b140fef8164bf2364b795d32d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.6-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fa06bd5409d10a879e349a4eea401f7749b204fd8a2a80fd947621ea9441a164
MD5 ab778e9ce10892a9abbdeb264cdc07bd
BLAKE2b-256 98752430cc3b41246f29863e412edf2fc2ecd5605ec6e76575954f35c1fc70fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bfa1734c7d8030fc584c1453f3f6a70cdf86d0a29d22bd99ca2e12fe3e26ae31
MD5 8ad2d6dcc04d101be579f45e1c3c54d7
BLAKE2b-256 e8b406ef5d945a52b1638cd05903ebb95dd9ca458aa7c55c804fffe239e753c0

See more details on using hashes here.

File details

Details for the file polars_qt-0.1.6-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for polars_qt-0.1.6-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 70fb7a258fd7625cfbc9c4ad978b88db5cef893bb192e6b0827d63ec6717551b
MD5 1426f923e1e7c674aec86c18cccf8927
BLAKE2b-256 437dbd3cb8485ea02322f4e876be84ef1cf686ebd9c8c601d691b01ffb5ad68b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.6-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca2936c16288d80dd18aa80020ab8ee7bc0aaf1836b890432fac687c08d08f47
MD5 c079d77931baf8e47dd5ff5fa8f1a275
BLAKE2b-256 a3b752f3b39a915695d5245c4fc28c68541333511458f341b34fb5a35d28698f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.6-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2ec092defd7d536a9d107139ae722b54174a3b789c7f1fb4d2411aada9429e09
MD5 aea88bb126ac364103bade07726b9a4d
BLAKE2b-256 12a463b1c6fd94379f9946ceab845bfca329396803bca1c022cca0bb88f7739d

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