Coder Social home page Coder Social logo

gunnarpdx / correlations Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 0.0 79 KB

๐Ÿ“Š A financial correlations library for Elixir, fully compatible with the elixir Decimal library.

License: MIT License

Elixir 100.00%
correlation-matrix sharpe-ratio sortino portfolio-correlation portfolio-deviation

correlations's Introduction

MIT License Hex.pm Version

Correlations

A financial correlations library for elixir, fully compatible with the elixir Decimal library.

correlation matrix img

Example frontend usage

https://github.com/GunnarPDX/Nice-Charts

Installation

This package can be installed by adding correlations to your list of dependencies in mix.exs:

def deps do
  [
    {:correlations, "~> 0.1.1"},
  ]
end

Docs

Functions

  • portfolio_correlations_picker(stocks, portfolio_size)

  • portfolio_correlations_list(stocks, portfolio_size)

  • correlation_matrix(stocks)

  • json_correlation_matrix(stocks)

  • correlation(x, y)

Usage

iex> alias Correlations, as: C

iex> stocks = [
    aapl: [124.400002, 121.099998, 121.190002, 120.709999, 119.019997],
    nvda: [569.039978, 569.929993, 563.809998, 558.799988, 552.460022],
    tsla: [442.299988, 446.649994, 461.299988, 448.880005, 439.670013],
    amzn: [3442.929932, 3443.629883, 3363.709961, 3338.649902, 3272.709961]
  ]

iex> decimal_stocks = for {k, v} <- stocks, do: {k, decimalize(v)}

iex> C.portfolio_correlations_picker(decimal_stocks, 2)
{Decimal<0.104192125>, [:aapl, :tsla]}

correlations's People

Contributors

gunnarpdx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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