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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.23-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.23.tar.gz.

File metadata

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

File hashes

Hashes for polars_qt-0.1.23.tar.gz
Algorithm Hash digest
SHA256 97965bf4376da3d6d1ecba94681a2716a9d961da316d392a2238d852e076d767
MD5 26fd8e677d0db542e3883d067a110b1e
BLAKE2b-256 dd35b9251997745cc3ffcd50bf68182cf9d453dbc178da4652cfc12d1748c141

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.23-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8cee973b97de4edb8650f31145a51fc5f1bfc8c1bcec603402444682777406ef
MD5 c3753290e1793b4c11f109c5f8518081
BLAKE2b-256 121724024193f453f1eae7151c64a7c0025a2813742c2e54ddb821430d470ff5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.23-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6124501ed8754a414b8528aa15230380b9d613c774ffcf366c29ddad4124f0b4
MD5 11f1485aa61b64adafbbb05d01285d5f
BLAKE2b-256 e10c14d761788275872816f54ba84b50048732b5250aa96b380ea8b8542d9e64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.23-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 1cf430b65958f309aa609b73bf8306680d2cde9e46b8886835ae8cc05b7c48ef
MD5 17564e78805735983f43d717a4bae06f
BLAKE2b-256 bb8db1e39b556e9de66af217b4b6138924b3e71d23902b74011339844205763c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.23-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50011c6b3b8505bbf8fdf01bd412129dc98fae2d1378800d856a25d4b1245d4e
MD5 8cca591c139b4a1257a4f1faaf42a65e
BLAKE2b-256 618387a8caadd1334e12e502925baae23c360c08aa4c13420b42021d922e4e83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.23-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c7df1b82a027407b8142619d15ab3b6a40f0bb5d9479b95521a782bb8882af7f
MD5 1f6e10f670ecbdd95ff3a58e4262fea0
BLAKE2b-256 8961d8290d9f07f87fa99783635e482b890e8bee6daad4a4a564da0a315a00c5

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