Skip to content

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

License

Notifications You must be signed in to change notification settings

GunnarPDX/Correlations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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]}

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages