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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8+ Windows x86-64

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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_qt-0.1.10-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.10.tar.gz.

File metadata

  • Download URL: polars_qt-0.1.10.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.10.tar.gz
Algorithm Hash digest
SHA256 1496bdfb1105d4923e4216177adfb8b592f416fef1c2161ce96a6e8c81168faf
MD5 188fdcd93225292cfd28b129131ce2a6
BLAKE2b-256 9507fe53e2167a72c8044bd9054c73484ec343093c06073c6eeec40498590f6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.10-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 801be3473d0a5363c3bf9c4f78097b97756e36b5ba20bc8c2698f90571ea5e0a
MD5 25c8065e44c152a27bf8be667e176591
BLAKE2b-256 651cf5ca1859b9e320b351d6ecb2964854986c3d9edb0ac56ed09b93478352ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.10-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c20e0a4d3c5bf724c3e098520cb9a1c439e56f49a2768f5eb4bfbc4c10f860f2
MD5 ed282c453e229ee3ec7535718f0143b0
BLAKE2b-256 f319d001b8c88097aa2058f567b6af2bbc468ece50cdb253b39129a91aa748df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.10-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 fb505808d12c910a9df4db3b41544a64bae0ff32b26cbed17fa5990ed7532050
MD5 c6f236e2db03021bffb5745255e2eb97
BLAKE2b-256 ae59b20e342d1577d3e45bf0653a46548806b0137355caca1bd1c11f40f428a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.10-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5e7d0ec7ab9d2266c328ed5e4d63335782f88c2d4904a242cac645c9f51b789
MD5 cdaef55fbad6386c78999d2498b063c6
BLAKE2b-256 6bc58810ade9c12f577643558aee1940040bef43e4ab3a75c6814073a91d94ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_qt-0.1.10-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7177bb04869c8fea176517550e595dc275aee42469df0829d7c2ad108d8f5990
MD5 a578c96d5f3072ea3785dd0e3a85aef5
BLAKE2b-256 8a6aa17cb980e9510df3b2d0ee7d00bf909835cc5a5fe2c0c0f7f72c840b4ac1

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