Skip to main content

priv/ccxt_structures/generated/binance_pro_ecto_schemas.exs

# -----------------------------------------------------------------------------
# This file is generated from priv/ccxt_structures/binance_pro_structures.json.
# Do not edit it by hand; run `npm run generateElixirStructureSchemas` instead.
# Generated artifact: Ecto schema templates
# -----------------------------------------------------------------------------
defmodule Ccxt.Structures.BinancePro.Ticker do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :timestamp,
    :datetime,
    :high,
    :low,
    :bid,
    :bid_volume,
    :ask,
    :ask_volume,
    :vwap,
    :open,
    :close,
    :last,
    :previous_close,
    :change,
    :percentage,
    :average,
    :base_volume,
    :quote_volume,
    :mark_price,
    :index_price,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :info
  ]

  schema "ccxt_tickers" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :high, :decimal
    field :low, :decimal
    field :bid, :decimal
    field :bid_volume, :decimal
    field :ask, :decimal
    field :ask_volume, :decimal
    field :vwap, :decimal
    field :open, :decimal
    field :close, :decimal
    field :last, :decimal
    field :previous_close, :decimal
    field :change, :decimal
    field :percentage, :decimal
    field :average, :decimal
    field :base_volume, :decimal
    field :quote_volume, :decimal
    field :mark_price, :decimal
    field :index_price, :decimal
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.TickerEvent do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :timestamp,
    :datetime,
    :high,
    :low,
    :bid,
    :bid_volume,
    :ask,
    :ask_volume,
    :vwap,
    :open,
    :close,
    :last,
    :previous_close,
    :change,
    :percentage,
    :average,
    :base_volume,
    :quote_volume,
    :mark_price,
    :index_price,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :info
  ]

  schema "ccxt_ticker_events" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :high, :decimal
    field :low, :decimal
    field :bid, :decimal
    field :bid_volume, :decimal
    field :ask, :decimal
    field :ask_volume, :decimal
    field :vwap, :decimal
    field :open, :decimal
    field :close, :decimal
    field :last, :decimal
    field :previous_close, :decimal
    field :change, :decimal
    field :percentage, :decimal
    field :average, :decimal
    field :base_volume, :decimal
    field :quote_volume, :decimal
    field :mark_price, :decimal
    field :index_price, :decimal
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.Trade do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :ccxt_id,
    :order,
    :timestamp,
    :datetime,
    :symbol,
    :type,
    :side,
    :taker_or_maker,
    :price,
    :amount,
    :cost,
    :fee,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :info
  ]

  schema "ccxt_trades" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :ccxt_id, :string
    field :order, :string
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :symbol, :string
    field :type, :string
    field :side, :string
    field :taker_or_maker, :string
    field :price, :decimal
    field :amount, :decimal
    field :cost, :decimal
    field :fee, :map # jsonb payload
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.OrderBook do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :bids,
    :asks,
    :timestamp,
    :datetime,
    :nonce,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :bids,
    :asks,
    :info
  ]

  schema "ccxt_order_books" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :bids, :map # jsonb payload
    field :asks, :map # jsonb payload
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :nonce, :integer
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.OrderBookEvent do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :bids,
    :asks,
    :timestamp,
    :datetime,
    :nonce,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :bids,
    :asks,
    :info
  ]

  schema "ccxt_order_book_events" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :bids, :map # jsonb payload
    field :asks, :map # jsonb payload
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :nonce, :integer
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.Ohlcv do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :timeframe,
    :timestamp,
    :open,
    :high,
    :low,
    :close,
    :volume
  ]
  @required_fields [
    :exchange_id,
    :timeframe,
    :timestamp
  ]

  schema "ccxt_ohlcvs" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :timeframe, :string
    field :timestamp, :integer
    field :open, :decimal
    field :high, :decimal
    field :low, :decimal
    field :close, :decimal
    field :volume, :decimal

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.Balance do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :currency,
    :free,
    :used,
    :total
  ]
  @required_fields [
    :exchange_id,
    :currency
  ]

  schema "ccxt_balances" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :currency, :string
    field :free, :decimal
    field :used, :decimal
    field :total, :decimal

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.BalanceEvent do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :currency,
    :free,
    :used,
    :total
  ]
  @required_fields [
    :exchange_id,
    :currency
  ]

  schema "ccxt_balance_events" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :currency, :string
    field :free, :decimal
    field :used, :decimal
    field :total, :decimal

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.Order do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :ccxt_id,
    :client_order_id,
    :timestamp,
    :datetime,
    :last_trade_timestamp,
    :symbol,
    :type,
    :time_in_force,
    :side,
    :price,
    :amount,
    :filled,
    :remaining,
    :cost,
    :average,
    :status,
    :fee,
    :trades,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :info
  ]

  schema "ccxt_orders" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :ccxt_id, :string
    field :client_order_id, :string
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :last_trade_timestamp, :integer
    field :symbol, :string
    field :type, :string
    field :time_in_force, :string
    field :side, :string
    field :price, :decimal
    field :amount, :decimal
    field :filled, :decimal
    field :remaining, :decimal
    field :cost, :decimal
    field :average, :decimal
    field :status, :string
    field :fee, :map # jsonb payload
    field :trades, :map # jsonb payload
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.OrderEvent do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :ccxt_id,
    :client_order_id,
    :timestamp,
    :datetime,
    :last_trade_timestamp,
    :symbol,
    :type,
    :time_in_force,
    :side,
    :price,
    :amount,
    :filled,
    :remaining,
    :cost,
    :average,
    :status,
    :fee,
    :trades,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :info
  ]

  schema "ccxt_order_events" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :ccxt_id, :string
    field :client_order_id, :string
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :last_trade_timestamp, :integer
    field :symbol, :string
    field :type, :string
    field :time_in_force, :string
    field :side, :string
    field :price, :decimal
    field :amount, :decimal
    field :filled, :decimal
    field :remaining, :decimal
    field :cost, :decimal
    field :average, :decimal
    field :status, :string
    field :fee, :map # jsonb payload
    field :trades, :map # jsonb payload
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.Position do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :timestamp,
    :datetime,
    :contracts,
    :contract_size,
    :entry_price,
    :unrealized_pnl,
    :side,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :info
  ]

  schema "ccxt_positions" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :contracts, :decimal
    field :contract_size, :decimal
    field :entry_price, :decimal
    field :unrealized_pnl, :decimal
    field :side, :string
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.PositionEvent do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :timestamp,
    :datetime,
    :contracts,
    :contract_size,
    :entry_price,
    :unrealized_pnl,
    :side,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :info
  ]

  schema "ccxt_position_events" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :contracts, :decimal
    field :contract_size, :decimal
    field :entry_price, :decimal
    field :unrealized_pnl, :decimal
    field :side, :string
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.Liquidation do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  @fields [
    :exchange_id,
    :market_type,
    :account_type,
    :raw_ref_id,
    :symbol,
    :contracts,
    :price,
    :side,
    :timestamp,
    :datetime,
    :info
  ]
  @required_fields [
    :exchange_id,
    :symbol,
    :info
  ]

  schema "ccxt_liquidations" do
    field :exchange_id, :string
    field :market_type, :string
    field :account_type, :string
    field :raw_ref_id, :binary_id
    field :symbol, :string
    field :contracts, :decimal
    field :price, :decimal
    field :side, :string
    field :timestamp, :integer
    field :datetime, :utc_datetime_usec
    field :info, :map # jsonb payload

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.RawWsEvent do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key false
  @foreign_key_type :binary_id
  @fields [
    :id,
    :exchange_id,
    :env,
    :market_type,
    :account_type,
    :transport,
    :channel,
    :stream,
    :request_id,
    :message_hash,
    :url,
    :payload,
    :received_at
  ]
  @required_fields [
    :id,
    :exchange_id,
    :transport,
    :message_hash,
    :payload,
    :received_at
  ]

  schema "ccxt_raw_ws_events" do
    field :id, :binary_id, primary_key: true
    field :exchange_id, :string
    field :env, :string
    field :market_type, :string
    field :account_type, :string
    field :transport, :string
    field :channel, :string
    field :stream, :string
    field :request_id, :string
    field :message_hash, :string
    field :url, :string
    field :payload, :map # jsonb payload
    field :received_at, :utc_datetime_usec

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end

defmodule Ccxt.Structures.BinancePro.RawWsApiResponse do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key false
  @foreign_key_type :binary_id
  @fields [
    :id,
    :exchange_id,
    :env,
    :market_type,
    :account_type,
    :transport,
    :channel,
    :stream,
    :request_id,
    :message_hash,
    :url,
    :payload,
    :received_at
  ]
  @required_fields [
    :id,
    :exchange_id,
    :transport,
    :message_hash,
    :payload,
    :received_at
  ]

  schema "ccxt_raw_ws_api_responses" do
    field :id, :binary_id, primary_key: true
    field :exchange_id, :string
    field :env, :string
    field :market_type, :string
    field :account_type, :string
    field :transport, :string
    field :channel, :string
    field :stream, :string
    field :request_id, :string
    field :message_hash, :string
    field :url, :string
    field :payload, :map # jsonb payload
    field :received_at, :utc_datetime_usec

    timestamps(type: :utc_datetime_usec)
  end

  def changeset(struct, attrs) do
    struct
    |> cast(attrs, @fields)
    |> validate_required(@required_fields)
  end
end