TA-Lib,全稱“Technical Analysis Library”, 即技術(shù)分析庫,是 Python 金融量化的高級庫,涵蓋了 150 多種股票、期貨交易軟件中常用的技術(shù)分析指標(biāo),如 MACD、RSI、KDJ、動量指標(biāo)、布林帶等等。
你所需要的網(wǎng)站建設(shè)服務(wù),我們均能行業(yè)靠前的水平為你提供.標(biāo)準(zhǔn)是產(chǎn)品質(zhì)量的保證,主要從事成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計、企業(yè)網(wǎng)站建設(shè)、成都做手機(jī)網(wǎng)站、網(wǎng)頁設(shè)計、成都品牌網(wǎng)站建設(shè)、網(wǎng)頁制作、做網(wǎng)站、建網(wǎng)站。成都創(chuàng)新互聯(lián)擁有實力堅強(qiáng)的技術(shù)研發(fā)團(tuán)隊及素養(yǎng)的視覺設(shè)計專才。
TA-Lib 可分為 10 個子板塊:
本文介紹通過 Funcraft 的模板將 Python 量化交易庫 TA-lib 移植到函數(shù)計算。
本項目是在 MacOS 下開發(fā)的,涉及到的工具是平臺無關(guān)的,對于 Linux 和 Windows 桌面系統(tǒng)應(yīng)該也同樣適用。在開始本例之前請確保如下工具已經(jīng)正確的安裝,更新到最新版本,并進(jìn)行正確的配置。
對于 MacOS 用戶可以使用 homebrew 進(jìn)行安裝:
brew cask install docker
brew tap vangie/formula
brew install fun
Windows 和 Linux 用戶安裝請參考:
https://github.com/aliyun/fun/blob/master/docs/usage/installation.md
安裝好后,記得先執(zhí)行 fun config
初始化一下配置。
使用 fun init 命令可以快捷地將本模板項目初始化到本地。
fun init vangie/ta-lib-example
$ fun install
using template: template.yml
start installing function dependencies without docker
building ta-lib-example/ta-lib-example
Funfile exist, Fun will use container to build forcely
Step 1/5 : FROM registry.cn-beijing.aliyuncs.com/aliyunfc/runtime-python3.6:build-1.7.7
---> 373f5819463b
Step 2/5 : COPY ta-lib-0.4.0-src.tar.gz /tmp
---> Using cache
---> 64f9f85112b4
Step 3/5 : RUN cd /tmp; tar -xzf ta-lib-0.4.0-src.tar.gz
---> Using cache
---> 9f2d3f836de9
Step 4/5 : RUN cd /tmp/ta-lib/ ; ./configure --prefix=/code/.fun/root/usr ; make ; make install
---> Using cache
---> 7725836973d4
Step 5/5 : RUN TA_LIBRARY_PATH=/code/.fun/root/usr/lib TA_INCLUDE_PATH=/code/.fun/root/usr/include fun-install pip install TA-Lib
---> Using cache
---> a338e71895b7
sha256:a338e71895b74a0be98278f35da38c48545f04a54e19ec9e689bab976265350b
Successfully built a338e71895b7
Successfully tagged fun-cache-d4ac1d89-5b75-4429-933a-2260e2f7fbec:latest
copying function artifact to /Users/vangie/Workspace/ta-lib-example/{{ projectName }}
Install Success
Tips for next step
======================
* Invoke Event Function: fun local invoke
* Invoke Http Function: fun local start
* Build Http Function: fun build
* Deploy Resources: fun deploy
$ fun local invoke
using template: template.yml
Missing invokeName argument, Fun will use the first function ta-lib-example/ta-lib-example as invokeName
skip pulling image aliyunfc/runtime-python3.6:1.7.7...
FunctionCompute python3 runtime inited.
FC Invoke Start RequestId: dc1495b2-13ec-4ecf-a2dc-a0026d82651a
FC Invoke End RequestId: dc1495b2-13ec-4ecf-a2dc-a0026d82651a
[
"HT_DCPERIOD",
"HT_DCPHASE",
"HT_PHASOR",
"HT_SINE",
"HT_TRENDMODE"
]
RequestId: dc1495b2-13ec-4ecf-a2dc-a0026d82651a Billed Duration: 350 ms Memory Size: 1998 MB Max Memory Used: 34 MB
$ fun deploy
using template: template.yml
using region: cn-shanghai
using accountId: ***********4733
using accessKeyId: ***********EUz3
using timeout: 600
Waiting for service ta-lib-example to be deployed...
Waiting for function ta-lib-example to be deployed...
Waiting for packaging function ta-lib-example code...
The function ta-lib-example has been packaged. A total of 39 files files were compressed and the final size was 3.23 MB
function ta-lib-example deploy success
service ta-lib-example deploy success
$ fun invoke
using template: template.yml
Missing invokeName argument, Fun will use the first function ta-lib-example/ta-lib-example as invokeName
========= FC invoke Logs begin =========
FC Invoke Start RequestId: 83e23eba-02b4-4380-bbca-daec6856bf4a
FC Invoke End RequestId: 83e23eba-02b4-4380-bbca-daec6856bf4a
Duration: 213.86 ms, Billed Duration: 300 ms, Memory Size: 128 MB, Max Memory Used: 43.50 MB
========= FC invoke Logs end =========
FC Invoke Result:
[
"HT_DCPERIOD",
"HT_DCPHASE",
"HT_PHASOR",
"HT_SINE",
"HT_TRENDMODE"
]
“阿里巴巴云原生關(guān)注微服務(wù)、Serverless、容器、Service Mesh 等技術(shù)領(lǐng)域、聚焦云原生流行技術(shù)趨勢、云原生大規(guī)模的落地實踐,做最懂云原生開發(fā)者的技術(shù)圈?!?/p>