Skip to content

Commit 24b18fe

Browse files
authored
Merge pull request #9 from TA-Lib/dev
docs: Improve input parameter documentation for TA-Lib functions
2 parents f5ea6c2 + be08952 commit 24b18fe

File tree

4 files changed

+153
-110
lines changed

4 files changed

+153
-110
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# TALibFFI
22

33
![Tests](https://github.com/TA-Lib/ta-lib-ruby/actions/workflows/main.yml/badge.svg)
4-
![Gem Version](https://img.shields.io/gem/v/ta_lib_ffi.svg)
4+
[![Gem Version](https://badge.fury.io/rb/ta_lib_ffi.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/ta_lib_ffi)
55

66
## Introduction
77

8-
TALibFFI is a Ruby binding for [TA-Lib](https://ta-lib.org/) (Technical Analysis Library) using FFI (Foreign Function Interface). It provides a comprehensive set of functions for technical analysis of financial market data.
8+
TALibFFI is a Ruby binding for [TA-Lib](https://ta-lib.org/) (Technical Analysis Library) using FFI (Foreign Function Interface). It provides a comprehensive set of functions for technical analysis of financial market data. This gem is based on the [TA-Lib C headers](https://github.com/TA-Lib/ta-lib/blob/6a07e4ca1877c5ab4b08b81015858bfcbf2ef832/include/ta_abstract.h#L45), providing a Ruby-friendly interface to the underlying C library.
99

1010
## Requirements
1111

@@ -39,7 +39,7 @@ wget https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib_0.6.4_i386
3939
sudo dpkg -i ta-lib_0.6.4_i386.deb
4040
```
4141

42-
### Installing the Ruby Gem
42+
### [Installing the Ruby Gem](https://rubygems.org/gems/ta_lib_ffi)
4343

4444
Add this to your application's Gemfile:
4545

@@ -66,8 +66,20 @@ prices = [10.0, 11.0, 12.0, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.0]
6666
# Calculate SMA
6767
puts TALibFFI.sma(prices, time_period: 3)
6868
# => [11.0, 11.333333333333334, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0]
69+
70+
# Average True Range (ATR) Example
71+
high = [82.15, 81.89, 83.03, 83.30, 83.85, 83.90, 83.33, 84.30, 84.84, 85.00, 85.90, 86.58, 86.98, 88.00, 87.87]
72+
low = [81.29, 80.64, 81.31, 82.65, 83.07, 83.11, 82.49, 82.30, 84.15, 84.11, 84.03, 85.39, 85.76, 87.17, 87.01]
73+
close = [81.59, 81.06, 82.87, 83.00, 83.61, 83.15, 82.84, 83.99, 84.55, 84.36, 85.53, 86.54, 86.89, 87.77, 87.29]
74+
75+
# Calculate ATR with period = 5
76+
result = TALibFFI.atr([high, low, close], time_period: 5)
77+
# => [1.101999999999998, 1.0495999999999992, 1.2396799999999994, 1.1617440000000012, 1.1073952000000011, ...]
6978
```
7079

80+
## Documentation
81+
- [API Documentation](https://www.rubydoc.info/github/TA-Lib/ta-lib-ruby/main) - Detailed documentation of all available methods and classes
82+
7183
## TODO
7284
- [ ] Add RDoc documentation for Ruby methods
7385
- [ ] Create detailed function examples with input/output samples

0 commit comments

Comments
 (0)