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

Uploaded Source

Built Distributions

polars_qt-0.1.16-cp38-abi3-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.16-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.16-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.4 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ i686

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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.16-cp38-abi3-macosx_10_12_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.16.tar.gz
Algorithm Hash digest
SHA256 385f989b77b06bbf70baae6cf4a124dbe0f5a83f3739a62183f295565573052f
MD5 14da6b1674f55e58b4fe0e851599193a
BLAKE2b-256 e3f8a25babd626ae041f58276b5003643608d62431e354c7be5693f3bb2bc69f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.16-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2eee81e6372b2eec9fa7a4f3b2585a8e63fba712f3017976cd8b70cfa8f2f759
MD5 ff2e6e50c899d07a0d4ce0117d20e8d2
BLAKE2b-256 91903e7ee0c9670aef715a08d32bfa6b02247232b1bc01dc113a678346aade82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.16-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 476cef15a578ed32a863ef142b06441bdd23d957b001ff0fc26c36283cd21d44
MD5 d70f7bc4cb9ba86d21e26ce9135c3104
BLAKE2b-256 4b02667f618eed1d46ec6c1e8050efb107db473897c505da8b1c452e8c2ceba1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.16-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 f399d065b25528876cad91e6bb193992233606b0051add596d8e919b6319fcfe
MD5 4d4102c37a22f2bdedaff5309ca8b9b0
BLAKE2b-256 b5945c3b90fcc0e20eef21578d1351a73da69d85e6fbf54ad381792c90165b6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.16-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8eb276d2139ecf4556b336fd9bd9779527c8c36595f3fd7b3481d1ab8615ab02
MD5 12860b585615c9093de510fa9871d3aa
BLAKE2b-256 0594baa75e089add89ad66864cfa28f3179113a419509974307ba39e3d489347

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.16-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1b418aaf8fd7a0ea901b5c5e0225a79b637bc7080a0a88b3428d614d04a0cb4c
MD5 afdfc980b7793af028c2974b9f2a0e0d
BLAKE2b-256 efdbc9dedd7bdf44b3635315563621920afe154e6a4361d573f617183b2766fb

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