View Source ExFinancialModelingPrep.Helpers (ex_financial_modeling_prep v0.1.1)

Assist with assigning and defining type

Link to this section Summary

Functions

DO NOT USE: Creates a struct file in root directory for ease of development and speeding up process. Should be yetted after project is completed.

Informs string type :date, :date_time, :string

Helper to quickly define types

Parses Binary string to appropriate type

Helper function to convert a map into specified defstruct when parsing through HTTP response with defined structs

Link to this section Functions

Link to this function

create_struct_file(item, module_name)

View Source

DO NOT USE: Creates a struct file in root directory for ease of development and speeding up process. Should be yetted after project is completed.

@spec define_string(binary()) :: :date | :date_time | :string | float() | integer()

Informs string type :date, :date_time, :string

@spec define_struct(map()) :: list()

Helper to quickly define types

@spec parse_binary(binary()) ::
  String.t() | DateTime.t() | Date.t() | float() | integer()

Parses Binary string to appropriate type

examples

Examples

iex> ExFinancialModelingPrep.Helpers.parse_binary("2022-10-31")
~D[2022-10-31]

iex> ExFinancialModelingPrep.Helpers.parse_binary("2022-10-27 18:01:14")
~U[2022-10-27 18:01:14Z]

iex> ExFinancialModelingPrep.Helpers.parse_binary("AAPL")
"AAPL"
Link to this function

resource_to_struct(resource, struct)

View Source
@spec resource_to_struct(map(), any()) :: %{
  :__struct__ => any(),
  optional(any()) => any()
}

Helper function to convert a map into specified defstruct when parsing through HTTP response with defined structs