-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
roadmap for a Julia TA-Lib wrapper #1
Comments
Some help to define a (better) roadmap will be nice Pinging @milktrader @mrjbq7 Feel free to ping some other people who might be interested |
There are a lot of functions to define, I ended getting one to work manually then made a code generator that used that as a template to create the code for all of the functions: https://github.com/mrjbq7/ta-lib/blob/master/tools/generate.py |
Ideally I think we should have a kind of tabular or JSON format to define functions and group them according similar behavior (return one array (like SMA) or 3 like BBANDS ...) |
This idea is (partially) implemented here: https://github.com/femtotrader/TALib.jl/tree/master/scripts (see |
An other interesting approach could be to use a Python C parser library to create intermediate file from parsed headers. pyclibrary http://pyclibrary.readthedocs.io/ seems interesting. You can find in same directory Clang might also be considered https://github.com/ihnorton/Clang.jl |
MA and BBANDS seems to be working fine (see README). |
Nice! |
|
That's add to roadmap.
But ideally I would like to avoid to add I did code for level 0. see
but I think I can do something more elegant with macros. Any help on this will be great. In the meantime, I will try to implement this weekend level 1 functions. |
@milktrader maybe you can provide some examples of see
and
|
level 2 support with DataFrames as inputs / outputs is implemented. We can do now using TALib
using DataFrames
using PyPlot
filename = "test/ford_2012.csv"
df = readtable(filename)
df[:Date] = Date(df[:Date])
indic = MA(df)
plot(df[:Date], df[:Close], indic[:Date], indic[:Real])
indic = MA(df, price=:Open)
plot(df[:Date], df[:Close], indic[:Date], indic[:Real])
indic = BBANDS(df)
plot(df[:Date], df[:Close],
indic[:Date], indic[:UpperBand],
indic[:Date], indic[:MiddleBand],
indic[:Date], indic[:LowerBand]
) Next step will be to have level 2 - Code is quite ugly but everyone is free to help. |
level 2 support with TimeArrays as inputs / outputs is also implemented. We can do now julia> using TALib
julia> using TimeSeries
julia> using PyPlot
julia> filename = "test/ford_2012.csv"
julia> ohlcv = readtimearray(filename)
250x5 TimeSeries.TimeArray{Float64,2,Date,Array{Float64,2}} 2012-01-03 to 2012-12-31
Open High Low Close Volume
2012-01-03 | 11.0 11.25 10.99 11.13 45709900
2012-01-04 | 11.15 11.53 11.07 11.3 79725200
2012-01-05 | 11.33 11.63 11.24 11.59 67877500
2012-01-06 | 11.74 11.8 11.52 11.71 59840700
⋮
2012-12-26 | 12.31 12.79 12.31 12.79 140331900
2012-12-27 | 12.79 12.81 12.36 12.76 108315100
2012-12-28 | 12.55 12.88 12.52 12.87 95668600
2012-12-31 | 12.88 13.08 12.76 12.95 106908900
julia> indic = MA(ohlcv)
250x1 TimeSeries.TimeArray{Float64,1,Date,Array{Float64,1}} 2012-01-03 to 2012-12-31
Real
2012-01-03 | NaN
2012-01-04 | NaN
2012-01-05 | NaN
2012-01-06 | NaN
⋮
2012-12-26 | 11.3347
2012-12-27 | 11.3933
2012-12-28 | 11.4667
2012-12-31 | 11.546
julia> plot(ohlcv.timestamp, ohlcv["Close"].values, indic.timestamp, indic["Real"].values)
julia> indic = BBANDS(ohlcv)
250x3 TimeSeries.TimeArray{Float64,2,Date,Array{Float64,2}} 2012-01-03 to 2012-12-31
UpperBand MiddleBand LowerBand
2012-01-03 | NaN NaN NaN
2012-01-04 | NaN NaN NaN
2012-01-05 | NaN NaN NaN
2012-01-06 | NaN NaN NaN
⋮
2012-12-26 | 12.9438 12.11 11.2762
2012-12-27 | 13.1808 12.316 11.4512
2012-12-28 | 13.2853 12.536 11.7867
2012-12-31 | 13.1319 12.754 12.3761
julia> plot(ohlcv.timestamp, ohlcv["Close"].values,
indic.timestamp, indic["UpperBand"].values,
indic.timestamp, indic["MiddleBand"].values,
indic.timestamp, indic["LowerBand"].values
) ... |
RetCode
Compatibility
RangeType
CandleSettingType
SIN
,COS
,TAN
,ASIN
,ACOS
,ATAN
, ...GetVersionString
,GetVersionMajor
,GetVersionMinor
,GetVersionBuild
,GetVersionDate
,GetVersionTime
MA
(SMA
,EMA
, ...),BBANDS
...TA_FunctionDescriptionXML
see https://github.com/stoni/ta-lib/blob/master/ta_func_api.xml andta_abstract.h
-FunctionDescriptionXML()
ta_func_api.xml
and outputta_func_api.json
see http://stackoverflow.com/questions/37165674/convert-a-quite-simple-xml-file-to-json-using-julia_Lookback
functions (see http://ta-lib.org/d_api/d_api.html )_FramePP
and_FramePPLB
functions (see for exampleBBANDS
)TArray
as input / output - see TALib.jl should support JuliaTS #6The text was updated successfully, but these errors were encountered: