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

Uploaded Source

Built Distributions

polars_qt-0.1.20-cp38-abi3-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.20-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

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

polars_qt-0.1.20-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.5 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ i686

polars_qt-0.1.20-cp38-abi3-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.20-cp38-abi3-macosx_10_12_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.20.tar.gz
Algorithm Hash digest
SHA256 6670b3b10ff063ccf00b73735aaa7311d04029b7a55c9ed7ee23661af353ea62
MD5 1f471ffe1618835ef30ebcad07f9f357
BLAKE2b-256 120d8f14b98b1ce0cbfc20c328987c037f58f9bddaf522ae3d49851e8bb9781e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.20-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f9a070ed5d8c4df3bd76b8a39d15506362d99a612f4c0d9da676486ce1acaa42
MD5 46d2f2cd2d84250c1a0384c6e8bd1ec4
BLAKE2b-256 4534938204471208817f620d2e60bf7505f1f16c681f1d6965592d33296a22f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.20-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6ed642499fdce6fa94c1c5183c89f782f6af4bbf0f70eb61f3f705a4ab9c0a2b
MD5 653ad6c8325faf15893451e444752c77
BLAKE2b-256 b850300a1d812e9bb9935e78064c94160f1d47537d8159cce719c12432f286c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.20-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 4a7f3d1209aaea31b7ba70e0e21e16fd8cda1c11c1dde50fcb55a6b69bd15dcb
MD5 bdc8df4eabff0eb4d9c61821260212aa
BLAKE2b-256 80702caeec13aa7a87ab5c99a0a731c513323855756afbc44fa2a01325185271

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.20-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fc4b45c59dd0f5eb955368946f4150a119b49ed49e2d705b7a9d558a4ef469ec
MD5 e3fc3b8fcb50394d2a40976a0bd434ac
BLAKE2b-256 e0d5aecef329895b424562cef5b197f8de5e855da83468c7a2e265fa4e4b628b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.20-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e77b3a198422fe94ddae457a23fb86dde94a4ca63cb8b3ccbe2a04914abd98a3
MD5 58d5636198d422bd783557f651b96068
BLAKE2b-256 91c7a846eb14a2a989d84203e1657ae1c0bba7a030fd47a9501ed6234a6d4bf4

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