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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.11-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

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

polars_qt-0.1.11-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.11-cp38-abi3-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.11-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.11.tar.gz.

File metadata

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

File hashes

Hashes for polars_qt-0.1.11.tar.gz
Algorithm Hash digest
SHA256 a80f4e6866099153d6586134809827936d2323cf5bfca0cac4c42c8dd5f060b7
MD5 3cf7c829f7a47aaa4416a1e3a7145ee8
BLAKE2b-256 e7af7da41fe56b63190c6f891d2e2cb0f27ebd717692aa9345e3ddb440462349

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.11-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2372621225669bb7ed7ded2e33735a4ad612f9475b108c3fa2b2573afc427c3b
MD5 595bfc88fcd11008f6fd80d17fdfdd1f
BLAKE2b-256 fa5fca2a4f3d775b5e4ca0cb9f24d4249ab4a6e2a8c61afd01699adbd2d4a30b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.11-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3cef4c3fa6281789ef8f1f95367c408b2444c209b85a864421dc4c6680b976e0
MD5 66606c6da0f85ff31f2244abc8e82fab
BLAKE2b-256 99f7fe7307f2768754421a5325a8054c53c1f996604114791f0cce94a31571f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.11-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 24009f4cf96738fe1f3f7db555242df69fdd00edb715526fe00a97ec4c48f417
MD5 ef6f648b7bc8879e2ce1bdf4d16a6562
BLAKE2b-256 1aaff79a542e4bc8b34e944e24787e4354e5dfe8b161c4cd65819a706fbf1d2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.11-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a529fda9adb09239baeccd6247c4d33c3652345304bf3cd538e9182902ea950
MD5 1048ceedd6c48a7659cc5f16f55c8c4b
BLAKE2b-256 f5502eb2406dd87b52f7014416d61461fead9e941da09f7da0839b63b793d72d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.11-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cb994342365f66e324db03d19cf429e85a1b1f19cf0fff0fa1a19f7237f31f81
MD5 49ef12f72ab74a032be40372189f0dd7
BLAKE2b-256 65ec4ad8036e6f0490c75beb8e02bc134ba174ea1980aa25bb472701c6ae3376

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