Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.0] - 2025-01-21

### Added
- Added Zeitwerk inflector configuration for proper constant loading

### Changed
- Renamed module from `TALib` to `TALibFFI` for better clarity
- Renamed main file from `lib/ta_lib.rb` to `lib/ta_lib_ffi.rb`
- Updated require statements in specs and gemspec

## [0.1.0] - 2024-01-21

### Added
Expand All @@ -26,10 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- N/A

### Fixed
- N/A

### Security
- N/A

[0.2.0]: https://github.com/Youngv/ta_lib_ffi/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/Youngv/ta_lib_ffi/releases/tag/v0.1.0
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
ta_lib_ffi (0.1.0)
ta_lib_ffi (0.2.0)
fiddle (~> 1.1)

GEM
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# TALib
# TALibFFI

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

## Introduction

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.
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.

## Requirements

Expand Down Expand Up @@ -57,13 +57,13 @@ Or install it directly:
## Usage

```ruby
require 'ta_lib'
require 'ta_lib_ffi'

# Initialize data
prices = [10.0, 11.0, 12.0, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.0]

# Calculate SMA
puts TALib.sma(prices, time_period: 3)
puts TALibFFI.sma(prices, time_period: 3)
# => [11.0, 11.333333333333334, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0]
```

Expand Down
18 changes: 16 additions & 2 deletions lib/ta_lib.rb → lib/ta_lib_ffi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@
require "fiddle/import"

# Ruby FFI wrapper for TA-Lib (Technical Analysis Library)
module TALib
VERSION = "0.1.0"
module TALibFFI
VERSION = "0.2.0"

if defined?(Zeitwerk)
# Custom inflector for handling special case module names like TALibFFI
class Inflector < Zeitwerk::GemInflector
def camelize(basename, _abspath)
case basename
when "ta_lib_ffi"
"TALibFFI"
else
super
end
end
end
end

extend Fiddle::Importer

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "ta_lib"
require "ta_lib_ffi"

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
Expand Down
4 changes: 2 additions & 2 deletions spec/ta_lib_spec.rb → spec/ta_lib_ffi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "spec_helper"

RSpec.describe TALib do
RSpec.describe TALibFFI do
shared_examples "ta_lib_input_validation" do |method_name|
context "when input is invalid" do
it "raises error for empty array" do
Expand All @@ -24,7 +24,7 @@

describe "Version and Initialization" do
it "has a version number" do
expect(described_class::VERSION).to eq("0.1.0")
expect(described_class::VERSION).to eq("0.2.0")
end

it "returns a string for TA-Lib version", skip: "Not implemented under Windows" do
Expand Down
4 changes: 2 additions & 2 deletions ta_lib_ffi.gemspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

require_relative "lib/ta_lib"
require_relative "lib/ta_lib_ffi"

Gem::Specification.new do |spec|
spec.name = "ta_lib_ffi"
spec.version = TALib::VERSION
spec.version = TALibFFI::VERSION
spec.authors = ["Victor Yang"]
spec.email = ["[email protected]"]
spec.summary = "Ruby FFI bindings for TA-Lib (Technical Analysis Library)"
Expand Down
Loading