项目用途
参考ailabx和qlib,优化了一些代码,将qlib因子计算独立出来使用。并简化使用方法。
用法设计
数据
使用内置的下载数据工具或使用自有数据源,会默认下载几个ETF数据,data_update可用传入codes列表。
from golden_qlib_alpha.data.data_update import data_update
def test():
data_update()
if __name__ == '__main__':
test()
计算因子
from golden_qlib_alpha.datafeed.dataloader import Dataloader
def test2():
code = '510300.SH'
fields = []
names = []
fields += ["Ref($close, 1)/$close"]
names += ["ROC5"]
fields += ["RSRS($high,$low,18)"]
names += ['RSRS']
fields +=["Slope($close,20)"]
names +=['Ret20']
fields+=['$close/Ref($close,20)-1']
names += ['Return20']
df=Dataloader().load([code],'2021-01-01','2022-10-01',names,fields)
print(df)
if __name__ == '__main__':
test2()
用户可以将因子写在用户指定的csv中:
因子名,因子表达式
feature1,$close/Ref($close,20)-1
label设置:
label0,Ref($close, -5)/Ref($close, -1) - 1
读取csv文件,并对指定的数据开展这些表达式的计算。
因子分析
注意: alphalens要安装alphalens-reloaded版本
pip install alphalens-reloaded
因子分析使用方法见tests目录的"test-alphalens.ipynb"
Metadata
Release files for golden-qlib-alpha 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| golden_qlib_alpha-0.0.5.tar.gz | 19.3 kB | Without provenance | Details for golden_qlib_alpha-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| golden_qlib_alpha-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for golden_qlib_alpha-0.0.5-py3-none-any.whl |
Total release size: 43.3 kB
Release files / golden_qlib_alpha-0.0.5.tar.gz
| Download URL | golden_qlib_alpha-0.0.5.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d73665dbeadc784068680ca945f742965b9903e81953cc7b4681de3274f49063
|
|
BLAKE2b-256 checksum How to use checksums |
ec4c4043d6a31aa777cf186419c8a381e210d92e616af561490701fed3c85ca4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.0
|
Release files / golden_qlib_alpha-0.0.5-py3-none-any.whl
| Download URL | golden_qlib_alpha-0.0.5-py3-none-any.whl |
|---|---|
| Size | 24.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce08963d999acaf6b16f781c8c7e566b971c9b00ff76af429884fe571411d490
|
|
BLAKE2b-256 checksum How to use checksums |
34d0c867f5f408e15fe7dd4e1d81fcaed55de2bd114d03366564328b020d7541
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.0
|
Security for golden-qlib-alpha 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.