QLib|开源AI量化投资平台|外汇股票API
学习如何将 ITick 外汇、股票实时数据 API 集成到 Qlib 开源 AI 量化投资平台,构建基于机器学习的量化模型与回测系统。
Last updated
"""
**iTick**:是一家数据代理机构,为金融科技公司和开发者提供可靠的数据源APIs,涵盖外汇API、股票API、加密货币API、指数API等,帮助构建创新的交易和分析工具,目前有免费的套餐可以使用基本可以满足个人量化开发者需求
https://github.com/itick-org
https://itick.org
"""
import requests
url = "https://api.itick.org/stock/kline?region=hk&code=700&kType=1"
headers = {
"accept": "application/json",
"token": "bb42e24746784dc0af821abdd1188861d945a07051c8414a8337697a752de1eb"
}
response = requests.get(url, headers=headers)
print(response.text)pip install pyqlib
pip install numpy
pip install --upgrade cython
git clone https://github.com/microsoft/qlib.git && cd qlib
pip install . # `pip install -e .[dev]` is recommended for development. check details in docs/developer/code_standard_and_dev_guide.rst# get 1d data
python -m qlib.run.get_data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
# get 1min data
python -m qlib.run.get_data qlib_data --target_dir ~/.qlib/qlib_data/cn_data_1min --region cn --interval 1min cd examples # Avoid running program under the directory contains `qlib`
qrun benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml'The following are analysis results of the excess return without cost.'
risk
mean 0.000708
std 0.005626
annualized_return 0.178316
information_ratio 1.996555
max_drawdown -0.081806
'The following are analysis results of the excess return with cost.'
risk
mean 0.000512
std 0.005626
annualized_return 0.128982
information_ratio 1.444287
max_drawdown -0.091078