ExPostFacto.InputData (ex_post_facto v0.2.1)

View Source

InputData a wrapper around the HLOC data that is passed into the backtest.

Summary

Functions

Creates a new! InputData struct.

Normalizes timestamp to a consistent format.

Functions

munge(data)

@spec munge(%{
  optional(:high) => float(),
  optional(:h) => float(),
  optional(:low) => float(),
  optional(:l) => float(),
  optional(:open) => float(),
  optional(:o) => float(),
  optional(:close) => float(),
  optional(:c) => float(),
  optional(:timestamp) => String.t() | DateTime.t(),
  optional(:t) => String.t() | DateTime.t(),
  optional(:volume) => float(),
  optional(:v) => float(),
  optional(:other) => any()
}) :: %ExPostFacto.InputData{
  close: term(),
  high: term(),
  low: term(),
  open: term(),
  other: term(),
  timestamp: term(),
  volume: term()
}

new!(arg1)

@spec new!(%{
  optional(:other) => any(),
  high: float(),
  low: float(),
  open: float(),
  close: float(),
  volume: float() | nil,
  timestamp: String.t() | DateTime.t() | nil
}) :: %ExPostFacto.InputData{
  close: term(),
  high: term(),
  low: term(),
  open: term(),
  other: term(),
  timestamp: term(),
  volume: term()
}

Creates a new! InputData struct.

normalize_timestamp(dt)

@spec normalize_timestamp(String.t() | DateTime.t() | nil) ::
  DateTime.t() | String.t() | nil

Normalizes timestamp to a consistent format.

Attempts to parse string timestamps into DateTime structs for better handling.