Giter VIP home page Giter VIP logo

ta-rs's Introduction

Technical Analysis for Rust (ta)

Build Status Crates.io Docs.rs License

Technical analysis library for Rust.

Getting started

Add to you Cargo.toml:

[dependencies]
ta = "0.4.0"

Example:

use ta::indicators::ExponentialMovingAverage;
use ta::Next;

// it can return an error, when an invalid length is passed (e.g. 0)
let mut ema = ExponentialMovingAverage::new(3).unwrap();

assert_eq!(ema.next(2.0), 2.0);
assert_eq!(ema.next(5.0), 3.5);
assert_eq!(ema.next(1.0), 2.25);
assert_eq!(ema.next(6.25), 4.25);

See more in the examples here. Check also the documentation.

Basic ideas

A data item which represent a stock quote may implement the following traits:

  • Open
  • High
  • Low
  • Close
  • Volume

It's not necessary to implement all of them, but it must be enough to fulfill requirements for a particular indicator. You probably should prefer using DataItem unless you have reasons to implement your own structure.

Indicators typically implement the following traits:

  • Next<T> (often Next<f64> and Next<&DataItem>) - to feed and get the next value
  • Reset - to reset an indicator
  • Debug
  • Display
  • Default
  • Clone

List of indicators

So far there are the following indicators available.

  • Trend
    • Exponential Moving Average (EMA)
    • Simple Moving Average (SMA)
  • Oscillators
    • Relative Strength Index (RSI)
    • Fast Stochastic
    • Slow Stochastic
    • Moving Average Convergence Divergence (MACD)
    • Percentage Price Oscillator (PPO)
    • Commodity Channel Index (CCI)
    • Money Flow Index (MFI)
  • Other
    • Minimum
    • Maximum
    • True Range
    • Standard Deviation (SD)
    • Mean Absolute Deviation (MAD)
    • Average True Range (AR)
    • Efficiency Ratio (ER)
    • Bollinger Bands (BB)
    • Chandelier Exit (CE)
    • Keltner Channel (KC)
    • Rate of Change (ROC)
    • On Balance Volume (OBV)

Features

  • serde - allows to serialize and deserialize indicators. NOTE: the backward compatibility of serialized data with the future versions of ta is not guaranteed because internal implementation of the indicators is a subject to change.

Running benchmarks

cargo bench

Donations

You can support the project by donating NEAR tokens.

Our NEAR wallet address is ta-rs.near

License

MIT © Sergey Potapov

Contributors

ta-rs's People

Contributors

greyblake avatar dgunay avatar bartossh avatar shreyasdeotare avatar edwardycl avatar rideron89 avatar tommady avatar discosultan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.