Ccxt.RawPayload (CCXT Elixir v0.1.0-binance-pro-preview)

Copy Markdown View Source

Raw payload retention helpers for CCXT Pro data.

The module creates database-facing attrs and insert plans for raw websocket events and websocket API responses. It does not write to a database and does not depend on Ecto.

Summary

Types

kind()

@type kind() :: :ws_event | :ws_api_response

opts()

@type opts() :: keyword() | map()

raw_attrs()

@type raw_attrs() :: map()

raw_plan()

@type raw_plan() :: %{
  kind: kind(),
  table: String.t(),
  operation: :insert,
  identity_fields: [atom()],
  fields: [atom()],
  conflict_target: [],
  update_fields: []
}

Functions

ecto_options(map)

@spec ecto_options(raw_plan()) :: keyword()

message_hash(payload)

@spec message_hash(term()) :: String.t()

normalize(kind, payload, opts \\ [])

@spec normalize(kind(), term(), opts()) :: {:ok, raw_attrs()}

normalize_structure_with_raw(structure, parsed_value, raw_payload, opts \\ [])

@spec normalize_structure_with_raw(
  Ccxt.StructureSchema.structure(),
  term(),
  term(),
  opts()
) ::
  {:ok,
   %{
     raw: raw_attrs(),
     raw_plan: raw_plan(),
     attrs: map() | [map()],
     plans: [Ccxt.StructurePersistence.plan()]
   }}
  | {:error, term()}

normalize_ws_api_response(payload, opts \\ [])

@spec normalize_ws_api_response(term(), opts()) :: {:ok, raw_attrs()}

normalize_ws_event(payload, opts \\ [])

@spec normalize_ws_event(term(), opts()) :: {:ok, raw_attrs()}

plan(kind)

@spec plan(kind()) :: {:ok, raw_plan()} | {:error, term()}

plan!(kind)

@spec plan!(kind()) :: raw_plan()