wuhkuh / talib Goto Github PK
View Code? Open in Web Editor NEWTechnical Analysis Library written in Elixir
License: MIT License
Technical Analysis Library written in Elixir
License: MIT License
When calculating the SMA of index 6 with period 5, it includes index 1, as the sum is inclusive.
However, it should only calculate with indexes 2, 3, 4, 5 and 6.
Solution:
Formula underneath the sum should be k = i - p + 1
Problem:
A BadPeriodError
is raised (or the corresponding tuple returned) when the period is 0, but not when the period is negative or even a floating-point number.
When porting to C, this could lead to unwanted behavior when typecasting floats to integers. However, I'm not sure how the GMP library handles this case.
It should be resolved nevertheless; from a user's perspective this is unwanted behavior.
Solution:
Periods should come in the form of a non-zero unsigned integer. Anything else should raise a BadPeriodError
, or return {:error, :bad_period}
.
IOlists could drastically improve speeds as we don't have to append proper lists and reverse these anymore.
Prepending works with O(1) speeds instead of O(n) when using IOlists.
Sources:
https://elixirforum.com/t/what-is-a-proper-list/1400/21
https://elixirforum.com/t/efficiency-of-io-lists-in-elixir-erlang/4173/6
These should be added to the functions, for compatibility with Dialyzer / Dialyxir.
The module Talib.MovingAverage is references throughout the codebase, but is not implemented anywhere
As I've been working with Nil and propagating these across functions, the question whether or not to use NaN for these signalling purposes arose.
So currently when there's not enough data, Nil is passed as a result, as every input value should have an output value, which is by design.
Considerations:
The TA-Lib C library uses NaN as well when missing data.
The problem with NaN is that the exact reason why NaN is returned is not clear - did we divide zero by zero? Even more important, it doesn't handle comparisons very well.
We only have to pass the information that there's no output data as there's not enough input data. R handles this using NA (Not Available).
If necessary, we could use a new atom representing this.
Sources:
https://blog.metawrap.com/2005/09/11/null-undefined-and-nan
https://blogs.janestreet.com/making-something-out-of-nothing-or-why-none-is-better-than-nan-and-null/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.