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

Uploaded Source

Built Distributions

polars_qt-0.1.3-cp38-abi3-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.8+ Windows x86-64

polars_qt-0.1.3-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.3-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl (4.8 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.12+ i686

polars_qt-0.1.3-cp38-abi3-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.3-cp38-abi3-macosx_10_12_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_qt-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ffc40a38955d5987dbe2b776e7742a4adc801a1780782f56168988800f611e78
MD5 61adef33c6a261f203898d4d275c351f
BLAKE2b-256 500ad27f0e9b5258083f852ab431320386c2fdcdbf573ceb88071dd114995089

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.3-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0682e9830f377e96ed6b942f19927b1c3c4f37c14d50dd952729da12dfa699a4
MD5 25b4eeea948cf3e342272dc34b290db7
BLAKE2b-256 1c0d54f4638192530626eb80446e29e3ee64304c60dcbf6e4fbdec10ea6ac304

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4738589f88f90a1f346862f1d7adc499056fedcd9fa5fe52b9d79bd7ae35ab39
MD5 a9f3781b087dcd1a1207c8d0dfb7425d
BLAKE2b-256 e7e50b1b735eaf5a5a24820e32308dd4a9a31460a658d0885f69aecae061e59f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.3-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 c9acf40fe74a1c4278bf8554867ccd2f0345c32aea082998f86299d7d683532b
MD5 146220f2936a1388d8806f9f95d51fc0
BLAKE2b-256 51a7dd7138191337ee7b0079306ca527c4a8d1c32a377726d3285f68d628892d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 66fc4709773a057fd2a916fb3b42897d97a04a8cedbee5e6cdb55b05c63902f5
MD5 dc2078801a443d80597f6d0e814352a9
BLAKE2b-256 2fafd5f97ac373711aa580b20f18fc3443f0c4047fd48802b72fa0a0646a56ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.3-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8affbb663875de3ee03debbc4c7fd1526d352063d0d716918dede4ca82462acc
MD5 80c4b3673e4ed3be4710ef1b19a4e21d
BLAKE2b-256 398c58955184aab4a276ad9f8af116d02f1a2bfdaa02a92e8933b44a164a420a

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