# ----------------------------------------------------------------------------- # 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 migration template # ----------------------------------------------------------------------------- defmodule Ccxt.Repo.Migrations.CreateBinanceProCcxtStructures do use Ecto.Migration def change do create table(:ccxt_tickers, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text, null: false add :timestamp, :bigint add :datetime, :utc_datetime_usec add :high, :decimal add :low, :decimal add :bid, :decimal add :bid_volume, :decimal add :ask, :decimal add :ask_volume, :decimal add :vwap, :decimal add :open, :decimal add :close, :decimal add :last, :decimal add :previous_close, :decimal add :change, :decimal add :percentage, :decimal add :average, :decimal add :base_volume, :decimal add :quote_volume, :decimal add :mark_price, :decimal add :index_price, :decimal add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_tickers, [:exchange_id]) create unique_index(:ccxt_tickers, [:exchange_id, :market_type, :symbol], name: :ccxt_tickers_exchange_id_market_type_symbol_idx) create table(:ccxt_ticker_events, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text, null: false add :timestamp, :bigint add :datetime, :utc_datetime_usec add :high, :decimal add :low, :decimal add :bid, :decimal add :bid_volume, :decimal add :ask, :decimal add :ask_volume, :decimal add :vwap, :decimal add :open, :decimal add :close, :decimal add :last, :decimal add :previous_close, :decimal add :change, :decimal add :percentage, :decimal add :average, :decimal add :base_volume, :decimal add :quote_volume, :decimal add :mark_price, :decimal add :index_price, :decimal add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_ticker_events, [:exchange_id]) create index(:ccxt_ticker_events, [:exchange_id, :market_type, :symbol], name: :ccxt_ticker_events_exchange_id_market_type_symbol_idx) create table(:ccxt_trades, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :ccxt_id, :text add :order, :text add :timestamp, :bigint add :datetime, :utc_datetime_usec add :symbol, :text, null: false add :type, :text add :side, :text add :taker_or_maker, :text add :price, :decimal add :amount, :decimal add :cost, :decimal add :fee, :map # jsonb payload add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_trades, [:exchange_id]) create index(:ccxt_trades, [:exchange_id, :market_type, :symbol, :ccxt_id], name: :ccxt_trades_exchange_id_market_type_symbol_ccxt_id_idx) create table(:ccxt_order_books, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text, null: false add :bids, :map, null: false # jsonb payload add :asks, :map, null: false # jsonb payload add :timestamp, :bigint add :datetime, :utc_datetime_usec add :nonce, :bigint add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_order_books, [:exchange_id]) create unique_index(:ccxt_order_books, [:exchange_id, :market_type, :symbol], name: :ccxt_order_books_exchange_id_market_type_symbol_idx) create table(:ccxt_order_book_events, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text, null: false add :bids, :map, null: false # jsonb payload add :asks, :map, null: false # jsonb payload add :timestamp, :bigint add :datetime, :utc_datetime_usec add :nonce, :bigint add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_order_book_events, [:exchange_id]) create index(:ccxt_order_book_events, [:exchange_id, :market_type, :symbol], name: :ccxt_order_book_events_exchange_id_market_type_symbol_idx) create table(:ccxt_ohlcvs, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text add :timeframe, :text, null: false add :timestamp, :bigint, null: false add :open, :decimal add :high, :decimal add :low, :decimal add :close, :decimal add :volume, :decimal timestamps(type: :utc_datetime_usec) end create index(:ccxt_ohlcvs, [:exchange_id]) create index(:ccxt_ohlcvs, [:exchange_id, :market_type, :symbol, :timeframe, :timestamp], name: :ccxt_ohlcvs_exchange_id_market_type_symbol_timefra_idx_64dcd191) create table(:ccxt_balances, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text add :currency, :text, null: false add :free, :decimal add :used, :decimal add :total, :decimal timestamps(type: :utc_datetime_usec) end create index(:ccxt_balances, [:exchange_id]) create unique_index(:ccxt_balances, [:exchange_id, :account_type, :currency], name: :ccxt_balances_exchange_id_account_type_currency_idx) create table(:ccxt_balance_events, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text add :currency, :text, null: false add :free, :decimal add :used, :decimal add :total, :decimal timestamps(type: :utc_datetime_usec) end create index(:ccxt_balance_events, [:exchange_id]) create index(:ccxt_balance_events, [:exchange_id, :account_type, :currency], name: :ccxt_balance_events_exchange_id_account_type_currency_idx) create table(:ccxt_orders, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :ccxt_id, :text add :client_order_id, :text add :timestamp, :bigint add :datetime, :utc_datetime_usec add :last_trade_timestamp, :bigint add :symbol, :text, null: false add :type, :text add :time_in_force, :text add :side, :text add :price, :decimal add :amount, :decimal add :filled, :decimal add :remaining, :decimal add :cost, :decimal add :average, :decimal add :status, :text add :fee, :map # jsonb payload add :trades, :map # jsonb payload add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_orders, [:exchange_id]) create unique_index(:ccxt_orders, [:exchange_id, :market_type, :symbol, :ccxt_id], name: :ccxt_orders_exchange_id_market_type_symbol_ccxt_id_idx) create table(:ccxt_order_events, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :ccxt_id, :text add :client_order_id, :text add :timestamp, :bigint add :datetime, :utc_datetime_usec add :last_trade_timestamp, :bigint add :symbol, :text, null: false add :type, :text add :time_in_force, :text add :side, :text add :price, :decimal add :amount, :decimal add :filled, :decimal add :remaining, :decimal add :cost, :decimal add :average, :decimal add :status, :text add :fee, :map # jsonb payload add :trades, :map # jsonb payload add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_order_events, [:exchange_id]) create index(:ccxt_order_events, [:exchange_id, :market_type, :symbol, :ccxt_id], name: :ccxt_order_events_exchange_id_market_type_symbol_ccxt_id_idx) create table(:ccxt_positions, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text, null: false add :timestamp, :bigint add :datetime, :utc_datetime_usec add :contracts, :decimal add :contract_size, :decimal add :entry_price, :decimal add :unrealized_pnl, :decimal add :side, :text add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_positions, [:exchange_id]) create unique_index(:ccxt_positions, [:exchange_id, :market_type, :symbol, :side], name: :ccxt_positions_exchange_id_market_type_symbol_side_idx) create table(:ccxt_position_events, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text, null: false add :timestamp, :bigint add :datetime, :utc_datetime_usec add :contracts, :decimal add :contract_size, :decimal add :entry_price, :decimal add :unrealized_pnl, :decimal add :side, :text add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_position_events, [:exchange_id]) create index(:ccxt_position_events, [:exchange_id, :market_type, :symbol, :side], name: :ccxt_position_events_exchange_id_market_type_symbol_side_idx) create table(:ccxt_liquidations, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :market_type, :text add :account_type, :text add :raw_ref_id, :binary_id add :symbol, :text, null: false add :contracts, :decimal add :price, :decimal add :side, :text add :timestamp, :bigint add :datetime, :utc_datetime_usec add :info, :map, null: false # jsonb payload timestamps(type: :utc_datetime_usec) end create index(:ccxt_liquidations, [:exchange_id]) create index(:ccxt_liquidations, [:exchange_id, :market_type, :symbol, :timestamp], name: :ccxt_liquidations_exchange_id_market_type_symbol_timestamp_idx) create table(:ccxt_raw_ws_events, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :env, :text add :market_type, :text add :account_type, :text add :transport, :text, null: false add :channel, :text add :stream, :text add :request_id, :text add :message_hash, :text, null: false add :url, :text add :payload, :map, null: false # jsonb payload add :received_at, :utc_datetime_usec, null: false timestamps(type: :utc_datetime_usec) end create index(:ccxt_raw_ws_events, [:exchange_id]) create index(:ccxt_raw_ws_events, [:message_hash]) create index(:ccxt_raw_ws_events, [:stream]) create table(:ccxt_raw_ws_api_responses, primary_key: false) do add :id, :binary_id, primary_key: true add :exchange_id, :text, null: false add :env, :text add :market_type, :text add :account_type, :text add :transport, :text, null: false add :channel, :text add :stream, :text add :request_id, :text add :message_hash, :text, null: false add :url, :text add :payload, :map, null: false # jsonb payload add :received_at, :utc_datetime_usec, null: false timestamps(type: :utc_datetime_usec) end create index(:ccxt_raw_ws_api_responses, [:exchange_id]) create index(:ccxt_raw_ws_api_responses, [:message_hash]) create index(:ccxt_raw_ws_api_responses, [:stream]) end end