crystal_talib
crystal_talib
Crystal bindings for the TA-lib library. TA-Lib performs technical analysis of financial market data.
Installation (only tested on Linux so far)
-
Download and build TA-lib (
./configure && make
) -
Copy the contents of
src/.libs
to/usr/lib
-
Add the dependency to your
shard.yml
:dependencies: crystal_talib: github: fridgerator/crystal_talib
-
Run
shards install
Usage
require "crystal_talib"
# List all TA-LIB functions
functions = result = CrystalTalib.functions
functions # Array(String)
# Execute a TA-LIB function
market_data = { open: Array(Float64), close: Array(Float64), high: Array(Float64), low: Array(Float64), volume: Array(Float64) }
result = CrystalTalib.execute(
"ADX",
start_idx: 0,
end_idx: market_data.close.size - 1,
high: market_data.high,
low: market_data.low,
close: market_data.close,
opt_in_time_period: 9
)
result.beg_index # Int32
result.nb_element # Int32
result.result # Hash(String, Array(Float64))
# Discover input and output parameters of functions
function_description = CrystalTalib.explain("ADX")
Contributing
- Fork it (https://github.com/fridgerator/crystal_talib/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Nick Franken - creator and maintainer