Skip to content

Commit b33ae50

Browse files
authored
Merge pull request #3 from Youngv/dev
Update documentation and streamline gem configuration
2 parents d553107 + 1fd3d5b commit b33ae50

File tree

6 files changed

+110
-31
lines changed

6 files changed

+110
-31
lines changed

CHANGELOG.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
1-
## [Unreleased]
1+
# Changelog
22

3-
## [0.1.0] - 2025-01-19
3+
All notable changes to this project will be documented in this file.
44

5-
- Initial release
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2024-01-21
9+
10+
### Added
11+
- Initial release of ta_lib_ffi
12+
- Basic FFI wrapper for TA-Lib
13+
- Cross-platform support:
14+
- Windows (64-bit)
15+
- macOS (via Homebrew)
16+
- Linux (Debian/Ubuntu packages)
17+
- Automated tests with GitHub Actions
18+
- Basic documentation and usage examples
19+
20+
### Changed
21+
- N/A
22+
23+
### Deprecated
24+
- N/A
25+
26+
### Removed
27+
- N/A
28+
29+
### Fixed
30+
- N/A
31+
32+
### Security
33+
- N/A
34+
35+
[0.1.0]: https://github.com/Youngv/ta_lib_ffi/releases/tag/v0.1.0

Gemfile.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ GEM
88
remote: https://rubygems.org/
99
specs:
1010
ast (2.4.2)
11-
byebug (11.1.3)
1211
diff-lcs (1.5.1)
1312
fiddle (1.1.6)
1413
json (2.9.1)
@@ -70,7 +69,6 @@ PLATFORMS
7069
x86_64-linux
7170

7271
DEPENDENCIES
73-
byebug (~> 11.1)
7472
rake (~> 13.2)
7573
rspec (~> 3.13)
7674
rubocop-rspec (~> 3.3)

README.md

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,89 @@
22

33
![Tests](https://github.com/Youngv/ta_lib_ffi/actions/workflows/main.yml/badge.svg)
44

5-
Ruby FFI wrapper for TA-Lib (Technical Analysis Library)
5+
## Introduction
6+
7+
TALib 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+
9+
## Requirements
10+
11+
- Ruby >= 3.0.0
12+
- TA-Lib >= 0.6.4
613

714
## Installation
815

9-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
16+
### [Install TA-Lib](https://ta-lib.org/install/)
17+
18+
#### Windows
19+
Download and run the installer: [ta-lib-0.6.4-windows-x86_64.msi](https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib-0.6.4-windows-x86_64.msi)
20+
21+
#### macOS
22+
```bash
23+
brew install ta-lib
24+
```
25+
26+
#### Linux (Debian/Ubuntu)
27+
```bash
28+
# For Intel/AMD 64-bit
29+
wget https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib_0.6.4_amd64.deb
30+
sudo dpkg -i ta-lib_0.6.4_amd64.deb
31+
32+
# For ARM64
33+
wget https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib_0.6.4_arm64.deb
34+
sudo dpkg -i ta-lib_0.6.4_arm64.deb
35+
36+
# For Intel/AMD 32-bits
37+
wget https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib_0.6.4_i386.deb
38+
sudo dpkg -i ta-lib_0.6.4_i386.deb
39+
```
1040

11-
Install the gem and add to the application's Gemfile by executing:
41+
### Installing the Ruby Gem
1242

13-
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
43+
Add this to your application's Gemfile:
1444

15-
If bundler is not being used to manage dependencies, install the gem by executing:
45+
```ruby
46+
gem 'ta_lib_ffi'
47+
```
1648

17-
$ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
49+
Then execute:
50+
51+
$ bundle install
52+
53+
Or install it directly:
54+
55+
$ gem install ta_lib_ffi
1856

1957
## Usage
2058

21-
TODO: Write usage instructions here
59+
```ruby
60+
require 'ta_lib'
2261

23-
## Development
62+
# Initialize data
63+
prices = [10.0, 11.0, 12.0, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.0]
2464

25-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
65+
# Calculate SMA
66+
puts TALib.sma(prices, time_period: 3)
67+
# => [11.0, 11.333333333333334, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0]
68+
```
69+
70+
## TODO
71+
- [ ] Add RDoc documentation for Ruby methods
72+
- [ ] Create detailed function examples with input/output samples
73+
- [ ] Add more tests for each function
74+
- [ ] Support custom TA-Lib installation location
75+
76+
## Development
2677

27-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
78+
1. Fork the repository
79+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
80+
3. Commit your changes (`git commit -am 'Add some amazing feature'`)
81+
4. Push to the branch (`git push origin feature/amazing-feature`)
82+
5. Create a Pull Request
2883

2984
## Contributing
3085

31-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ta_lib_ffi.
86+
Bug reports and pull requests are welcome on GitHub at https://github.com/Youngv/ta_lib_ffi
3287

3388
## License
3489

35-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
90+
This gem is available as open source under the terms of the [MIT License](LICENSE).

lib/ta_lib.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,7 @@ def call_func(func_name, args)
322322
begin
323323
setup_input_parameters(params_ptr, input_arrays, func_name)
324324
setup_optional_parameters(params_ptr, options, func_name)
325-
lookback = calculate_lookback(params_ptr)
326-
puts "Lookback: #{lookback}"
325+
_lookback = calculate_lookback(params_ptr)
327326
calculate_results(params_ptr, input_arrays.first.length, func_name)
328327
ensure
329328
TA_ParamHolderFree(params_ptr)
@@ -438,7 +437,6 @@ def calculate_results(params_ptr, input_size, func_name)
438437
check_ta_return_code(ret_code)
439438

440439
actual_size = out_size[0, Fiddle::SIZEOF_INT].unpack1("l")
441-
puts "actual_size: #{actual_size}"
442440
format_output_results(output_arrays, actual_size, func_name)
443441
ensure
444442
out_begin.free

spec/ta_lib_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# frozen_string_literal: true
22

33
require "spec_helper"
4-
require "byebug"
54

65
RSpec.describe TALib do
76
shared_examples "ta_lib_input_validation" do |method_name|

ta_lib_ffi.gemspec

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,20 @@ Gem::Specification.new do |spec|
1616
spec.metadata["homepage_uri"] = spec.homepage
1717
spec.metadata["source_code_uri"] = "https://github.com/Youngv/ta_lib_ffi"
1818
spec.metadata["changelog_uri"] = "https://github.com/Youngv/ta_lib_ffi/blob/main/CHANGELOG.md"
19-
20-
# Specify which files should be added to the gem when it is released.
21-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22-
spec.files = Dir.chdir(__dir__) do
23-
`git ls-files -z`.split("\x0").reject do |f|
24-
(File.expand_path(f) == __FILE__) ||
25-
f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
26-
end
27-
end
19+
spec.files = Dir[
20+
"lib/**/*",
21+
"LICENSE.txt",
22+
"README.md",
23+
"CHANGELOG.md",
24+
"Gemfile",
25+
"Rakefile",
26+
"ta_lib_ffi.gemspec",
27+
]
2828
spec.bindir = "exe"
2929
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
3030
spec.require_paths = ["lib"]
3131

3232
spec.add_dependency "fiddle", "~> 1.1"
33-
spec.add_development_dependency "byebug", "~> 11.1"
3433
spec.add_development_dependency "rake", "~> 13.2"
3534
spec.add_development_dependency "rspec", "~> 3.13"
3635
spec.add_development_dependency "rubocop-rspec", "~> 3.3"

0 commit comments

Comments
 (0)