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

Uploaded Source

Built Distributions

polars_qt-0.1.2-cp38-abi3-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

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

polars_qt-0.1.2-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl (4.7 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.12+ i686

polars_qt-0.1.2-cp38-abi3-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 eae40083e26e927aff3d0fb61cd12324a8b8f72fa37108fd6e78ba37b4bc4c37
MD5 8bff245b5f4f7d12540f0b55fba7aca1
BLAKE2b-256 f8c1436acafc5944acee9fff5cc1a724e3f41d2b715cf0e52620b2d3dc867626

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1aa49ae3468e5fcf360bf5f51c19d9fa5817b70cabfc3e440b53bf6b2410f120
MD5 0fb3df0959896054c292cbf5a3da0921
BLAKE2b-256 50276da05324278af4380380024ee3ad920acad323ec76ed045942a12167f6c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0b859737ab979abd12726ca40fe8fc8cfbbdeb069b9661c22b6592b11cbc4a4
MD5 9afcdefd34d9c9ec354ab0ba03c8e29e
BLAKE2b-256 96012ce8104808e0433f9b35c55815f17e6f46d4dda96a5d75eaeecd41203bb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.2-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 fbf8d9d3118e8f06f8ceee2d5fb7901e65a08f7b2a7bb41a5517e677ad63bcc4
MD5 58f083cb4ddcb5433c54b8a2df4a51a6
BLAKE2b-256 97922363507ab56ca847ac823bc4fdcff47341148d64bf004440ee860dc0f021

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b6e4024f0541fd242a768a0b9b4a1cf6cd12283a4db65b41c2db9c46bbe56bb8
MD5 0beb5122c94c46d44311ecc56ca3d1a1
BLAKE2b-256 65303f85f003c0d8b0f34766d73c9142fc637e5cc267fc6150dcd62db8488655

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f2c30d3bed02274832ad7c22b1291415dc7a0eebfaa3e547bcbe2258b269a59e
MD5 eabfa3e709bec82ee00f8425c9419bc6
BLAKE2b-256 016fbabe188bd215b10687fcaaa19264f78be17c20828341302d1c050a67c06c

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