# BitMart Exchange Specification # # Auto-generated by: mix ccxt.extract bitmart # CCXT version: 4.5.34 # Spec format version: 1 # # Review before use: # - signing: Detected from sign() method, verify with testnet # - endpoints: Raw paths extracted, map to unified API as needed # - exceptions: Extracted (exact, broad, HTTP status codes) # - features/options: Extracted from describe() # - classification: Set to :supported initially, promote after validation # %{ api_param_requirements: nil, certified: true, classification: :certified_pro, comment: nil, countries: [ "US", "CN", "HK", "KR" ], currencies: %{}, currency_aliases: %{ "$GM" => "GOLDMINER", "$HERO" => "Step Hero", "$PAC" => "PAC", "BCHSV" => "BSV", "BP" => "BEYOND", "GDT" => "Gorilla Diamond", "GLD" => "Goldario", "MVP" => "MVP Coin", "TRU" => "Truebit", "XBT" => "BTC" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 56, "coveragePercent" => 100, "enabledMethods" => 57, "excluded" => [ %{ "method" => "editOrder", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 1, "extractableMethods" => 56, "failures" => [] }, endpoints: [ %{ api_section: "private", auth: true, cost: 30, market_type: :spot, method: :post, name: :borrow_isolated_margin, param_mappings: %{ "code" => "currency" }, params: [ :symbol, :code, :amount ], path: "/spot/v1/margin/isolated/borrow", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 90, market_type: :spot, method: :post, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/spot/v4/cancel_all", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :cancel_order, param_mappings: %{ "id" => "order_id" }, params: [ :id, :symbol ], path: "/spot/v3/cancel_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 3, default_params: %{ "orderIds" => [ "test-order-id" ] }, market_type: :spot, method: :post, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/spot/v4/cancel_orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "type" => "limit" }, market_type: :spot, method: :post, name: :create_limit_order, param_mappings: %{ "amount" => "size" }, params: [ :symbol, :side, :amount, :price ], path: "/spot/v2/submit_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "side" => "buy", "type" => "market" }, market_type: :spot, method: :post, name: :create_market_buy_order_with_cost, param_mappings: %{ "cost" => "notional" }, params: [ :symbol, :cost ], path: "/spot/v2/submit_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "notional" => "0", "type" => "market" }, market_type: :spot, method: :post, name: :create_market_order, param_mappings: %{}, params: [ :symbol, :side, :amount, :price ], path: "/spot/v2/submit_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :create_order, param_mappings: %{ "amount" => "size" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/spot/v2/submit_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 3, default_params: %{ "orderParams" => [ %{ "price" => "50000", "side" => "buy", "size" => "0.001", "type" => "limit" } ], "symbol" => "BTCUSDT" }, market_type: :spot, method: :post, name: :create_orders, param_mappings: %{}, params: [ :orders ], path: "/spot/v4/batch_orders", response_transformer: {:extract_path, ["data", "data", "orderIds"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "type" => "limit_maker" }, market_type: :spot, method: :post, name: :create_post_only_order, param_mappings: %{ "amount" => "size" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/spot/v2/submit_order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "open_type" => "cross", "side" => 2, "size" => 0, "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :create_reduce_only_order, param_mappings: %{ "amount" => "size" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/contract/private/submit-order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "open_type" => "cross", "size" => 0, "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :create_trailing_percent_order, param_mappings: %{ "amount" => "size", "trailingPercent" => "side" }, params: [ :symbol, :type, :side, :amount, :price, :trailingPercent, :trailingTriggerPrice ], path: "/contract/private/submit-order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/spot/v1/wallet", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_borrow_interest, param_mappings: %{}, params: [ :code, :symbol, :since, :limit ], path: "/spot/v1/margin/isolated/borrow_record", response_transformer: {:extract_path, ["data", "records"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "N" => 100, "offset" => 1, "status" => 8 }, market_type: :spot, method: :get, name: :fetch_canceled_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/spot/v3/orders", response_transformer: {:extract_path, ["data", "orders"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :post, name: :fetch_closed_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/spot/v4/query/history-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 30, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/account/v1/currencies", response_transformer: {:extract_path, ["data", "currencies"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 7.5, market_type: :spot, method: :get, name: :fetch_deposit, param_mappings: %{ "arg0" => "id" }, params: [], path: "/account/v1/deposit-withdraw/detail", response_transformer: {:extract_path, ["data", "record"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 30, market_type: :spot, method: :get, name: :fetch_deposit_address, param_mappings: %{ "code" => "currency" }, params: [ :code ], path: "/account/v1/deposit/address", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 32, market_type: :spot, method: :get, name: :fetch_deposit_withdraw_fee, param_mappings: %{ "code" => "currency" }, params: [ :code ], path: "/account/v1/withdraw/charge", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 7.5, default_params: %{ "N" => 1000, "operation_type" => "deposit" }, market_type: :spot, method: :get, name: :fetch_deposits, param_mappings: %{ "code" => "currency" }, params: [ :code, :since, :limit ], path: "/account/v2/deposit-withdraw/history", response_transformer: {:extract_path, ["data", "records"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, default_params: %{ "flow_type" => 3, "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/contract/private/transaction-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 30, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_rate, param_mappings: %{}, params: [ :symbol ], path: "/contract/public/funding-rate", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 30, market_type: :spot, method: :get, name: :fetch_isolated_borrow_rate, param_mappings: %{}, params: [ :symbol ], path: "/spot/v1/margin/isolated/pairs", response_transformer: {:extract_path_unwrap, ["data", "symbols"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 30, market_type: :spot, method: :get, name: :fetch_isolated_borrow_rates, param_mappings: %{}, params: [], path: "/spot/v1/margin/isolated/pairs", response_transformer: {:extract_path, ["data", "symbols"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 4, market_type: :spot, method: :get, name: :fetch_l2_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/spot/quotation/v3/books", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, default_params: %{ "flow_type" => 0 }, market_type: :spot, method: :get, name: :fetch_ledger, param_mappings: %{}, params: [ :code, :since, :limit ], path: "/contract/private/transaction-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, default_params: %{ "end_time" => 1771639418, "start_time" => 1771609418, "step" => 1, "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_mark_ohlcv, param_mappings: %{}, params: [ :symbol, :timeframe, :since, :limit ], path: "/contract/public/markprice-kline", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 5, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/spot/v1/symbols/details", response_transformer: {:extract_path, ["data", "symbols"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_my_liquidations, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/contract/private/order-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, default_params: %{ "limit" => 200 }, market_type: :spot, method: :post, name: :fetch_my_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/spot/v4/query/trades", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 7, default_params: %{ "after" => 1704067199, "step" => 60 }, market_type: :spot, method: :get, name: :fetch_ohlcv, param_mappings: %{}, params: [ :symbol, :timeframe, :since, :limit ], path: "/spot/quotation/v3/klines", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 30, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_open_interest, param_mappings: %{}, params: [ :symbol ], path: "/contract/public/open-interest", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :post, name: :fetch_open_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/spot/v4/query/open-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :fetch_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/spot/v4/query/order", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 4, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/spot/quotation/v3/books", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 5, market_type: :spot, method: :post, name: :fetch_order_trades, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol, :since, :limit ], path: "/spot/v4/query/order-trades", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_position, param_mappings: %{}, params: [ :symbol ], path: "/contract/private/position", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_position_mode, param_mappings: %{}, params: [ :symbol ], path: "/contract/private/get-position-mode", response_transformer: {:extract_path, ["data", "position_mode"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 10, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/contract/private/position-v2", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 3, market_type: :spot, method: :get, name: :fetch_status, param_mappings: %{}, params: [], path: "/system/service", response_transformer: {:extract_path, ["data", "service"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 4, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{}, params: [ :symbol ], path: "/spot/quotation/v3/ticker", response_transformer: {:extract_path_unwrap, ["data", "symbols"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 6, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/spot/quotation/v3/tickers", response_transformer: {:extract_path, ["data", "symbols"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 3, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/system/time", response_transformer: {:extract_path, ["data", "server_time"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 4, market_type: :spot, method: :get, name: :fetch_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/spot/quotation/v3/trades", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 30, market_type: :spot, method: :get, name: :fetch_trading_fee, param_mappings: %{}, params: [ :symbol ], path: "/spot/v1/trade_fee", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 32, market_type: :spot, method: :get, name: :fetch_transaction_fee, param_mappings: %{ "code" => "currency" }, params: [ :code ], path: "/account/v1/withdraw/charge", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 60, default_params: %{ "limit" => 10, "page" => 1 }, market_type: :spot, method: :post, name: :fetch_transfers, param_mappings: %{ "code" => "currency" }, params: [ :code, :since, :limit ], path: "/account/v1/transfer-contract-list", response_transformer: {:extract_path, ["data", "records"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 30, market_type: :spot, method: :get, name: :fetch_withdraw_addresses, param_mappings: %{}, params: [], path: "/account/v1/withdraw/address/list", response_transformer: {:extract_path, ["data", "list"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 7.5, market_type: :spot, method: :get, name: :fetch_withdrawal, param_mappings: %{ "arg0" => "id" }, params: [], path: "/account/v1/deposit-withdraw/detail", response_transformer: {:extract_path, ["data", "record"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 7.5, default_params: %{ "N" => 1000, "operation_type" => "withdraw" }, market_type: :spot, method: :get, name: :fetch_withdrawals, param_mappings: %{ "code" => "currency" }, params: [ :code, :since, :limit ], path: "/account/v2/deposit-withdraw/history", response_transformer: {:extract_path, ["data", "records"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 30, market_type: :spot, method: :post, name: :repay_isolated_margin, param_mappings: %{ "code" => "currency" }, params: [ :symbol, :code, :amount ], path: "/spot/v1/margin/isolated/repay", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2.5, default_params: %{ "open_type" => "isolated", "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{}, params: [ :leverage, :symbol ], path: "/contract/private/submit-leverage", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "position_mode" => "hedge_mode" }, market_type: :swap, method: :post, name: :set_position_mode, param_mappings: %{}, params: [ :hedged, :symbol ], path: "/contract/private/set-position-mode", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 60, default_params: %{ "type" => "spot_to_contract" }, market_type: :spot, method: :post, name: :transfer, param_mappings: %{ "code" => "currency" }, params: [ :code, :amount, :fromAccount, :toAccount ], path: "/account/v1/transfer-contract", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 7.5, default_params: %{ "destination" => "To Digital Address" }, market_type: :spot, method: :post, name: :withdraw, param_mappings: %{ "code" => "currency" }, params: [ :code, :amount, :address, :tag ], path: "/account/v1/withdraw/apply", response_transformer: {:extract_path, ["data"]}, source: :intercepted } ], error_code_details: %{ 30000 => %{ description: "404, Not found", type: :exchange_error }, 30001 => %{ description: "401, Header X-BM-KEY is empty", type: :invalid_credentials }, 30002 => %{ description: "401, Header X-BM-KEY not found", type: :invalid_credentials }, 30003 => %{ description: "401, Header X-BM-KEY has frozen", type: :access_restricted }, 30004 => %{ description: "401, Header X-BM-SIGN is empty", type: :invalid_credentials }, 30005 => %{ description: "401, Header X-BM-SIGN is wrong", type: :invalid_credentials }, 30006 => %{ description: "401, Header X-BM-TIMESTAMP is empty", type: :invalid_credentials }, 30007 => %{ description: "401, Header X-BM-TIMESTAMP range. Within a minute", type: :invalid_credentials }, 30008 => %{ description: "401, Header X-BM-TIMESTAMP invalid format", type: :invalid_credentials }, 30010 => %{ description: "403, IP is forbidden. We recommend enabling IP whitelist for API trading. After that reauth your account", type: :access_restricted }, 30011 => %{ description: "403, Header X-BM-KEY over expire time", type: :invalid_credentials }, 30012 => %{ description: "403, Header X-BM-KEY is forbidden to request it", type: :invalid_credentials }, 30013 => %{ description: "429, Request too many requests", type: :rate_limited }, 30014 => %{ description: "503, Service unavailable", type: :network_error }, 30016 => %{ description: "200, Service maintenance, the function is temporarily unavailable", type: :network_error }, 30017 => %{ description: "418, Your account request is temporarily rejected due to violation of current limiting rules", type: :rate_limited }, 30018 => %{ description: "503, Request Body requires JSON format", type: :invalid_parameters }, 30019 => %{ description: "200, You do not have the permissions to perform this operation", type: :access_restricted }, 40001 => %{ description: "400, Cloud account not found", type: :exchange_error }, 40002 => %{ description: "400, out_trade_no not found", type: :exchange_error }, 40003 => %{ description: "400, out_trade_no already existed", type: :exchange_error }, 40004 => %{ description: "400, Cloud account count limit", type: :exchange_error }, 40005 => %{ description: "400, Transfer vol precision error", type: :exchange_error }, 40006 => %{ description: "400, Invalid ip error", type: :access_restricted }, 40007 => %{ description: "400, Parse parameter error", type: :invalid_parameters }, 40008 => %{ description: "400, Check nonce error", type: :invalid_credentials }, 40009 => %{ description: "400, Check ver error", type: :invalid_parameters }, 40010 => %{ description: "400, Not found func error", type: :invalid_parameters }, 40011 => %{ description: "400, Invalid request", type: :invalid_parameters }, 40012 => %{ description: "500, System error", type: :exchange_error }, 40013 => %{ description: "400, Access too often\" CLIENT_TIME_INVALID, \"Please check your system time.", type: :exchange_error }, 40014 => %{ description: "400, This contract is offline", type: :invalid_order }, 40015 => %{ description: "400, This contract's exchange has been paused", type: :invalid_order }, 40016 => %{ description: "400, This order would trigger user position liquidate", type: :invalid_order }, 40017 => %{ description: "400, It is not possible to open and close simultaneously in the same position", type: :invalid_order }, 40018 => %{ description: "400, Your position is closed", type: :invalid_order }, 40019 => %{ description: "400, Your position is in liquidation delegating", type: :exchange_error }, 40020 => %{ description: "400, Your position volume is not enough", type: :invalid_order }, 40021 => %{ description: "400, The position is not exsit", type: :exchange_error }, 40022 => %{ description: "400, The position is not isolated", type: :exchange_error }, 40023 => %{ description: "400, The position would liquidate when sub margin", type: :exchange_error }, 40024 => %{ description: "400, The position would be warnning of liquidation when sub margin", type: :exchange_error }, 40025 => %{ description: "400, The position’s margin shouldn’t be lower than the base limit", type: :exchange_error }, 40026 => %{ description: "400, You cross margin position is in liquidation delegating", type: :exchange_error }, 40027 => %{ description: "400, You contract account available balance not enough", type: :insufficient_balance }, 40028 => %{ description: "400, Your plan order's count is more than system maximum limit.", type: :access_restricted }, 40029 => %{ description: "400, The order's leverage is too large.", type: :invalid_order }, 40030 => %{ description: "400, The order's leverage is too small.", type: :invalid_order }, 40031 => %{ description: "400, The deviation between current price and trigger price is too large.", type: :invalid_order }, 40032 => %{ description: "400, The plan order's life cycle is too long.", type: :invalid_order }, 40033 => %{ description: "400, The plan order's life cycle is too short.", type: :invalid_order }, 40034 => %{ description: "400, This contract is not found", type: :invalid_order }, 40035 => %{ description: "400, The order is not exist", type: :order_not_found }, 40036 => %{ description: "400, The order status is invalid", type: :invalid_order }, 40037 => %{ description: "400, The order id is not exist", type: :order_not_found }, 40038 => %{ description: "400, The k-line step is invalid", type: :invalid_parameters }, 40039 => %{ description: "400, The timestamp is invalid", type: :invalid_parameters }, 40040 => %{ description: "400, The order leverage is invalid", type: :invalid_order }, 40041 => %{ description: "400, The order side is invalid", type: :invalid_order }, 40042 => %{ description: "400, The order type is invalid", type: :invalid_order }, 40043 => %{ description: "400, The order precision is invalid", type: :invalid_order }, 40044 => %{ description: "400, The order range is invalid", type: :invalid_order }, 40045 => %{ description: "400, The order open type is invalid", type: :invalid_order }, 40046 => %{ description: "403, The account is not opened futures", type: :access_restricted }, 40047 => %{ description: "403, Services is not available in you countries and areas", type: :access_restricted }, 40048 => %{ description: "403, ClientOrderId only allows a combination of numbers and letters", type: :invalid_order }, 40049 => %{ description: "403, The maximum length of clientOrderId cannot exceed 32", type: :invalid_order }, 40050 => %{ description: "403, Client OrderId duplicated with existing orders", type: :invalid_order }, 50000 => %{ description: "400, Bad Request", type: :invalid_parameters }, 50001 => %{ description: "400, Symbol not found", type: :invalid_order }, 50002 => %{ description: "400, From Or To format error", type: :invalid_parameters }, 50003 => %{ description: "400, Step format error", type: :invalid_parameters }, 50004 => %{ description: "400, Kline size over 500", type: :invalid_parameters }, 50005 => %{ description: "400, Order Id not found", type: :order_not_found }, 50006 => %{ description: "400, Minimum size is %s", type: :invalid_order }, 50007 => %{ description: "400, Maximum size is %s", type: :invalid_order }, 50008 => %{ description: "400, Minimum price is %s", type: :invalid_order }, 50009 => %{ description: "400, Minimum count*price is %s", type: :invalid_order }, 50010 => %{ description: "400, RequestParam size is required", type: :invalid_order }, 50011 => %{ description: "400, RequestParam price is required", type: :invalid_order }, 50012 => %{ description: "400, RequestParam notional is required", type: :invalid_order }, 50013 => %{ description: "400, Maximum limit*offset is %d", type: :invalid_order }, 50014 => %{ description: "400, RequestParam limit is required", type: :invalid_parameters }, 50015 => %{ description: "400, Minimum limit is 1", type: :invalid_parameters }, 50016 => %{ description: "400, Maximum limit is %d", type: :invalid_parameters }, 50017 => %{ description: "400, RequestParam offset is required", type: :invalid_parameters }, 50018 => %{ description: "400, Minimum offset is 1", type: :invalid_parameters }, 50019 => %{ description: "400, Invalid status. validate status is [1=Failed, 2=Success, 3=Frozen Failed, 4=Frozen Success, 5=Partially Filled, 6=Fully Fulled, 7=Canceling, 8=Canceled] '50020': InsufficientFunds, // 400, Balance not enough", type: :exchange_error }, 50020 => %{ description: "400, Balance not enough", type: :insufficient_balance }, 50021 => %{ description: "400, Invalid %s", type: :invalid_parameters }, 50022 => %{ description: "400, Service unavailable", type: :network_error }, 50023 => %{ description: "400, This Symbol can't place order by api", type: :invalid_order }, 50024 => %{ description: "400, Order book size over 200", type: :invalid_parameters }, 50025 => %{ description: "400, Maximum price is %s", type: :invalid_parameters }, 50026 => %{ description: "400, The buy order price cannot be higher than the open price", type: :invalid_parameters }, 50027 => %{ description: "400, The sell order price cannot be lower than the open price", type: :invalid_parameters }, 50028 => %{ description: "400, Missing parameters", type: :invalid_parameters }, 50029 => %{ description: "400, {\"message\":\"param not match : size * price >=1000\",\"code\":50029,\"trace\":\"f931f030-b692-401b-a0c5-65edbeadc598\",\"data\":{}}", type: :invalid_order }, 50030 => %{ description: "400, {\"message\":\"Order is already canceled\",\"code\":50030,\"trace\":\"8d6f64ee-ad26-45a4-9efd-1080f9fca1fa\",\"data\":{}}", type: :order_not_found }, 50031 => %{ description: "400, Order is already completed", type: :order_not_found }, 50032 => %{ description: "400, {\"message\":\"Order does not exist\",\"code\":50032,\"trace\":\"8d6b482d-4bf2-4e6c-aab2-9dcd22bf2481\",\"data\":{}}", type: :order_not_found }, 50033 => %{ description: "400, The order quantity should be greater than 0 and less than or equal to 10", type: :invalid_order }, 50034 => %{ description: "400, {\"message\":\"The price is high and there is no matching depth\",\"code\":50034,\"trace\":\"ebfae59a-ba69-4735-86b2-0ed7b9ca14ea\",\"data\":{}}", type: :invalid_order }, 50035 => %{ description: "400, {\"message\":\"The price is low and there is no matching depth\",\"code\":50035,\"trace\":\"677f01c7-8b88-4346-b097-b4226c75c90e\",\"data\":{}}", type: :invalid_order }, 50036 => %{ description: "400, Cancel failed, order is not revocable status", type: :exchange_error }, 50037 => %{ description: "400, The maximum length of clientOrderId cannot exceed 32", type: :invalid_parameters }, 50038 => %{ description: "400, ClientOrderId only allows a combination of numbers and letters", type: :invalid_parameters }, 50039 => %{ description: "400, Order_id and clientOrderId cannot be empty at the same time", type: :invalid_parameters }, 50040 => %{ description: "400, Symbol Not Available", type: :invalid_order }, 50041 => %{ description: "400, Out of query time range", type: :exchange_error }, 50042 => %{ description: "400, clientOrderId is duplicate", type: :invalid_parameters }, 51000 => %{ description: "400, Currency not found", type: :invalid_order }, 51001 => %{ description: "400, Margin Account not Opened", type: :exchange_error }, 51002 => %{ description: "400, Margin Account Not Available", type: :exchange_error }, 51003 => %{ description: "400, Account Limit", type: :exchange_error }, 51004 => %{ description: "400, {\"message\":\"Exceed the maximum number of borrows available.\",\"code\":51004,\"trace\":\"4030b753-9beb-44e6-8352-1633c5edcd47\",\"data\":{}}", type: :insufficient_balance }, 51005 => %{ description: "400, Less than the minimum borrowable amount", type: :invalid_order }, 51006 => %{ description: "400, Exceeds the amount to be repaid", type: :invalid_order }, 51007 => %{ description: "400, order_mode not found", type: :invalid_parameters }, 51008 => %{ description: "400, Operation is limited, please try again later", type: :exchange_error }, 51009 => %{ description: "400, Parameter mismatch: limit order/market order quantity should be greater than the minimum number of should buy/sell", type: :invalid_order }, 51010 => %{ description: "400, Parameter mismatch: limit order price should be greater than the minimum buy price", type: :invalid_order }, 51011 => %{ description: "400, {\"message\":\"param not match : size * price >=5\",\"code\":51011,\"trace\":\"525e1d27bfd34d60b2d90ba13a7c0aa9.74.16696421352220797\",\"data\":{}}", type: :invalid_order }, 51012 => %{ description: "400, Parameter mismatch: limit order price should be greater than the minimum buy price", type: :invalid_order }, 51013 => %{ description: "400, Parameter mismatch: Limit order quantity * price should be greater than the minimum transaction amount", type: :invalid_order }, 51014 => %{ description: "400, Participation mismatch: the number of market order buy orders should be greater than the minimum buyable amount", type: :invalid_order }, 51015 => %{ description: "400, Parameter mismatch: the price of market order buy order placed is too small", type: :invalid_order }, 52000 => %{ description: "400, Unsupported OrderMode Type", type: :invalid_parameters }, 52001 => %{ description: "400, Unsupported Trade Type", type: :invalid_parameters }, 52002 => %{ description: "400, Unsupported Side Type", type: :invalid_parameters }, 52003 => %{ description: "400, Unsupported Query State Type", type: :invalid_parameters }, 52004 => %{ description: "400, End time must be greater than or equal to Start time", type: :invalid_parameters }, 53000 => %{ description: "403, Your account is frozen due to security policies. Please contact customer service", type: :access_restricted }, 53001 => %{ description: "403, {\"message\":\"Your kyc country is restricted. Please contact customer service.\",\"code\":53001,\"trace\":\"8b445940-c123-4de9-86d7-73c5be2e7a24\",\"data\":{}}", type: :access_restricted }, 53002 => %{ description: "403, Your account has not yet completed the kyc advanced certification, please complete first", type: :access_restricted }, 53003 => %{ description: "403 No permission, please contact the main account", type: :access_restricted }, 53005 => %{ description: "403 Don't have permission to access the interface", type: :access_restricted }, 53006 => %{ description: "403 Please complete your personal verification(Starter)", type: :access_restricted }, 53007 => %{ description: "403 Please complete your personal verification(Advanced)", type: :access_restricted }, 53008 => %{ description: "403 Services is not available in your countries and areas", type: :access_restricted }, 53009 => %{ description: "403 Your account has not yet completed the qr code certification, please complete first", type: :access_restricted }, 53010 => %{ description: "403 This account is restricted from borrowing", type: :access_restricted }, 57001 => %{ description: "405, Method Not Allowed", type: :invalid_parameters }, 58001 => %{ description: "415, Unsupported Media Type", type: :invalid_parameters }, 59001 => %{ description: "500, User account not found", type: :exchange_error }, 59002 => %{ description: "500, Internal Server Error", type: :exchange_error }, 59003 => %{ description: "500, Spot wallet call fail", type: :exchange_error }, 59004 => %{ description: "500, Margin wallet service call exception", type: :exchange_error }, 59005 => %{ description: "500, Margin wallet service restricted", type: :access_restricted }, 59006 => %{ description: "500, Transfer fail", type: :exchange_error }, 59007 => %{ description: "500, Get symbol risk data fail", type: :exchange_error }, 59008 => %{ description: "500, Trading order failure", type: :exchange_error }, 59009 => %{ description: "500, Loan success,but trading order failure", type: :exchange_error }, 59010 => %{ description: "500, Insufficient loan amount.", type: :insufficient_balance }, 59011 => %{ description: "500, The Get Wallet Balance service call fail, please try again later", type: :exchange_error }, 60000 => %{ description: "400, Invalid request (maybe the body is empty, or the int parameter passes string data)", type: :invalid_parameters }, 60001 => %{ description: "400, Asset account type does not exist", type: :invalid_parameters }, 60002 => %{ description: "400, currency does not exist", type: :invalid_parameters }, 60003 => %{ description: "400, Currency has been closed recharge channel, if there is any problem, please consult customer service", type: :exchange_error }, 60004 => %{ description: "400, Currency has been closed withdraw channel, if there is any problem, please consult customer service", type: :exchange_error }, 60005 => %{ description: "400, Minimum amount is %s", type: :exchange_error }, 60006 => %{ description: "400, Maximum withdraw precision is %d", type: :exchange_error }, 60007 => %{ description: "400, Only withdrawals from added addresses are allowed", type: :invalid_parameters }, 60008 => %{ description: "400, Balance not enough", type: :insufficient_balance }, 60009 => %{ description: "400, Beyond the limit", type: :exchange_error }, 60010 => %{ description: "400, Withdraw id or deposit id not found", type: :exchange_error }, 60011 => %{ description: "400, Address is not valid", type: :invalid_parameters }, 60012 => %{ description: "400, This action is not supported in this currency(If IOTA, HLX recharge and withdraw calls are prohibited)", type: :exchange_error }, 60020 => %{ description: "403, Your account is not allowed to recharge", type: :access_restricted }, 60021 => %{ description: "403, Your account is not allowed to withdraw", type: :access_restricted }, 60022 => %{ description: "403, No withdrawals for 24 hours", type: :access_restricted }, 60026 => %{ description: "403, Sub-account does not have permission to operate", type: :access_restricted }, 60027 => %{ description: "403, Only supports sub-account calls", type: :access_restricted }, 60028 => %{ description: "403, Account is disabled for security reasons, please contact customer service", type: :access_restricted }, 60029 => %{ description: "403, The account is frozen by the master account, please contact the master account to unfreeze the account", type: :access_restricted }, 60030 => %{ description: "405, Method Not Allowed", type: :invalid_parameters }, 60031 => %{ description: "415, Unsupported Media Type", type: :invalid_parameters }, 60050 => %{ description: "500, User account not found", type: :exchange_error }, 60051 => %{ description: "500, Internal Server Error", type: :exchange_error }, 61001 => %{ description: "Balance not enough", type: :insufficient_balance }, 61003 => %{ description: "400, {\"message\":\"sub-account not found\",\"code\":61003,\"trace\":\"b35ec2fd-0bc9-4ef2-a3c0-6f78d4f335a4\",\"data\":{}}", type: :invalid_parameters }, 61004 => %{ description: "400, Duplicate requests (such as using an existing requestNo)", type: :invalid_parameters }, 61005 => %{ description: "403, Asset transfer between accounts is not available", type: :invalid_parameters }, 61006 => %{ description: "403, The sub-account api only supports organization accounts", type: :exchange_error }, 61007 => %{ description: "403, Please complete your institution verification to enable withdrawal function.", type: :exchange_error }, 61008 => %{ description: "403, Suspend transfer out", type: :exchange_error }, 70000 => %{ description: "200, no data", type: :exchange_error }, 70001 => %{ description: "200, request param can not be null", type: :invalid_parameters }, 70002 => %{ description: "200, symbol is invalid", type: :invalid_order }, 70003 => %{ description: "net error, please try later", type: :network_error }, 71001 => %{ description: "200, after is invalid", type: :invalid_parameters }, 71002 => %{ description: "200, before is invalid", type: :invalid_parameters }, 71003 => %{ description: "200, request after or before is invalid", type: :invalid_parameters }, 71004 => %{ description: "200, request kline count limit", type: :invalid_parameters }, 71005 => %{ description: "200, request step error", type: :invalid_parameters }, "This trading pair does not support API trading" => %{ description: "This trading pair does not support API trading", type: :invalid_order }, "You contract account available balance not enough" => %{ description: nil, type: :insufficient_balance } }, error_codes: %{ 30000 => :exchange_error, 30001 => :invalid_credentials, 30002 => :invalid_credentials, 30003 => :access_restricted, 30004 => :invalid_credentials, 30005 => :invalid_credentials, 30006 => :invalid_credentials, 30007 => :invalid_credentials, 30008 => :invalid_credentials, 30010 => :access_restricted, 30011 => :invalid_credentials, 30012 => :invalid_credentials, 30013 => :rate_limited, 30014 => :network_error, 30016 => :network_error, 30017 => :rate_limited, 30018 => :invalid_parameters, 30019 => :access_restricted, 40001 => :exchange_error, 40002 => :exchange_error, 40003 => :exchange_error, 40004 => :exchange_error, 40005 => :exchange_error, 40006 => :access_restricted, 40007 => :invalid_parameters, 40008 => :invalid_credentials, 40009 => :invalid_parameters, 40010 => :invalid_parameters, 40011 => :invalid_parameters, 40012 => :exchange_error, 40013 => :exchange_error, 40014 => :invalid_order, 40015 => :invalid_order, 40016 => :invalid_order, 40017 => :invalid_order, 40018 => :invalid_order, 40019 => :exchange_error, 40020 => :invalid_order, 40021 => :exchange_error, 40022 => :exchange_error, 40023 => :exchange_error, 40024 => :exchange_error, 40025 => :exchange_error, 40026 => :exchange_error, 40027 => :insufficient_balance, 40028 => :access_restricted, 40029 => :invalid_order, 40030 => :invalid_order, 40031 => :invalid_order, 40032 => :invalid_order, 40033 => :invalid_order, 40034 => :invalid_order, 40035 => :order_not_found, 40036 => :invalid_order, 40037 => :order_not_found, 40038 => :invalid_parameters, 40039 => :invalid_parameters, 40040 => :invalid_order, 40041 => :invalid_order, 40042 => :invalid_order, 40043 => :invalid_order, 40044 => :invalid_order, 40045 => :invalid_order, 40046 => :access_restricted, 40047 => :access_restricted, 40048 => :invalid_order, 40049 => :invalid_order, 40050 => :invalid_order, 50000 => :invalid_parameters, 50001 => :invalid_order, 50002 => :invalid_parameters, 50003 => :invalid_parameters, 50004 => :invalid_parameters, 50005 => :order_not_found, 50006 => :invalid_order, 50007 => :invalid_order, 50008 => :invalid_order, 50009 => :invalid_order, 50010 => :invalid_order, 50011 => :invalid_order, 50012 => :invalid_order, 50013 => :invalid_order, 50014 => :invalid_parameters, 50015 => :invalid_parameters, 50016 => :invalid_parameters, 50017 => :invalid_parameters, 50018 => :invalid_parameters, 50019 => :exchange_error, 50020 => :insufficient_balance, 50021 => :invalid_parameters, 50022 => :network_error, 50023 => :invalid_order, 50024 => :invalid_parameters, 50025 => :invalid_parameters, 50026 => :invalid_parameters, 50027 => :invalid_parameters, 50028 => :invalid_parameters, 50029 => :invalid_order, 50030 => :order_not_found, 50031 => :order_not_found, 50032 => :order_not_found, 50033 => :invalid_order, 50034 => :invalid_order, 50035 => :invalid_order, 50036 => :exchange_error, 50037 => :invalid_parameters, 50038 => :invalid_parameters, 50039 => :invalid_parameters, 50040 => :invalid_order, 50041 => :exchange_error, 50042 => :invalid_parameters, 51000 => :invalid_order, 51001 => :exchange_error, 51002 => :exchange_error, 51003 => :exchange_error, 51004 => :insufficient_balance, 51005 => :invalid_order, 51006 => :invalid_order, 51007 => :invalid_parameters, 51008 => :exchange_error, 51009 => :invalid_order, 51010 => :invalid_order, 51011 => :invalid_order, 51012 => :invalid_order, 51013 => :invalid_order, 51014 => :invalid_order, 51015 => :invalid_order, 52000 => :invalid_parameters, 52001 => :invalid_parameters, 52002 => :invalid_parameters, 52003 => :invalid_parameters, 52004 => :invalid_parameters, 53000 => :access_restricted, 53001 => :access_restricted, 53002 => :access_restricted, 53003 => :access_restricted, 53005 => :access_restricted, 53006 => :access_restricted, 53007 => :access_restricted, 53008 => :access_restricted, 53009 => :access_restricted, 53010 => :access_restricted, 57001 => :invalid_parameters, 58001 => :invalid_parameters, 59001 => :exchange_error, 59002 => :exchange_error, 59003 => :exchange_error, 59004 => :exchange_error, 59005 => :access_restricted, 59006 => :exchange_error, 59007 => :exchange_error, 59008 => :exchange_error, 59009 => :exchange_error, 59010 => :insufficient_balance, 59011 => :exchange_error, 60000 => :invalid_parameters, 60001 => :invalid_parameters, 60002 => :invalid_parameters, 60003 => :exchange_error, 60004 => :exchange_error, 60005 => :exchange_error, 60006 => :exchange_error, 60007 => :invalid_parameters, 60008 => :insufficient_balance, 60009 => :exchange_error, 60010 => :exchange_error, 60011 => :invalid_parameters, 60012 => :exchange_error, 60020 => :access_restricted, 60021 => :access_restricted, 60022 => :access_restricted, 60026 => :access_restricted, 60027 => :access_restricted, 60028 => :access_restricted, 60029 => :access_restricted, 60030 => :invalid_parameters, 60031 => :invalid_parameters, 60050 => :exchange_error, 60051 => :exchange_error, 61001 => :insufficient_balance, 61003 => :invalid_parameters, 61004 => :invalid_parameters, 61005 => :invalid_parameters, 61006 => :exchange_error, 61007 => :exchange_error, 61008 => :exchange_error, 70000 => :exchange_error, 70001 => :invalid_parameters, 70002 => :invalid_order, 70003 => :network_error, 71001 => :invalid_parameters, 71002 => :invalid_parameters, 71003 => :invalid_parameters, 71004 => :invalid_parameters, 71005 => :invalid_parameters, "This trading pair does not support API trading" => :invalid_order, "You contract account available balance not enough" => :insufficient_balance }, exceptions: %{ broad: %{ "This trading pair does not support API trading" => :bad_symbol, "You contract account available balance not enough" => :insufficient_funds }, exact: %{ "30000" => :exchange_error, "30001" => :authentication_error, "30002" => :authentication_error, "30003" => :account_suspended, "30004" => :authentication_error, "30005" => :authentication_error, "30006" => :authentication_error, "30007" => :authentication_error, "30008" => :authentication_error, "30010" => :permission_denied, "30011" => :authentication_error, "30012" => :authentication_error, "30013" => :rate_limit_exceeded, "30014" => :exchange_not_available, "30016" => :on_maintenance, "30017" => :rate_limit_exceeded, "30018" => :bad_request, "30019" => :permission_denied, "40001" => :exchange_error, "40002" => :exchange_error, "40003" => :exchange_error, "40004" => :exchange_error, "40005" => :exchange_error, "40006" => :permission_denied, "40007" => :bad_request, "40008" => :invalid_nonce, "40009" => :bad_request, "40010" => :bad_request, "40011" => :bad_request, "40012" => :exchange_error, "40013" => :exchange_error, "40014" => :bad_symbol, "40015" => :bad_symbol, "40016" => :invalid_order, "40017" => :invalid_order, "40018" => :invalid_order, "40019" => :exchange_error, "40020" => :invalid_order, "40021" => :exchange_error, "40022" => :exchange_error, "40023" => :exchange_error, "40024" => :exchange_error, "40025" => :exchange_error, "40026" => :exchange_error, "40027" => :insufficient_funds, "40028" => :permission_denied, "40029" => :invalid_order, "40030" => :invalid_order, "40031" => :invalid_order, "40032" => :invalid_order, "40033" => :invalid_order, "40034" => :bad_symbol, "40035" => :order_not_found, "40036" => :invalid_order, "40037" => :order_not_found, "40038" => :bad_request, "40039" => :bad_request, "40040" => :invalid_order, "40041" => :invalid_order, "40042" => :invalid_order, "40043" => :invalid_order, "40044" => :invalid_order, "40045" => :invalid_order, "40046" => :permission_denied, "40047" => :permission_denied, "40048" => :invalid_order, "40049" => :invalid_order, "40050" => :invalid_order, "50000" => :bad_request, "50001" => :bad_symbol, "50002" => :bad_request, "50003" => :bad_request, "50004" => :bad_request, "50005" => :order_not_found, "50006" => :invalid_order, "50007" => :invalid_order, "50008" => :invalid_order, "50009" => :invalid_order, "50010" => :invalid_order, "50011" => :invalid_order, "50012" => :invalid_order, "50013" => :invalid_order, "50014" => :bad_request, "50015" => :bad_request, "50016" => :bad_request, "50017" => :bad_request, "50018" => :bad_request, "50019" => :exchange_error, "50020" => :insufficient_funds, "50021" => :bad_request, "50022" => :exchange_not_available, "50023" => :bad_symbol, "50024" => :bad_request, "50025" => :bad_request, "50026" => :bad_request, "50027" => :bad_request, "50028" => :bad_request, "50029" => :invalid_order, "50030" => :order_not_found, "50031" => :order_not_found, "50032" => :order_not_found, "50033" => :invalid_order, "50034" => :invalid_order, "50035" => :invalid_order, "50036" => :exchange_error, "50037" => :bad_request, "50038" => :bad_request, "50039" => :bad_request, "50040" => :bad_symbol, "50041" => :exchange_error, "50042" => :bad_request, "51000" => :bad_symbol, "51001" => :exchange_error, "51002" => :exchange_error, "51003" => :exchange_error, "51004" => :insufficient_funds, "51005" => :invalid_order, "51006" => :invalid_order, "51007" => :bad_request, "51008" => :exchange_error, "51009" => :invalid_order, "51010" => :invalid_order, "51011" => :invalid_order, "51012" => :invalid_order, "51013" => :invalid_order, "51014" => :invalid_order, "51015" => :invalid_order, "52000" => :bad_request, "52001" => :bad_request, "52002" => :bad_request, "52003" => :bad_request, "52004" => :bad_request, "53000" => :account_suspended, "53001" => :account_suspended, "53002" => :permission_denied, "53003" => :permission_denied, "53005" => :permission_denied, "53006" => :permission_denied, "53007" => :permission_denied, "53008" => :permission_denied, "53009" => :permission_denied, "53010" => :permission_denied, "57001" => :bad_request, "58001" => :bad_request, "59001" => :exchange_error, "59002" => :exchange_error, "59003" => :exchange_error, "59004" => :exchange_error, "59005" => :permission_denied, "59006" => :exchange_error, "59007" => :exchange_error, "59008" => :exchange_error, "59009" => :exchange_error, "59010" => :insufficient_funds, "59011" => :exchange_error, "60000" => :bad_request, "60001" => :bad_request, "60002" => :bad_request, "60003" => :exchange_error, "60004" => :exchange_error, "60005" => :exchange_error, "60006" => :exchange_error, "60007" => :invalid_address, "60008" => :insufficient_funds, "60009" => :exchange_error, "60010" => :exchange_error, "60011" => :invalid_address, "60012" => :exchange_error, "60020" => :permission_denied, "60021" => :permission_denied, "60022" => :permission_denied, "60026" => :permission_denied, "60027" => :permission_denied, "60028" => :account_suspended, "60029" => :account_suspended, "60030" => :bad_request, "60031" => :bad_request, "60050" => :exchange_error, "60051" => :exchange_error, "61001" => :insufficient_funds, "61003" => :bad_request, "61004" => :bad_request, "61005" => :bad_request, "61006" => :not_supported, "61007" => :exchange_error, "61008" => :exchange_error, "70000" => :exchange_error, "70001" => :bad_request, "70002" => :bad_symbol, "70003" => :network_error, "71001" => :bad_request, "71002" => :bad_request, "71003" => :bad_request, "71004" => :bad_request, "71005" => :bad_request } }, exchange_options: %{ "accountsByType" => %{ "spot" => "spot", "swap" => "swap" }, "adjustForTimeDifference" => false, "brokerId" => "CCXTxBitmart000", "createMarketBuyOrderRequiresPrice" => true, "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "defaultNetworks" => %{ "BTC" => "BTC", "ETH" => "ERC20", "USDT" => "TRC20" }, "defaultType" => "spot", "fetchBalance" => %{ "type" => "spot" }, "networks" => %{ "ABBC" => "ABBC", "ACA" => "ACA", "ADA" => "ADA", "AKT" => "AKT", "ALGO" => "ALGO", "APT" => "APT", "AR" => "AR", "ASTR" => "ASTAR", "ATOM" => "ATOM", "BCH" => "BCH", "BEP2" => "BEP2", "BEP20" => "BSC_BNB", "BFIC" => "BFIC", "BITCI" => "BITCI", "BRISE" => "BRISE", "BSV" => "BSV", "BTC" => "BTC", "BTM" => "BTM", "CELO" => "CELO", "CHEQ" => "CHEQ", "CS" => "CS", "CSPR" => "Casper", "DASH" => "DASH", "DESO" => "DESO", "DGB" => "DGB", "DOGE" => "DOGE", "DOT" => "DOT", "EOS" => "EOS", "ERC20" => "ERC20", "ERGO" => "ERG", "ETC" => "ETC", "ETHF" => "ETHF", "ETHW" => "ETHW", "EVER" => "EVER", "EVMOS" => "EVMOS", "FIL" => "FIL", "FIO" => "FIO", "FIRO" => "FIRO", "FRA" => "FRA", "FTM" => "Fantom", "FUSE" => "FUSE", "GLMR" => "GLMR", "GRIN" => "GRIN", "HRC20" => "HECO", "HYDRA" => "HYDRA", "ICP" => "Computer", "INJ" => "INJ", "IOST" => "IOST", "IOTX" => "IOTX", "KARDIA" => "KardiaChain", "KAVA" => "KAVA", "KSM" => "KSM", "LAT" => "LAT", "LTC" => "LTC", "LTO" => "LTO", "MINA" => "MINA", "MOVR" => "MOVR", "NAS" => "NAS", "NEAR" => "NEAR", "NEM" => "XEM", "NEO" => "NEO", "NODL" => "NODL", "NULS" => "NULS", "OASYS" => "OAS", "OHO" => "OHO", "OMAX" => "OMAX Chain", "OMNI" => "OMNI", "ONE" => "ONE", "ONT" => "ONT", "OPTIMISM" => "OPTIMISM", "OSMO" => "OSMO", "PAC" => "PAC", "PLCU" => "PLCU", "PLEX" => "PLEX", "POLYGON" => "MATIC", "QTUM" => "QTUM", "REEF" => "REEF", "SCRT" => "SCRT", "SOL" => "SOL", "STX" => "STX", "SXP" => "SXP", "SYS" => "SYS", "THETA" => "THETA", "TLOS" => "TLOS", "TRC10" => "TRC10", "TRC20" => "TRC20", "VITE" => "VITE", "WAVES" => "WAVES", "XCH" => "XCH", "XDC" => "XDC", "XLM" => "XLM", "XMR" => "XMR", "XRD" => "XRD", "XRP" => "XRP", "XTZ" => "XTZ", "XYM" => "XYM", "ZEC" => "ZEC", "ZEN" => "HORIZEN", "ZIL" => "ZIL" }, "networksById" => %{ "ABBC" => "ABBC", "ACA" => "ACA", "ADA" => "ADA", "AKT" => "AKT", "ALGO" => "ALGO", "APT" => "APT", "AR" => "AR", "ASTAR" => "ASTR", "ATOM" => "ATOM", "BCH" => "BCH", "BEP2" => "BEP2", "BFIC" => "BFIC", "BITCI" => "BITCI", "BRISE" => "BRISE", "BSC_BNB" => "BEP20", "BSV" => "BSV", "BTC" => "BTC", "BTM" => "BTM", "Bitcoin" => "BTC", "CELO" => "CELO", "CHEQ" => "CHEQ", "CS" => "CS", "Casper" => "CSPR", "Computer" => "ICP", "DASH" => "DASH", "DESO" => "DESO", "DGB" => "DGB", "DOGE" => "DOGE", "DOT" => "DOT", "EOS" => "EOS", "ERC20" => "ERC20", "ERG" => "ERGO", "ETC" => "ETC", "ETH" => "ERC20", "ETHF" => "ETHF", "ETHW" => "ETHW", "EVER" => "EVER", "EVMOS" => "EVMOS", "Ethereum" => "ERC20", "FIL" => "FIL", "FIO" => "FIO", "FIRO" => "FIRO", "FRA" => "FRA", "FUSE" => "FUSE", "Fantom" => "FTM", "GLMR" => "GLMR", "GRIN" => "GRIN", "HECO" => "HRC20", "HORIZEN" => "ZEN", "HYDRA" => "HYDRA", "INJ" => "INJ", "IOST" => "IOST", "IOTX" => "IOTX", "KAVA" => "KAVA", "KSM" => "KSM", "KardiaChain" => "KARDIA", "LAT" => "LAT", "LTC" => "LTC", "LTO" => "LTO", "MATIC" => "POLYGON", "MINA" => "MINA", "MOVR" => "MOVR", "NAS" => "NAS", "NEAR" => "NEAR", "NEO" => "NEO", "NODL" => "NODL", "NULS" => "NULS", "OAS" => "OASYS", "OHO" => "OHO", "OMAX Chain" => "OMAX", "OMNI" => "OMNI", "ONE" => "ONE", "ONT" => "ONT", "OPTIMISM" => "OPTIMISM", "OSMO" => "OSMO", "PAC" => "PAC", "PLCU" => "PLCU", "PLEX" => "PLEX", "QTUM" => "QTUM", "REEF" => "REEF", "SCRT" => "SCRT", "SOL" => "SOL", "STX" => "STX", "SXP" => "SXP", "SYS" => "SYS", "THETA" => "THETA", "TLOS" => "TLOS", "TRC10" => "TRC10", "TRC20" => "TRC20", "USDT" => "OMNI", "VITE" => "VITE", "WAVES" => "WAVES", "XCH" => "XCH", "XDC" => "XDC", "XEM" => "NEM", "XLM" => "XLM", "XMR" => "XMR", "XRD" => "XRD", "XRP" => "XRP", "XTZ" => "XTZ", "XYM" => "XYM", "ZEC" => "ZEC", "ZIL" => "ZIL" }, "timeDifference" => 0 }, extended_metadata: %{ fees_url: "https://www.bitmart.com/fee/en", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://github.com/user-attachments/assets/0623e9c4-f50e-48c9-82bd-65c3908c3a14", referral_discount: 0.3, referral_url: "http://www.bitmart.com/?r=rQCFLh" }, extracted_metadata: %{ ccxt_version: "4.5.34" }, features: %{ default: %{ create_order: %{ hedged: false, iceberg: false, leverage: true, margin_mode: true, market_buy_by_cost: true, market_buy_requires_price: false, self_trade_prevention: false, stop_loss_price: false, take_profit_price: false, time_in_force: %{ fok: false, gtd: false, ioc: true, po: true }, trailing: false, trigger_direction: false, trigger_price: false }, create_orders: %{ max: 10 }, fetch_closed_orders: %{ limit: 200, margin_mode: true, symbol_required: false, trailing: false, trigger: false }, fetch_my_trades: %{ limit: 200, margin_mode: true, symbol_required: false, until_days: 99999 }, fetch_ohlcv: %{ limit: 1000 }, fetch_open_orders: %{ limit: 200, margin_mode: true, symbol_required: false, trailing: false, trigger: false }, fetch_order: %{ margin_mode: false, symbol_required: false, trailing: false, trigger: false }, sandbox: false }, for_derivatives: %{ create_order: %{ attached_stop_loss_take_profit: %{ price: false, trigger_price_type: %{ index: false, last: true, mark: true } }, hedged: false, margin_mode: true, market_buy_by_cost: true, market_buy_requires_price: true, stop_loss_price: true, take_profit_price: true, time_in_force: %{ fok: true, gtd: false, ioc: true, po: true }, trailing: true, trigger_direction: true, trigger_price: true, trigger_price_type: %{ index: false, last: true, mark: true } }, extends: "default", fetch_closed_orders: %{ limit: 200, margin_mode: true, trailing: false, trigger: false }, fetch_my_trades: %{ margin_mode: true, until_days: 99999 }, fetch_ohlcv: %{ limit: 500 }, fetch_open_orders: %{ limit: 100, margin_mode: false, trailing: false, trigger: true }, fetch_order: %{ margin_mode: false, trailing: true, trigger: false } }, future: %{}, spot: %{ extends: "default" }, swap: %{ inverse: %{ extends: "forDerivatives" }, linear: %{ extends: "forDerivatives" } } }, fees: %{ trading: %{ maker: 0.0035, percentage: true, taker: 0.004, tier_based: true, tiers: %{ maker: [ %{ fee: 0.001, volume: 0 }, %{ fee: 0.0009, volume: 10 }, %{ fee: 0.0008, volume: 50 }, %{ fee: 0.0007, volume: 250 }, %{ fee: 0.0006, volume: 1000 }, %{ fee: 0.0005, volume: 5000 }, %{ fee: 0.0004, volume: 25000 }, %{ fee: 0.0003, volume: 50000 } ], taker: [ %{ fee: 0.002, volume: 0 }, %{ fee: 0.18, volume: 10 }, %{ fee: 0.0016, volume: 50 }, %{ fee: 0.0014, volume: 250 }, %{ fee: 0.0012, volume: 1000 }, %{ fee: 0.001, volume: 5000 }, %{ fee: 0.0008, volume: 25000 }, %{ fee: 0.0006, volume: 50000 } ] } } }, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (response === undefined) {\n return undefined;\n }\n //\n // spot\n //\n // {\"message\":\"Bad Request [to is empty]\",\"code\":50000,\"trace\":\"f9d46e1b-4edb-4d07-a06e-4895fb2fc8fc\",\"data\":{}}\n // {\"message\":\"Bad Request [from is empty]\",\"code\":50000,\"trace\":\"579986f7-c93a-4559-926b-06ba9fa79d76\",\"data\":{}}\n // {\"message\":\"Kline size over 500\",\"code\":50004,\"trace\":\"d625caa8-e8ca-4bd2-b77c-958776965819\",\"data\":{}}\n // {\"message\":\"Balance not enough\",\"code\":50020,\"trace\":\"7c709d6a-3292-462c-98c5-32362540aeef\",\"data\":{}}\n // {\"code\":40012,\"message\":\"You contract account available balance not enough.\",\"trace\":\"...\"}\n //\n // contract\n //\n // {\"errno\":\"OK\",\"message\":\"INVALID_PARAMETER\",\"code\":49998,\"trace\":\"eb5ebb54-23cd-4de2-9064-e090b6c3b2e3\",\"data\":null}\n //\n const message = this.safeString(response, 'message');\n const messageLower = message.toLowerCase();\n const isErrorMessage = (message !== undefined) && (messageLower !== 'ok') && (messageLower !== 'success');\n const errorCode = this.safeString(response, 'code');\n const isErrorCode = (errorCode !== undefined) && (errorCode !== '1000');\n if (isErrorCode || isErrorMessage) {\n const feedback = this.id + ' ' + body;\n this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);\n this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);\n this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);\n this.throwBroadlyMatchedException(this.exceptions['broad'], errorCode, feedback);\n throw new errors.ExchangeError(feedback); // unknown message\n }\n return undefined;\n }", has: %{ add_margin: false, borrow_cross_margin: false, borrow_isolated_margin: true, borrow_margin: false, c_o_r_s: false, cancel_all_orders: true, cancel_all_orders_ws: false, cancel_order: true, cancel_order_with_client_order_id: false, cancel_order_ws: false, cancel_orders: true, cancel_orders_with_client_order_id: false, cancel_orders_ws: false, close_all_positions: false, close_position: false, create_deposit_address: false, create_limit_buy_order: false, create_limit_buy_order_ws: false, create_limit_order: true, create_limit_order_ws: false, create_limit_sell_order: false, create_limit_sell_order_ws: false, create_market_buy_order: false, create_market_buy_order_with_cost: true, create_market_buy_order_with_cost_ws: false, create_market_buy_order_ws: false, create_market_order: true, create_market_order_with_cost: false, create_market_order_with_cost_ws: false, create_market_order_ws: true, create_market_sell_order: false, create_market_sell_order_with_cost: false, create_market_sell_order_with_cost_ws: false, create_market_sell_order_ws: false, create_order: true, create_order_with_take_profit_and_stop_loss: false, create_order_with_take_profit_and_stop_loss_ws: false, create_order_ws: false, create_orders: true, create_post_only_order: true, create_post_only_order_ws: false, create_reduce_only_order: true, create_reduce_only_order_ws: false, create_stop_limit_order: false, create_stop_limit_order_ws: false, create_stop_loss_order: false, create_stop_loss_order_ws: false, create_stop_market_order: false, create_stop_market_order_ws: false, create_stop_order: false, create_stop_order_ws: false, create_take_profit_order: false, create_take_profit_order_ws: false, create_trailing_amount_order: false, create_trailing_amount_order_ws: false, create_trailing_percent_order: true, create_trailing_percent_order_ws: false, create_trigger_order: false, create_trigger_order_ws: false, deposit: false, edit_order: true, edit_order_with_client_order_id: false, edit_order_ws: false, edit_orders: false, fetch_accounts: false, fetch_balance: true, fetch_balance_ws: false, fetch_bids_asks: false, fetch_borrow_interest: true, fetch_borrow_rate: false, fetch_borrow_rate_histories: false, fetch_borrow_rate_history: false, fetch_borrow_rates: false, fetch_borrow_rates_per_symbol: false, fetch_canceled_and_closed_orders: false, fetch_canceled_orders: true, fetch_closed_order: false, fetch_closed_orders: true, fetch_closed_orders_ws: false, fetch_convert_currencies: false, fetch_convert_quote: false, fetch_convert_trade: false, fetch_convert_trade_history: false, fetch_cross_borrow_rate: false, fetch_cross_borrow_rates: false, fetch_currencies: true, fetch_currencies_ws: true, fetch_deposit: true, fetch_deposit_address: true, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: false, fetch_deposit_withdraw_fee: true, fetch_deposit_withdraw_fees: false, fetch_deposits: true, fetch_deposits_withdrawals: false, fetch_deposits_ws: false, fetch_funding_history: true, fetch_funding_interval: false, fetch_funding_intervals: false, fetch_funding_rate: true, fetch_funding_rate_history: false, fetch_funding_rates: false, fetch_greeks: false, fetch_index_ohlcv: false, fetch_isolated_borrow_rate: true, fetch_isolated_borrow_rates: true, fetch_isolated_positions: false, fetch_l2_order_book: true, fetch_l3_order_book: false, fetch_last_prices: false, fetch_ledger: true, fetch_ledger_entry: false, fetch_leverage: false, fetch_leverage_tiers: false, fetch_leverages: false, fetch_liquidations: false, fetch_long_short_ratio: false, fetch_long_short_ratio_history: false, fetch_margin_adjustment_history: false, fetch_margin_mode: false, fetch_margin_modes: false, fetch_mark_ohlcv: true, fetch_mark_prices: false, fetch_market_leverage_tiers: false, fetch_markets: true, fetch_markets_ws: false, fetch_my_liquidations: true, fetch_my_settlement_history: false, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: true, fetch_open_interest_history: false, fetch_open_interests: false, fetch_open_order: false, fetch_open_orders: true, fetch_open_orders_ws: false, fetch_option: false, fetch_option_chain: false, fetch_order: true, fetch_order_book: true, fetch_order_book_ws: false, fetch_order_books: false, fetch_order_trades: true, fetch_order_with_client_order_id: false, fetch_order_ws: false, fetch_orders: false, fetch_orders_by_status: false, fetch_orders_ws: false, fetch_position: true, fetch_position_history: false, fetch_position_mode: true, fetch_position_ws: false, fetch_positions: true, fetch_positions_for_symbol: false, fetch_positions_for_symbol_ws: false, fetch_positions_history: false, fetch_positions_risk: false, fetch_positions_ws: false, fetch_premium_index_ohlcv: false, fetch_settlement_history: false, fetch_status: true, fetch_ticker: true, fetch_ticker_ws: false, fetch_tickers: true, fetch_tickers_ws: false, fetch_time: true, fetch_trades: true, fetch_trades_ws: false, fetch_trading_fee: true, fetch_trading_fees: false, fetch_trading_fees_ws: false, fetch_trading_limits: false, fetch_transaction_fee: true, fetch_transaction_fees: false, fetch_transactions: false, fetch_transfer: false, fetch_transfers: true, fetch_underlying_assets: false, fetch_volatility_history: false, fetch_withdraw_addresses: true, fetch_withdraw_addresses_by_network: false, fetch_withdrawal: true, fetch_withdrawal_whitelist: false, fetch_withdrawals: true, fetch_withdrawals_ws: false, future: false, margin: true, option: false, private_api: true, public_api: true, reduce_margin: false, repay_cross_margin: false, repay_isolated_margin: true, sandbox: false, set_leverage: true, set_margin: false, set_margin_mode: false, set_position_mode: true, sign_in: false, spot: true, swap: true, transfer: true, un_watch_my_trades: false, un_watch_ohlcv: false, un_watch_ohlcv_for_symbols: false, un_watch_order_book: false, un_watch_order_book_for_symbols: false, un_watch_orders: false, un_watch_positions: false, un_watch_ticker: false, un_watch_tickers: false, un_watch_trades: false, un_watch_trades_for_symbols: false, watch_balance: true, watch_bids_asks: true, watch_liquidations: false, watch_liquidations_for_symbols: false, watch_my_liquidations: false, watch_my_liquidations_for_symbols: false, watch_my_trades: false, watch_ohlcv: true, watch_ohlcv_for_symbols: false, watch_order_book: true, watch_order_book_for_symbols: true, watch_orders: true, watch_orders_for_symbols: false, watch_position: true, watch_positions: true, watch_status: false, watch_ticker: true, watch_tickers: true, watch_trades: true, watch_trades_for_symbols: true, withdraw: true, ws: false }, http_config: nil, id: "bitmart", markets: nil, name: "BitMart", ohlcv_timestamp_resolution: :unknown, options: %{ accounts_by_type: %{ "spot" => "spot", "swap" => "swap" }, adjust_for_time_difference: false, broker_id: "CCXTxBitmart000", create_market_buy_order_requires_price: true, default_account_type: "spot", default_networks: %{ "BTC" => "BTC", "ETH" => "ERC20", "USDT" => "TRC20" }, default_type: "spot", fetch_balance: %{ "type" => "spot" }, networks: %{ "ABBC" => "ABBC", "ACA" => "ACA", "ADA" => "ADA", "AKT" => "AKT", "ALGO" => "ALGO", "APT" => "APT", "AR" => "AR", "ASTR" => "ASTAR", "ATOM" => "ATOM", "BCH" => "BCH", "BEP2" => "BEP2", "BEP20" => "BSC_BNB", "BFIC" => "BFIC", "BITCI" => "BITCI", "BRISE" => "BRISE", "BSV" => "BSV", "BTC" => "BTC", "BTM" => "BTM", "CELO" => "CELO", "CHEQ" => "CHEQ", "CS" => "CS", "CSPR" => "Casper", "DASH" => "DASH", "DESO" => "DESO", "DGB" => "DGB", "DOGE" => "DOGE", "DOT" => "DOT", "EOS" => "EOS", "ERC20" => "ERC20", "ERGO" => "ERG", "ETC" => "ETC", "ETHF" => "ETHF", "ETHW" => "ETHW", "EVER" => "EVER", "EVMOS" => "EVMOS", "FIL" => "FIL", "FIO" => "FIO", "FIRO" => "FIRO", "FRA" => "FRA", "FTM" => "Fantom", "FUSE" => "FUSE", "GLMR" => "GLMR", "GRIN" => "GRIN", "HRC20" => "HECO", "HYDRA" => "HYDRA", "ICP" => "Computer", "INJ" => "INJ", "IOST" => "IOST", "IOTX" => "IOTX", "KARDIA" => "KardiaChain", "KAVA" => "KAVA", "KSM" => "KSM", "LAT" => "LAT", "LTC" => "LTC", "LTO" => "LTO", "MINA" => "MINA", "MOVR" => "MOVR", "NAS" => "NAS", "NEAR" => "NEAR", "NEM" => "XEM", "NEO" => "NEO", "NODL" => "NODL", "NULS" => "NULS", "OASYS" => "OAS", "OHO" => "OHO", "OMAX" => "OMAX Chain", "OMNI" => "OMNI", "ONE" => "ONE", "ONT" => "ONT", "OPTIMISM" => "OPTIMISM", "OSMO" => "OSMO", "PAC" => "PAC", "PLCU" => "PLCU", "PLEX" => "PLEX", "POLYGON" => "MATIC", "QTUM" => "QTUM", "REEF" => "REEF", "SCRT" => "SCRT", "SOL" => "SOL", "STX" => "STX", "SXP" => "SXP", "SYS" => "SYS", "THETA" => "THETA", "TLOS" => "TLOS", "TRC10" => "TRC10", "TRC20" => "TRC20", "VITE" => "VITE", "WAVES" => "WAVES", "XCH" => "XCH", "XDC" => "XDC", "XLM" => "XLM", "XMR" => "XMR", "XRD" => "XRD", "XRP" => "XRP", "XTZ" => "XTZ", "XYM" => "XYM", "ZEC" => "ZEC", "ZEN" => "HORIZEN", "ZIL" => "ZIL" }, networks_by_id: %{ "Bitcoin" => "BTC", "ETH" => "ERC20", "Ethereum" => "ERC20", "USDT" => "OMNI" }, time_difference: 0 }, order_mappings: %{ side_format: :lowercase, side_key: "side", type_format: :lowercase, type_key: "type" }, param_mappings: %{ "amount" => "size", "arg0" => "id", "code" => "currency", "cost" => "notional", "id" => "orderId", "trailingPercent" => "side" }, parse_methods: [ %{ "comment" => nil, "examples" => [], "line_end" => 2390, "line_start" => 2381, "mappings" => [], "name" => "parseBalanceHelper", "signature" => "parseBalanceHelper (entry)", "source" => "parseBalanceHelper (entry) {\n const account = this.account ();\n account['used'] = this.safeString (entry, 'frozen');\n account['free'] = this.safeString (entry, 'available');\n account['total'] = this.safeString (entry, 'total_asset');\n const debt = this.safeString (entry, 'borrow_unpaid');\n const interest = this.safeString (entry, 'interest_unpaid');\n account['debt'] = Precise.stringAdd (debt, interest);\n return account;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"borrow_id\": \"1657664327844Lk5eJJugXmdHHZoe\",\n \"symbol\": \"BTC_USDT\",\n \"currency\": \"USDT\",\n \"borrow_amount\": \"20.00000000\",\n \"daily_interest\": \"0.00055000\",\n \"hourly_interest\": \"0.00002291\",\n \"interest_amount\": \"0.00045833\",\n \"create_time\": 1657664329000\n }" ], "line_end" => 4637, "line_start" => 4610, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "info" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeString (market, 'symbol')" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (this.safeString (info, 'currency'))" }, %{ "comment" => nil, "key" => "interest", "value" => "this.safeNumber (info, 'interest_amount')" }, %{ "comment" => nil, "key" => "interestRate", "value" => "this.safeNumber (info, 'hourly_interest')" }, %{ "comment" => nil, "key" => "amountBorrowed", "value" => "this.safeNumber (info, 'borrow_amount')" }, %{ "comment" => nil, "key" => "marginMode", "value" => "'isolated'" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" } ], "name" => "parseBorrowInterest", "signature" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest", "source" => "parseBorrowInterest (info: Dict, market: Market = undefined): BorrowInterest {\n //\n // {\n // \"borrow_id\": \"1657664327844Lk5eJJugXmdHHZoe\",\n // \"symbol\": \"BTC_USDT\",\n // \"currency\": \"USDT\",\n // \"borrow_amount\": \"20.00000000\",\n // \"daily_interest\": \"0.00055000\",\n // \"hourly_interest\": \"0.00002291\",\n // \"interest_amount\": \"0.00045833\",\n // \"create_time\": 1657664329000\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n market = this.safeMarket (marketId, market);\n const timestamp = this.safeInteger (info, 'create_time');\n return {\n 'info': info,\n 'symbol': this.safeString (market, 'symbol'),\n 'currency': this.safeCurrencyCode (this.safeString (info, 'currency')),\n 'interest': this.safeNumber (info, 'interest_amount'),\n 'interestRate': this.safeNumber (info, 'hourly_interest'),\n 'amountBorrowed': this.safeNumber (info, 'borrow_amount'),\n 'marginMode': 'isolated',\n 'timestamp': timestamp, // borrow creation time\n 'datetime': this.iso8601 (timestamp),\n } as BorrowInterest;\n }" }, %{ "comment" => nil, "examples" => [ "{\n currency: 'ETH',\n chain: 'Ethereum',\n address: '0x99B5EEc2C520f86F0F62F05820d28D05D36EccCf',\n address_memo: ''\n }", "{\n \"currency\": \"ETH\",\n \"network\": \"ETH\",\n \"address\": \"0x1121\",\n \"memo\": \"12\",\n \"remark\": \"12\",\n \"addressType\": 0,\n \"verifyStatus\": 0\n }" ], "line_end" => 3788, "line_start" => 3747, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "depositAddress" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeString (currency, 'code')" }, %{ "comment" => nil, "key" => "network", "value" => "this.networkIdToCode (network)" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "tag", "value" => "this.safeString2 (depositAddress, 'address_memo', 'memo')" } ], "name" => "parseDepositAddress", "signature" => "parseDepositAddress (depositAddress, currency = undefined): DepositAddress", "source" => "parseDepositAddress (depositAddress, currency = undefined): DepositAddress {\n //\n // fetchDepositAddress\n // {\n // currency: 'ETH',\n // chain: 'Ethereum',\n // address: '0x99B5EEc2C520f86F0F62F05820d28D05D36EccCf',\n // address_memo: ''\n // }\n //\n // fetchWithdrawAddress\n // {\n // \"currency\": \"ETH\",\n // \"network\": \"ETH\",\n // \"address\": \"0x1121\",\n // \"memo\": \"12\",\n // \"remark\": \"12\",\n // \"addressType\": 0,\n // \"verifyStatus\": 0\n // }\n //\n let currencyId = this.safeString (depositAddress, 'currency');\n let network = this.safeString2 (depositAddress, 'chain', 'network');\n if (currencyId.indexOf ('NFT') < 0) {\n const parts = currencyId.split ('-');\n currencyId = this.safeString (parts, 0);\n const secondPart = this.safeString (parts, 1);\n if (secondPart !== undefined) {\n network = secondPart;\n }\n }\n const address = this.safeString (depositAddress, 'address');\n currency = this.safeCurrency (currencyId, currency);\n this.checkAddress (address);\n return {\n 'info': depositAddress,\n 'currency': this.safeString (currency, 'code'),\n 'network': this.networkIdToCode (network),\n 'address': address,\n 'tag': this.safeString2 (depositAddress, 'address_memo', 'memo'),\n } as DepositAddress;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"today_available_withdraw_BTC\": \"100.0000\",\n \"min_withdraw\": \"0.005\",\n \"withdraw_precision\": \"8\",\n \"withdraw_fee\": \"0.000500000000000000000000000000\"\n }" ], "line_end" => 1391, "line_start" => 1370, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "withdraw", "value" => "{\n 'fee': this.safeNumber (fee, 'withdraw_fee'),\n 'percentage': undefined,\n }" }, %{ "comment" => nil, "key" => "deposit", "value" => "{\n 'fee': undefined,\n 'percentage': undefined,\n }" }, %{ "comment" => nil, "key" => "networks", "value" => "{}" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" } ], "name" => "parseDepositWithdrawFee", "signature" => "parseDepositWithdrawFee (fee, currency: Currency = undefined)", "source" => "parseDepositWithdrawFee (fee, currency: Currency = undefined) {\n //\n // {\n // \"today_available_withdraw_BTC\": \"100.0000\",\n // \"min_withdraw\": \"0.005\",\n // \"withdraw_precision\": \"8\",\n // \"withdraw_fee\": \"0.000500000000000000000000000000\"\n // }\n //\n return {\n 'info': fee,\n 'withdraw': {\n 'fee': this.safeNumber (fee, 'withdraw_fee'),\n 'percentage': undefined,\n },\n 'deposit': {\n 'fee': undefined,\n 'percentage': undefined,\n },\n 'networks': {},\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 5472, "line_start" => 5464, "mappings" => [], "name" => "parseFundingHistories", "signature" => "parseFundingHistories (contracts, market = undefined, since: Int = undefined, limit: Int = undefined): FundingHistory[]", "source" => "parseFundingHistories (contracts, market = undefined, since: Int = undefined, limit: Int = undefined): FundingHistory[] {\n const result = [];\n for (let i = 0; i < contracts.length; i++) {\n const contract = contracts[i];\n result.push (this.parseFundingHistory (contract, market));\n }\n const sorted = this.sortBy (result, 'timestamp');\n return this.filterBySinceLimit (sorted, since, limit);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"time\": \"1734422402121\",\n \"type\": \"Funding Fee\",\n \"amount\": \"-0.00008253\",\n \"asset\": \"USDT\",\n \"symbol\": \"LTCUSDT\",\n \"tran_id\": \"1734422402121\",\n \"flow_type\": 3\n }" ], "line_end" => 5462, "line_start" => 5438, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market, undefined, 'swap')" }, %{ "comment" => nil, "key" => "code", "value" => "this.safeCurrencyCode (currencyId)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (contract, 'tran_id')" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (contract, 'amount')" } ], "name" => "parseFundingHistory", "signature" => "parseFundingHistory (contract, market: Market = undefined)", "source" => "parseFundingHistory (contract, market: Market = undefined) {\n //\n // {\n // \"time\": \"1734422402121\",\n // \"type\": \"Funding Fee\",\n // \"amount\": \"-0.00008253\",\n // \"asset\": \"USDT\",\n // \"symbol\": \"LTCUSDT\",\n // \"tran_id\": \"1734422402121\",\n // \"flow_type\": 3\n // }\n //\n const marketId = this.safeString (contract, 'symbol');\n const currencyId = this.safeString (contract, 'asset');\n const timestamp = this.safeInteger (contract, 'time');\n return {\n 'info': contract,\n 'symbol': this.safeSymbol (marketId, market, undefined, 'swap'),\n 'code': this.safeCurrencyCode (currencyId),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'id': this.safeString (contract, 'tran_id'),\n 'amount': this.safeNumber (contract, 'amount'),\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"expected_rate\": \"-0.0000238\",\n \"rate_value\": \"0.000009601106\",\n \"funding_time\": 1761292800000,\n \"funding_upper_limit\": \"0.0375\",\n \"funding_lower_limit\": \"-0.0375\",\n \"timestamp\": 1761291544336\n }" ], "line_end" => 4861, "line_start" => 4826, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "interestRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "estimatedSettlePrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "this.safeNumber (contract, 'expected_rate')" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "fundingTimestamp" }, %{ "comment" => nil, "key" => "fundingDatetime", "value" => "this.iso8601 (fundingTimestamp)" }, %{ "comment" => nil, "key" => "nextFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingRate", "value" => "this.safeNumber (contract, 'rate_value')" }, %{ "comment" => nil, "key" => "previousFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "interval", "value" => "undefined" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (contract, market: Market = undefined): FundingRate", "source" => "parseFundingRate (contract, market: Market = undefined): FundingRate {\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"expected_rate\": \"-0.0000238\",\n // \"rate_value\": \"0.000009601106\",\n // \"funding_time\": 1761292800000,\n // \"funding_upper_limit\": \"0.0375\",\n // \"funding_lower_limit\": \"-0.0375\",\n // \"timestamp\": 1761291544336\n // }\n //\n const marketId = this.safeString (contract, 'symbol');\n const timestamp = this.safeInteger (contract, 'timestamp');\n const fundingTimestamp = this.safeInteger (contract, 'funding_time');\n return {\n 'info': contract,\n 'symbol': this.safeSymbol (marketId, market),\n 'markPrice': undefined,\n 'indexPrice': undefined,\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'fundingRate': this.safeNumber (contract, 'expected_rate'),\n 'fundingTimestamp': fundingTimestamp,\n 'fundingDatetime': this.iso8601 (fundingTimestamp),\n 'nextFundingRate': undefined,\n 'nextFundingTimestamp': undefined,\n 'nextFundingDatetime': undefined,\n 'previousFundingRate': this.safeNumber (contract, 'rate_value'),\n 'previousFundingTimestamp': undefined,\n 'previousFundingDatetime': undefined,\n 'interval': undefined,\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTC_USDT\",\n \"max_leverage\": \"5\",\n \"symbol_enabled\": true,\n \"base\": {\n \"currency\": \"BTC\",\n \"daily_interest\": \"0.00055000\",\n \"hourly_interest\": \"0.00002291\",\n \"max_borrow_amount\": \"2.00000000\",\n \"min_borrow_amount\": \"0.00000001\",\n \"borrowable_amount\": \"0.00670810\"\n },\n \"quote\": {\n \"currency\": \"USDT\",\n \"daily_interest\": \"0.00055000\",\n \"hourly_interest\": \"0.00002291\",\n \"max_borrow_amount\": \"50000.00000000\",\n \"min_borrow_amount\": \"0.00000001\",\n \"borrowable_amount\": \"135.12575038\"\n }\n }" ], "line_end" => 4300, "line_start" => 4259, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "base", "value" => "this.safeCurrencyCode (baseId)" }, %{ "comment" => nil, "key" => "baseRate", "value" => "this.safeNumber (baseData, 'hourly_interest')" }, %{ "comment" => nil, "key" => "quote", "value" => "this.safeCurrencyCode (quoteId)" }, %{ "comment" => nil, "key" => "quoteRate", "value" => "this.safeNumber (quoteData, 'hourly_interest')" }, %{ "comment" => nil, "key" => "period", "value" => "3600000" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "info" } ], "name" => "parseIsolatedBorrowRate", "signature" => "parseIsolatedBorrowRate (info: Dict, market: Market = undefined): IsolatedBorrowRate", "source" => "parseIsolatedBorrowRate (info: Dict, market: Market = undefined): IsolatedBorrowRate {\n //\n // {\n // \"symbol\": \"BTC_USDT\",\n // \"max_leverage\": \"5\",\n // \"symbol_enabled\": true,\n // \"base\": {\n // \"currency\": \"BTC\",\n // \"daily_interest\": \"0.00055000\",\n // \"hourly_interest\": \"0.00002291\",\n // \"max_borrow_amount\": \"2.00000000\",\n // \"min_borrow_amount\": \"0.00000001\",\n // \"borrowable_amount\": \"0.00670810\"\n // },\n // \"quote\": {\n // \"currency\": \"USDT\",\n // \"daily_interest\": \"0.00055000\",\n // \"hourly_interest\": \"0.00002291\",\n // \"max_borrow_amount\": \"50000.00000000\",\n // \"min_borrow_amount\": \"0.00000001\",\n // \"borrowable_amount\": \"135.12575038\"\n // }\n // }\n //\n const marketId = this.safeString (info, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n const baseData = this.safeDict (info, 'base', {});\n const quoteData = this.safeDict (info, 'quote', {});\n const baseId = this.safeString (baseData, 'currency');\n const quoteId = this.safeString (quoteData, 'currency');\n return {\n 'symbol': symbol,\n 'base': this.safeCurrencyCode (baseId),\n 'baseRate': this.safeNumber (baseData, 'hourly_interest'),\n 'quote': this.safeCurrencyCode (quoteId),\n 'quoteRate': this.safeNumber (quoteData, 'hourly_interest'),\n 'period': 3600000, // 1-Hour\n 'timestamp': undefined,\n 'datetime': undefined,\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"time\": \"1734422402121\",\n \"type\": \"Funding Fee\",\n \"amount\": \"-0.00008253\",\n \"asset\": \"USDT\",\n \"symbol\": \"LTCUSDT\",\n \"tran_id\": \"1734422402121\",\n \"flow_type\": 3\n }" ], "line_end" => 5361, "line_start" => 5320, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "item" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString (item, 'tran_id')" }, %{ "comment" => nil, "key" => "direction", "value" => "direction" }, %{ "comment" => nil, "key" => "account", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceId", "value" => "this.safeString (item, 'tradeId')" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseLedgerEntryType (type)" }, %{ "comment" => nil, "key" => "currency", "value" => "currency['code']" }, %{ "comment" => nil, "key" => "amount", "value" => "this.parseNumber (amount)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "before", "value" => "undefined" }, %{ "comment" => nil, "key" => "after", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // {\n // \"time\": \"1734422402121\",\n // \"type\": \"Funding Fee\",\n // \"amount\": \"-0.00008253\",\n // \"asset\": \"USDT\",\n // \"symbol\": \"LTCUSDT\",\n // \"tran_id\": \"1734422402121\",\n // \"flow_type\": 3\n // }\n //\n let amount = this.safeString (item, 'amount');\n let direction = undefined;\n if (Precise.stringLe (amount, '0')) {\n direction = 'out';\n amount = Precise.stringMul ('-1', amount);\n } else {\n direction = 'in';\n }\n const currencyId = this.safeString (item, 'asset');\n currency = this.safeCurrency (currencyId, currency);\n const timestamp = this.safeInteger (item, 'time');\n const type = this.safeString (item, 'type');\n return this.safeLedgerEntry ({\n 'info': item,\n 'id': this.safeString (item, 'tran_id'),\n 'direction': direction,\n 'account': undefined,\n 'referenceAccount': undefined,\n 'referenceId': this.safeString (item, 'tradeId'),\n 'type': this.parseLedgerEntryType (type),\n 'currency': currency['code'],\n 'amount': this.parseNumber (amount),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'before': undefined,\n 'after': undefined,\n 'status': undefined,\n 'fee': undefined,\n }, currency) as LedgerEntry;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 5372, "line_start" => 5363, "mappings" => [], "name" => "parseLedgerEntryType", "signature" => "parseLedgerEntryType (type)", "source" => "parseLedgerEntryType (type) {\n const ledgerType: Dict = {\n 'Commission Fee': 'fee',\n 'Funding Fee': 'fee',\n 'Realized PNL': 'trade',\n 'Transfer': 'transfer',\n 'Liquidation Clearance': 'settlement',\n };\n return this.safeString (ledgerType, type, type);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"order_id\": \"231007865458273\",\n \"client_order_id\": \"\",\n \"price\": \"27407.9\",\n \"size\": \"1\",\n \"symbol\": \"BTCUSDT\",\n \"state\": 4,\n \"side\": 3,\n \"type\": \"market\",\n \"leverage\": \"10\",\n \"open_type\": \"isolated\",\n \"deal_avg_price\": \"27422.6\",\n \"deal_size\": \"1\",\n \"create_time\": 1696405864011,\n \"update_time\": 1696405864045\n }" ], "line_end" => 5144, "line_start" => 5107, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "liquidation" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.parseNumber (contractsString)" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.parseNumber (contractSizeString)" }, %{ "comment" => nil, "key" => "price", "value" => "this.parseNumber (priceString)" }, %{ "comment" => nil, "key" => "baseValue", "value" => "this.parseNumber (baseValueString)" }, %{ "comment" => nil, "key" => "quoteValue", "value" => "this.parseNumber (quoteValueString)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" } ], "name" => "parseLiquidation", "signature" => "parseLiquidation (liquidation, market: Market = undefined)", "source" => "parseLiquidation (liquidation, market: Market = undefined) {\n //\n // {\n // \"order_id\": \"231007865458273\",\n // \"client_order_id\": \"\",\n // \"price\": \"27407.9\",\n // \"size\": \"1\",\n // \"symbol\": \"BTCUSDT\",\n // \"state\": 4,\n // \"side\": 3,\n // \"type\": \"market\",\n // \"leverage\": \"10\",\n // \"open_type\": \"isolated\",\n // \"deal_avg_price\": \"27422.6\",\n // \"deal_size\": \"1\",\n // \"create_time\": 1696405864011,\n // \"update_time\": 1696405864045\n // }\n //\n const marketId = this.safeString (liquidation, 'symbol');\n const timestamp = this.safeInteger (liquidation, 'update_time');\n const contractsString = this.safeString (liquidation, 'deal_size');\n const contractSizeString = this.safeString (market, 'contractSize');\n const priceString = this.safeString (liquidation, 'deal_avg_price');\n const baseValueString = Precise.stringMul (contractsString, contractSizeString);\n const quoteValueString = Precise.stringMul (baseValueString, priceString);\n return this.safeLiquidation ({\n 'info': liquidation,\n 'symbol': this.safeSymbol (marketId, market),\n 'contracts': this.parseNumber (contractsString),\n 'contractSize': this.parseNumber (contractSizeString),\n 'price': this.parseNumber (priceString),\n 'baseValue': this.parseNumber (baseValueString),\n 'quoteValue': this.parseNumber (quoteValueString),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"borrow_id\": \"629a7177a4ed4cf09869c6a4343b788c\",\n }", "{\n \"repay_id\": \"2afcc16d99bd4707818c5a355dc89bed\",\n }" ], "line_end" => 4203, "line_start" => 4180, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (info, 'borrow_id', 'repay_id')" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (undefined, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "info" } ], "name" => "parseMarginLoan", "signature" => "parseMarginLoan (info, currency: Currency = undefined)", "source" => "parseMarginLoan (info, currency: Currency = undefined) {\n //\n // borrowMargin\n //\n // {\n // \"borrow_id\": \"629a7177a4ed4cf09869c6a4343b788c\",\n // }\n //\n // repayMargin\n //\n // {\n // \"repay_id\": \"2afcc16d99bd4707818c5a355dc89bed\",\n // }\n //\n return {\n 'id': this.safeString2 (info, 'borrow_id', 'repay_id'),\n 'currency': this.safeCurrencyCode (undefined, currency),\n 'amount': undefined,\n 'symbol': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'info': info,\n };\n }" }, %{ "comment" => nil, "examples" => [ "[\n \"1699512060\", // timestamp\n \"36746.49\", // open\n \"36758.71\", // high\n \"36736.13\", // low\n \"36755.99\", // close\n \"2.83965\", // base volume\n \"104353.57\" // quote volume\n ]", "{\n \"low_price\": \"20090.3\",\n \"high_price\": \"20095.5\",\n \"open_price\": \"20092.6\",\n \"close_price\": \"20091.4\",\n \"volume\": \"8748\",\n \"timestamp\": 1665002281\n }", "[\n 1631056350, // timestamp\n \"46532.83\", // open\n \"46555.71\", // high\n \"46511.41\", // low\n \"46555.71\", // close\n \"0.25\", // volume\n ]", "{\n \"symbol\":\"BTCUSDT\",\n \"o\":\"146.24\",\n \"h\":\"146.24\",\n \"l\":\"146.24\",\n \"c\":\"146.24\",\n \"v\":\"146\"\n }" ], "line_end" => 2089, "line_start" => 2027, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n //\n // spot\n // [\n // \"1699512060\", // timestamp\n // \"36746.49\", // open\n // \"36758.71\", // high\n // \"36736.13\", // low\n // \"36755.99\", // close\n // \"2.83965\", // base volume\n // \"104353.57\" // quote volume\n // ]\n //\n // swap\n // {\n // \"low_price\": \"20090.3\",\n // \"high_price\": \"20095.5\",\n // \"open_price\": \"20092.6\",\n // \"close_price\": \"20091.4\",\n // \"volume\": \"8748\",\n // \"timestamp\": 1665002281\n // }\n //\n // ws\n // [\n // 1631056350, // timestamp\n // \"46532.83\", // open\n // \"46555.71\", // high\n // \"46511.41\", // low\n // \"46555.71\", // close\n // \"0.25\", // volume\n // ]\n //\n // ws swap\n // {\n // \"symbol\":\"BTCUSDT\",\n // \"o\":\"146.24\",\n // \"h\":\"146.24\",\n // \"l\":\"146.24\",\n // \"c\":\"146.24\",\n // \"v\":\"146\"\n // }\n //\n if (Array.isArray (ohlcv)) {\n return [\n this.safeTimestamp (ohlcv, 0),\n this.safeNumber (ohlcv, 1),\n this.safeNumber (ohlcv, 2),\n this.safeNumber (ohlcv, 3),\n this.safeNumber (ohlcv, 4),\n this.safeNumber (ohlcv, 5),\n ];\n } else {\n return [\n this.safeTimestamp2 (ohlcv, 'timestamp', 'ts'),\n this.safeNumber2 (ohlcv, 'open_price', 'o'),\n this.safeNumber2 (ohlcv, 'high_price', 'h'),\n this.safeNumber2 (ohlcv, 'low_price', 'l'),\n this.safeNumber2 (ohlcv, 'close_price', 'c'),\n this.safeNumber2 (ohlcv, 'volume', 'v'),\n ];\n }\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"timestamp\": 1694657502415,\n \"symbol\": \"BTCUSDT\",\n \"open_interest\": \"265231.721368593081729069\",\n \"open_interest_value\": \"7006353.83988919\"\n }" ], "line_end" => 4694, "line_start" => 4675, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (id, market)" }, %{ "comment" => nil, "key" => "openInterestAmount", "value" => "this.safeNumber (interest, 'open_interest')" }, %{ "comment" => nil, "key" => "openInterestValue", "value" => "this.safeNumber (interest, 'open_interest_value')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "interest" } ], "name" => "parseOpenInterest", "signature" => "parseOpenInterest (interest, market: Market = undefined)", "source" => "parseOpenInterest (interest, market: Market = undefined) {\n //\n // {\n // \"timestamp\": 1694657502415,\n // \"symbol\": \"BTCUSDT\",\n // \"open_interest\": \"265231.721368593081729069\",\n // \"open_interest_value\": \"7006353.83988919\"\n // }\n //\n const timestamp = this.safeInteger (interest, 'timestamp');\n const id = this.safeString (interest, 'symbol');\n return this.safeOpenInterest ({\n 'symbol': this.safeSymbol (id, market),\n 'openInterestAmount': this.safeNumber (interest, 'open_interest'),\n 'openInterestValue': this.safeNumber (interest, 'open_interest_value'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': interest,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"order_id\": 2707217580\n }", "\"data\": {\n \"order_id\": 231116359426639,\n \"price\": \"market price\"\n },", "{\n \"order_id\":1736871726781,\n \"symbol\":\"BTC_USDT\",\n \"create_time\":1591096004000,\n \"side\":\"sell\",\n \"type\":\"market\", // limit, market, limit_maker, ioc\n \"price\":\"0.00\",\n \"price_avg\":\"0.00\",\n \"size\":\"0.02000\",\n \"notional\":\"0.00000000\",\n \"filled_notional\":\"0.00000000\",\n \"filled_size\":\"0.00000\",\n \"status\":\"8\"\n }", "{\n \"orderId\" : \"118100034543076010\",\n \"clientOrderId\" : \"118100034543076010\",\n \"symbol\" : \"BTC_USDT\",\n \"side\" : \"buy\",\n \"orderMode\" : \"spot\",\n \"type\" : \"limit\",\n \"state\" : \"filled\",\n \"price\" : \"48800.00\",\n \"priceAvg\" : \"39999.00\",\n \"size\" : \"0.10000\",\n \"filledSize\" : \"0.10000\",\n \"notional\" : \"4880.00000000\",\n \"filledNotional\" : \"3999.90000000\",\n \"createTime\" : 1681701557927,\n \"updateTime\" : 1681701559408\n }", "{\n \"order_id\": \"230935812485489\",\n \"client_order_id\": \"\",\n \"price\": \"24000\",\n \"size\": \"1\",\n \"symbol\": \"BTCUSDT\",\n \"state\": 2,\n \"side\": 1,\n \"type\": \"limit\",\n \"leverage\": \"10\",\n \"open_type\": \"isolated\",\n \"deal_avg_price\": \"0\",\n \"deal_size\": \"0\",\n \"create_time\": 1695702258629,\n \"update_time\": 1695702258642,\n \"activation_price_type\": 0,\n \"activation_price\": \"\",\n \"callback_rate\": \"\"\n }" ], "line_end" => 2704, "line_start" => 2577, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeString2 (order, 'client_order_id', 'clientOrderId')" }, %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastTradeTimestamp", "value" => "this.safeInteger (order, 'update_time')" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "timeInForce" }, %{ "comment" => nil, "key" => "postOnly", "value" => "postOnly" }, %{ "comment" => nil, "key" => "side", "value" => "this.parseOrderSide (this.safeString (order, 'side'))" }, %{ "comment" => nil, "key" => "price", "value" => "this.omitZero (priceString)" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "trailingActivationPrice" }, %{ "comment" => nil, "key" => "amount", "value" => "this.omitZero (this.safeString (order, 'size'))" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeString2 (order, 'filled_notional', 'filledNotional')" }, %{ "comment" => nil, "key" => "average", "value" => "this.safeStringN (order, [ 'price_avg', 'priceAvg', 'deal_avg_price' ])" }, %{ "comment" => nil, "key" => "filled", "value" => "this.safeStringN (order, [ 'filled_size', 'filledSize', 'deal_size' ])" }, %{ "comment" => nil, "key" => "remaining", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseOrderStatusByType (orderType, this.safeString2 (order, 'status', 'state'))" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" }, %{ "comment" => nil, "key" => "trades", "value" => "undefined" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // createOrder, editOrder\n //\n // {\n // \"order_id\": 2707217580\n // }\n //\n // swap\n // \"data\": {\n // \"order_id\": 231116359426639,\n // \"price\": \"market price\"\n // },\n //\n // cancelOrder\n //\n // \"2707217580\" // order id\n //\n // spot fetchOrder, fetchOrdersByStatus, fetchOpenOrders, fetchClosedOrders\n //\n // {\n // \"order_id\":1736871726781,\n // \"symbol\":\"BTC_USDT\",\n // \"create_time\":1591096004000,\n // \"side\":\"sell\",\n // \"type\":\"market\", // limit, market, limit_maker, ioc\n // \"price\":\"0.00\",\n // \"price_avg\":\"0.00\",\n // \"size\":\"0.02000\",\n // \"notional\":\"0.00000000\",\n // \"filled_notional\":\"0.00000000\",\n // \"filled_size\":\"0.00000\",\n // \"status\":\"8\"\n // }\n //\n // spot v4\n // {\n // \"orderId\" : \"118100034543076010\",\n // \"clientOrderId\" : \"118100034543076010\",\n // \"symbol\" : \"BTC_USDT\",\n // \"side\" : \"buy\",\n // \"orderMode\" : \"spot\",\n // \"type\" : \"limit\",\n // \"state\" : \"filled\",\n // \"price\" : \"48800.00\",\n // \"priceAvg\" : \"39999.00\",\n // \"size\" : \"0.10000\",\n // \"filledSize\" : \"0.10000\",\n // \"notional\" : \"4880.00000000\",\n // \"filledNotional\" : \"3999.90000000\",\n // \"createTime\" : 1681701557927,\n // \"updateTime\" : 1681701559408\n // }\n //\n // swap: fetchOrder, fetchOpenOrders, fetchClosedOrders\n //\n // {\n // \"order_id\": \"230935812485489\",\n // \"client_order_id\": \"\",\n // \"price\": \"24000\",\n // \"size\": \"1\",\n // \"symbol\": \"BTCUSDT\",\n // \"state\": 2,\n // \"side\": 1,\n // \"type\": \"limit\",\n // \"leverage\": \"10\",\n // \"open_type\": \"isolated\",\n // \"deal_avg_price\": \"0\",\n // \"deal_size\": \"0\",\n // \"create_time\": 1695702258629,\n // \"update_time\": 1695702258642,\n // \"activation_price_type\": 0,\n // \"activation_price\": \"\",\n // \"callback_rate\": \"\"\n // }\n //\n let id = undefined;\n if (typeof order === 'string') {\n id = order;\n order = {};\n }\n id = this.safeString2 (order, 'order_id', 'orderId', id);\n const timestamp = this.safeInteger2 (order, 'create_time', 'createTime');\n const marketId = this.safeString (order, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n market = this.safeMarket (symbol, market);\n const orderType = this.safeString (market, 'type', 'spot');\n let type = this.safeString (order, 'type');\n let timeInForce = undefined;\n let postOnly = undefined;\n if (type === 'limit_maker') {\n type = 'limit';\n postOnly = true;\n timeInForce = 'PO';\n }\n if (type === 'ioc') {\n type = 'limit';\n timeInForce = 'IOC';\n }\n let priceString = this.safeString (order, 'price');\n if (priceString === 'market price') {\n priceString = undefined;\n }\n const trailingActivationPrice = this.safeNumber (order, 'activation_price');\n return this.safeOrder ({\n 'id': id,\n 'clientOrderId': this.safeString2 (order, 'client_order_id', 'clientOrderId'),\n 'info': order,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': this.safeInteger (order, 'update_time'),\n 'symbol': symbol,\n 'type': type,\n 'timeInForce': timeInForce,\n 'postOnly': postOnly,\n 'side': this.parseOrderSide (this.safeString (order, 'side')),\n 'price': this.omitZero (priceString),\n 'triggerPrice': trailingActivationPrice,\n 'amount': this.omitZero (this.safeString (order, 'size')),\n 'cost': this.safeString2 (order, 'filled_notional', 'filledNotional'),\n 'average': this.safeStringN (order, [ 'price_avg', 'priceAvg', 'deal_avg_price' ]),\n 'filled': this.safeStringN (order, [ 'filled_size', 'filledSize', 'deal_size' ]),\n 'remaining': undefined,\n 'status': this.parseOrderStatusByType (orderType, this.safeString2 (order, 'status', 'state')),\n 'fee': undefined,\n 'trades': undefined,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2714, "line_start" => 2706, "mappings" => [], "name" => "parseOrderSide", "signature" => "parseOrderSide (side)", "source" => "parseOrderSide (side) {\n const sides: Dict = {\n '1': 'buy',\n '2': 'buy',\n '3': 'sell',\n '4': 'sell',\n };\n return this.safeString (sides, side, side);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2740, "line_start" => 2716, "mappings" => [], "name" => "parseOrderStatusByType", "signature" => "parseOrderStatusByType (type, status)", "source" => "parseOrderStatusByType (type, status) {\n const statusesByType: Dict = {\n 'spot': {\n '1': 'rejected', // Order failure\n '2': 'open', // Placing order\n '3': 'rejected', // Order failure, Freeze failure\n '4': 'open', // Order success, Pending for fulfilment\n '5': 'open', // Partially filled\n '6': 'closed', // Fully filled\n '7': 'canceled', // Canceling\n '8': 'canceled', // Canceled\n 'new': 'open',\n 'partially_filled': 'open',\n 'filled': 'closed',\n 'partially_canceled': 'canceled',\n },\n 'swap': {\n '1': 'open', // Submitting\n '2': 'open', // Commissioned\n '4': 'closed', // Completed\n },\n };\n const statuses = this.safeDict (statusesByType, type, {});\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"leverage\": \"10\",\n \"timestamp\": 1696392515269,\n \"current_fee\": \"0.0014250028\",\n \"open_timestamp\": 1696392256998,\n \"current_value\": \"27.4039\",\n \"mark_price\": \"27.4039\",\n \"position_value\": \"27.4079\",\n \"position_cross\": \"3.75723474\",\n \"maintenance_margin\": \"0.1370395\",\n \"close_vol\": \"0\",\n \"close_avg_price\": \"0\",\n \"open_avg_price\": \"27407.9\",\n \"entry_price\": \"27407.9\",\n \"current_amount\": \"1\",\n \"unrealized_value\": \"-0.004\",\n \"realized_value\": \"-0.01644474\",\n \"position_type\": 1\n }" ], "line_end" => 5039, "line_start" => 4976, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "hedged", "value" => "undefined" }, %{ "comment" => nil, "key" => "side", "value" => "(side === 1) ? 'long' : 'short'" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.safeNumber (position, 'current_amount')" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.safeNumber (market, 'contractSize')" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "this.safeNumber (position, 'entry_price')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (position, 'mark_price')" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "notional", "value" => "this.parseNumber (notional)" }, %{ "comment" => nil, "key" => "leverage", "value" => "this.safeNumber (position, 'leverage')" }, %{ "comment" => nil, "key" => "collateral", "value" => "this.parseNumber (collateral)" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "undefined" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "this.parseNumber (maintenanceMargin)" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "this.parseNumber (maintenanceMarginPercentage)" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "this.safeNumber (position, 'unrealized_value')" }, %{ "comment" => nil, "key" => "realizedPnl", "value" => "this.safeNumber (position, 'realized_value')" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginMode", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "this.parseNumber (marginRatio)" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined)", "source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"leverage\": \"10\",\n // \"timestamp\": 1696392515269,\n // \"current_fee\": \"0.0014250028\",\n // \"open_timestamp\": 1696392256998,\n // \"current_value\": \"27.4039\",\n // \"mark_price\": \"27.4039\",\n // \"position_value\": \"27.4079\",\n // \"position_cross\": \"3.75723474\",\n // \"maintenance_margin\": \"0.1370395\",\n // \"close_vol\": \"0\",\n // \"close_avg_price\": \"0\",\n // \"open_avg_price\": \"27407.9\",\n // \"entry_price\": \"27407.9\",\n // \"current_amount\": \"1\",\n // \"unrealized_value\": \"-0.004\",\n // \"realized_value\": \"-0.01644474\",\n // \"position_type\": 1\n // }\n //\n const marketId = this.safeString (position, 'symbol');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n const timestamp = this.safeInteger (position, 'timestamp');\n const side = this.safeInteger (position, 'position_type');\n const maintenanceMargin = this.safeString (position, 'maintenance_margin');\n const notional = this.safeString (position, 'current_value');\n const collateral = this.safeString (position, 'position_cross');\n const maintenanceMarginPercentage = Precise.stringDiv (maintenanceMargin, notional);\n const marginRatio = Precise.stringDiv (maintenanceMargin, collateral);\n return this.safePosition ({\n 'info': position,\n 'id': undefined,\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastUpdateTimestamp': undefined,\n 'hedged': undefined,\n 'side': (side === 1) ? 'long' : 'short',\n 'contracts': this.safeNumber (position, 'current_amount'),\n 'contractSize': this.safeNumber (market, 'contractSize'),\n 'entryPrice': this.safeNumber (position, 'entry_price'),\n 'markPrice': this.safeNumber (position, 'mark_price'),\n 'lastPrice': undefined,\n 'notional': this.parseNumber (notional),\n 'leverage': this.safeNumber (position, 'leverage'),\n 'collateral': this.parseNumber (collateral),\n 'initialMargin': undefined,\n 'initialMarginPercentage': undefined,\n 'maintenanceMargin': this.parseNumber (maintenanceMargin),\n 'maintenanceMarginPercentage': this.parseNumber (maintenanceMarginPercentage),\n 'unrealizedPnl': this.safeNumber (position, 'unrealized_value'),\n 'realizedPnl': this.safeNumber (position, 'realized_value'),\n 'liquidationPrice': undefined,\n 'marginMode': undefined,\n 'percentage': undefined,\n 'marginRatio': this.parseNumber (marginRatio),\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n 'result': [\n \"AFIN_USDT\", // symbol\n \"0.001047\", // last\n \"11110\", // v_24h\n \"11.632170\", // qv_24h\n \"0.001048\", // open_24h\n \"0.001048\", // high_24h\n \"0.001047\", // low_24h\n \"-0.00095\", // price_change_24h\n \"0.001029\", // bid_px\n \"5555\", // bid_sz\n \"0.001041\", // ask_px\n \"5297\", // ask_sz\n \"1717122550482\" // timestamp\n ]\n }", "{\n \"symbol\": \"BTC_USDT\",\n \"last\": \"68500.00\",\n \"v_24h\": \"10491.65490\",\n \"qv_24h\": \"717178990.42\",\n \"open_24h\": \"68149.75\",\n \"high_24h\": \"69499.99\",\n \"low_24h\": \"67132.40\",\n \"fluctuation\": \"0.00514\",\n \"bid_px\": \"68500\",\n \"bid_sz\": \"0.00162\",\n \"ask_px\": \"68500.01\",\n \"ask_sz\": \"0.01722\",\n \"ts\": \"1717131391671\"\n }", "{\n \"symbol\":\"BTC_USDT\",\n \"last_price\":\"146.24\",\n \"open_24h\":\"147.17\",\n \"high_24h\":\"147.48\",\n \"low_24h\":\"143.88\",\n \"base_volume_24h\":\"117387.58\", // NOT base, but quote currency!!!\n \"s_t\": 1610936002\n }", "{\n \"symbol\": \"BTCUSDT\",\n \"product_type\": 1,\n \"open_timestamp\": 1645977600000,\n \"expire_timestamp\": 0,\n \"settle_timestamp\": 0,\n \"base_currency\": \"BTC\",\n \"quote_currency\": \"USDT\",\n \"last_price\": \"63547.4\",\n \"volume_24h\": \"110938430\",\n \"turnover_24h\": \"7004836342.6944\",\n \"index_price\": \"63587.85404255\",\n \"index_name\": \"BTCUSDT\",\n \"contract_size\": \"0.001\",\n \"min_leverage\": \"1\",\n \"max_leverage\": \"100\",\n \"price_precision\": \"0.1\",\n \"vol_precision\": \"1\",\n \"max_volume\": \"1000000\",\n \"min_volume\": \"1\",\n \"funding_rate\": \"0.0000801\",\n \"expected_funding_rate\": \"-0.0000035\",\n \"open_interest\": \"278214\",\n \"open_interest_value\": \"17555316.9355496\",\n \"high_24h\": \"64109.4\",\n \"low_24h\": \"61857.6\",\n \"change_24h\": \"0.0239264900886327\",\n \"funding_time\": 1726819200000\n }" ], "line_end" => 1587, "line_start" => 1428, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "high", "value" => "high" }, %{ "comment" => nil, "key" => "low", "value" => "low" }, %{ "comment" => nil, "key" => "bid", "value" => "bid" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "bidVolume" }, %{ "comment" => nil, "key" => "ask", "value" => "ask" }, %{ "comment" => nil, "key" => "askVolume", "value" => "askVolume" }, %{ "comment" => nil, "key" => "vwap", "value" => "undefined" }, %{ "comment" => nil, "key" => "open", "value" => "open" }, %{ "comment" => nil, "key" => "close", "value" => "last" }, %{ "comment" => nil, "key" => "last", "value" => "last" }, %{ "comment" => nil, "key" => "previousClose", "value" => "undefined" }, %{ "comment" => nil, "key" => "change", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "percentage" }, %{ "comment" => nil, "key" => "average", "value" => "average" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "baseVolume" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "quoteVolume" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeString (ticker, 'index_price')" }, %{ "comment" => nil, "key" => "info", "value" => "ticker" } ], "name" => "parseTicker", "signature" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker", "source" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker {\n //\n // spot (REST) fetchTickers\n //\n // {\n // 'result': [\n // \"AFIN_USDT\", // symbol\n // \"0.001047\", // last\n // \"11110\", // v_24h\n // \"11.632170\", // qv_24h\n // \"0.001048\", // open_24h\n // \"0.001048\", // high_24h\n // \"0.001047\", // low_24h\n // \"-0.00095\", // price_change_24h\n // \"0.001029\", // bid_px\n // \"5555\", // bid_sz\n // \"0.001041\", // ask_px\n // \"5297\", // ask_sz\n // \"1717122550482\" // timestamp\n // ]\n // }\n //\n // spot (REST) fetchTicker\n //\n // {\n // \"symbol\": \"BTC_USDT\",\n // \"last\": \"68500.00\",\n // \"v_24h\": \"10491.65490\",\n // \"qv_24h\": \"717178990.42\",\n // \"open_24h\": \"68149.75\",\n // \"high_24h\": \"69499.99\",\n // \"low_24h\": \"67132.40\",\n // \"fluctuation\": \"0.00514\",\n // \"bid_px\": \"68500\",\n // \"bid_sz\": \"0.00162\",\n // \"ask_px\": \"68500.01\",\n // \"ask_sz\": \"0.01722\",\n // \"ts\": \"1717131391671\"\n // }\n //\n // spot (WS)\n //\n // {\n // \"symbol\":\"BTC_USDT\",\n // \"last_price\":\"146.24\",\n // \"open_24h\":\"147.17\",\n // \"high_24h\":\"147.48\",\n // \"low_24h\":\"143.88\",\n // \"base_volume_24h\":\"117387.58\", // NOT base, but quote currency!!!\n // \"s_t\": 1610936002\n // }\n //\n // swap\n //\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"product_type\": 1,\n // \"open_timestamp\": 1645977600000,\n // \"expire_timestamp\": 0,\n // \"settle_timestamp\": 0,\n // \"base_currency\": \"BTC\",\n // \"quote_currency\": \"USDT\",\n // \"last_price\": \"63547.4\",\n // \"volume_24h\": \"110938430\",\n // \"turnover_24h\": \"7004836342.6944\",\n // \"index_price\": \"63587.85404255\",\n // \"index_name\": \"BTCUSDT\",\n // \"contract_size\": \"0.001\",\n // \"min_leverage\": \"1\",\n // \"max_leverage\": \"100\",\n // \"price_precision\": \"0.1\",\n // \"vol_precision\": \"1\",\n // \"max_volume\": \"1000000\",\n // \"min_volume\": \"1\",\n // \"funding_rate\": \"0.0000801\",\n // \"expected_funding_rate\": \"-0.0000035\",\n // \"open_interest\": \"278214\",\n // \"open_interest_value\": \"17555316.9355496\",\n // \"high_24h\": \"64109.4\",\n // \"low_24h\": \"61857.6\",\n // \"change_24h\": \"0.0239264900886327\",\n // \"funding_time\": 1726819200000\n // }\n //\n const result = this.safeList (ticker, 'result', []);\n const average = this.safeString2 (ticker, 'avg_price', 'index_price');\n let marketId = this.safeString2 (ticker, 'symbol', 'contract_symbol');\n let timestamp = this.safeInteger2 (ticker, 'timestamp', 'ts');\n let last = this.safeString2 (ticker, 'last_price', 'last');\n let percentage = this.safeString2 (ticker, 'price_change_percent_24h', 'change_24h');\n let change = this.safeString (ticker, 'fluctuation');\n let high = this.safeString2 (ticker, 'high_24h', 'high_price');\n let low = this.safeString2 (ticker, 'low_24h', 'low_price');\n let bid = this.safeString2 (ticker, 'best_bid', 'bid_px');\n let bidVolume = this.safeString2 (ticker, 'best_bid_size', 'bid_sz');\n let ask = this.safeString2 (ticker, 'best_ask', 'ask_px');\n let askVolume = this.safeString2 (ticker, 'best_ask_size', 'ask_sz');\n let open = this.safeString (ticker, 'open_24h');\n let baseVolume = this.safeStringN (ticker, [ 'base_volume_24h', 'v_24h', 'volume_24h' ]);\n let quoteVolume = this.safeStringLowerN (ticker, [ 'quote_volume_24h', 'qv_24h', 'turnover_24h' ]);\n const listMarketId = this.safeString (result, 0);\n if (listMarketId !== undefined) {\n marketId = listMarketId;\n timestamp = this.safeInteger (result, 12);\n high = this.safeString (result, 5);\n low = this.safeString (result, 6);\n bid = this.safeString (result, 8);\n bidVolume = this.safeString (result, 9);\n ask = this.safeString (result, 10);\n askVolume = this.safeString (result, 11);\n open = this.safeString (result, 4);\n last = this.safeString (result, 1);\n change = this.safeString (result, 7);\n baseVolume = this.safeString (result, 2);\n quoteVolume = this.safeStringLower (result, 3);\n }\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n if (timestamp === undefined) {\n // ticker from WS has a different field (in seconds)\n timestamp = this.safeIntegerProduct (ticker, 's_t', 1000);\n }\n if (percentage === undefined) {\n percentage = Precise.stringMul (change, '100');\n }\n if (quoteVolume === undefined) {\n if (baseVolume === undefined) {\n // this is swap\n quoteVolume = this.safeString (ticker, 'volume_24h', quoteVolume);\n } else {\n // this is a ticker from websockets\n // contrary to name and documentation, base_volume_24h is actually the quote volume\n quoteVolume = baseVolume;\n baseVolume = undefined;\n }\n }\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': high,\n 'low': low,\n 'bid': bid,\n 'bidVolume': bidVolume,\n 'ask': ask,\n 'askVolume': askVolume,\n 'vwap': undefined,\n 'open': open,\n 'close': last,\n 'last': last,\n 'previousClose': undefined,\n 'change': undefined,\n 'percentage': percentage,\n 'average': average,\n 'baseVolume': baseVolume,\n 'quoteVolume': quoteVolume,\n 'indexPrice': this.safeString (ticker, 'index_price'),\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "[\n \"BTC_USDT\", // symbol\n \"1717212457302\", // timestamp\n \"67643.11\", // price\n \"0.00106\", // size\n \"sell\" // side\n ]", "{\n \"tradeId\":\"182342999769370687\",\n \"orderId\":\"183270218784142990\",\n \"clientOrderId\":\"183270218784142990\",\n \"symbol\":\"ADA_USDT\",\n \"side\":\"buy\",\n \"orderMode\":\"spot\",\n \"type\":\"market\",\n \"price\":\"0.245948\",\n \"size\":\"20.71\",\n \"notional\":\"5.09358308\",\n \"fee\":\"0.00509358\",\n \"feeCoinName\":\"USDT\",\n \"tradeRole\":\"taker\",\n \"createTime\":1695658457836,\n }", "{\n \"order_id\": \"230930336848609\",\n \"trade_id\": \"6212604014\",\n \"symbol\": \"BTCUSDT\",\n \"side\": 3,\n \"price\": \"26910.4\",\n \"vol\": \"1\",\n \"exec_type\": \"Taker\",\n \"profit\": false,\n \"create_time\": 1695961596692,\n \"realised_profit\": \"-0.0003\",\n \"paid_fees\": \"0.01614624\"\n }", "{\n 'fee': '-0.000044502',\n 'feeCcy': 'USDT',\n 'fillPrice': '74.17',\n 'fillQty': '1',\n 'lastTradeID': 6802340762\n }" ], "line_end" => 1981, "line_start" => 1877, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "trade" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeStringN (trade, [ 'tradeId', 'trade_id', 'lastTradeID' ])" }, %{ "comment" => nil, "key" => "order", "value" => "this.safeString2 (trade, 'orderId', 'order_id')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeStringN (trade, [ 'price', 'fillPrice', 2 ])" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "cost", "value" => "cost" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "this.safeStringLower2 (trade, 'tradeRole', 'exec_type')" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // public fetchTrades spot ( amount = count * price )\n //\n // [\n // \"BTC_USDT\", // symbol\n // \"1717212457302\", // timestamp\n // \"67643.11\", // price\n // \"0.00106\", // size\n // \"sell\" // side\n // ]\n //\n // spot: fetchMyTrades\n //\n // {\n // \"tradeId\":\"182342999769370687\",\n // \"orderId\":\"183270218784142990\",\n // \"clientOrderId\":\"183270218784142990\",\n // \"symbol\":\"ADA_USDT\",\n // \"side\":\"buy\",\n // \"orderMode\":\"spot\",\n // \"type\":\"market\",\n // \"price\":\"0.245948\",\n // \"size\":\"20.71\",\n // \"notional\":\"5.09358308\",\n // \"fee\":\"0.00509358\",\n // \"feeCoinName\":\"USDT\",\n // \"tradeRole\":\"taker\",\n // \"createTime\":1695658457836,\n // }\n //\n // swap: fetchMyTrades\n //\n // {\n // \"order_id\": \"230930336848609\",\n // \"trade_id\": \"6212604014\",\n // \"symbol\": \"BTCUSDT\",\n // \"side\": 3,\n // \"price\": \"26910.4\",\n // \"vol\": \"1\",\n // \"exec_type\": \"Taker\",\n // \"profit\": false,\n // \"create_time\": 1695961596692,\n // \"realised_profit\": \"-0.0003\",\n // \"paid_fees\": \"0.01614624\"\n // }\n //\n // ws swap\n //\n // {\n // 'fee': '-0.000044502',\n // 'feeCcy': 'USDT',\n // 'fillPrice': '74.17',\n // 'fillQty': '1',\n // 'lastTradeID': 6802340762\n // }\n //\n const timestamp = this.safeIntegerN (trade, [ 'createTime', 'create_time', 1 ]);\n const isPublic = this.safeString (trade, 0);\n const isPublicTrade = (isPublic !== undefined);\n let amount = undefined;\n let cost = undefined;\n let type = undefined;\n let side = undefined;\n if (isPublicTrade) {\n amount = this.safeString2 (trade, 'count', 3);\n cost = this.safeString (trade, 'amount');\n side = this.safeString2 (trade, 'type', 4);\n } else {\n amount = this.safeStringN (trade, [ 'size', 'vol', 'fillQty' ]);\n cost = this.safeString (trade, 'notional');\n type = this.safeString (trade, 'type');\n side = this.parseOrderSide (this.safeString (trade, 'side'));\n }\n const marketId = this.safeString2 (trade, 'symbol', 0);\n market = this.safeMarket (marketId, market);\n const feeCostString = this.safeString2 (trade, 'fee', 'paid_fees');\n let fee = undefined;\n if (feeCostString !== undefined) {\n const feeCurrencyId = this.safeString (trade, 'feeCoinName');\n let feeCurrencyCode = this.safeCurrencyCode (feeCurrencyId);\n if (feeCurrencyCode === undefined) {\n feeCurrencyCode = (side === 'buy') ? market['base'] : market['quote'];\n }\n fee = {\n 'cost': feeCostString,\n 'currency': feeCurrencyCode,\n };\n }\n return this.safeTrade ({\n 'info': trade,\n 'id': this.safeStringN (trade, [ 'tradeId', 'trade_id', 'lastTradeID' ]),\n 'order': this.safeString2 (trade, 'orderId', 'order_id'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': market['symbol'],\n 'type': type,\n 'side': side,\n 'price': this.safeStringN (trade, [ 'price', 'fillPrice', 2 ]),\n 'amount': amount,\n 'cost': cost,\n 'takerOrMaker': this.safeStringLower2 (trade, 'tradeRole', 'exec_type'),\n 'fee': fee,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"ETH_USDT\",\n \"taker_fee_rate\": \"0.0025\",\n \"maker_fee_rate\": \"0.0025\"\n }" ], "line_end" => 2540, "line_start" => 2522, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber (fee, 'maker_fee_rate')" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber (fee, 'taker_fee_rate')" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "tierBased", "value" => "undefined" } ], "name" => "parseTradingFee", "signature" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface", "source" => "parseTradingFee (fee: Dict, market: Market = undefined): TradingFeeInterface {\n //\n // {\n // \"symbol\": \"ETH_USDT\",\n // \"taker_fee_rate\": \"0.0025\",\n // \"maker_fee_rate\": \"0.0025\"\n // }\n //\n const marketId = this.safeString (fee, 'symbol');\n const symbol = this.safeSymbol (marketId);\n return {\n 'info': fee,\n 'symbol': symbol,\n 'maker': this.safeNumber (fee, 'maker_fee_rate'),\n 'taker': this.safeNumber (fee, 'taker_fee_rate'),\n 'percentage': undefined,\n 'tierBased': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"withdraw_id\": \"121212\"\n }", "{\n \"withdraw_id\":\"1679952\",\n \"deposit_id\":\"\",\n \"operation_type\":\"withdraw\",\n \"currency\":\"BMX\",\n \"apply_time\":1588867374000,\n \"arrival_amount\":\"59.000000000000\",\n \"fee\":\"1.000000000000\",\n \"status\":0,\n \"address\":\"0xe57b69a8776b37860407965B73cdFFBDFe668Bb5\",\n \"address_memo\":\"\",\n \"tx_id\":\"\"\n }" ], "line_end" => 4100, "line_start" => 4019, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "network", "value" => "this.networkIdToCode (networkId)" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "tag", "value" => "tag" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "updated", "value" => "undefined" }, %{ "comment" => nil, "key" => "txid", "value" => "txid" }, %{ "comment" => nil, "key" => "internal", "value" => "undefined" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "(timestamp !== 0) ? timestamp : undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "(timestamp !== 0) ? this.iso8601 (timestamp) : undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseTransaction", "signature" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction", "source" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {\n //\n // withdraw\n //\n // {\n // \"withdraw_id\": \"121212\"\n // }\n //\n // fetchDeposits, fetchWithdrawals, fetchWithdrawal\n //\n // {\n // \"withdraw_id\":\"1679952\",\n // \"deposit_id\":\"\",\n // \"operation_type\":\"withdraw\",\n // \"currency\":\"BMX\",\n // \"apply_time\":1588867374000,\n // \"arrival_amount\":\"59.000000000000\",\n // \"fee\":\"1.000000000000\",\n // \"status\":0,\n // \"address\":\"0xe57b69a8776b37860407965B73cdFFBDFe668Bb5\",\n // \"address_memo\":\"\",\n // \"tx_id\":\"\"\n // }\n //\n let id = undefined;\n const withdrawId = this.safeString (transaction, 'withdraw_id');\n const depositId = this.safeString (transaction, 'deposit_id');\n let type = undefined;\n if ((withdrawId !== undefined) && (withdrawId !== '')) {\n type = 'withdraw';\n id = withdrawId;\n } else if ((depositId !== undefined) && (depositId !== '')) {\n type = 'deposit';\n id = depositId;\n }\n const amount = this.safeNumber (transaction, 'arrival_amount');\n const timestamp = this.safeInteger (transaction, 'apply_time');\n let currencyId = this.safeString (transaction, 'currency');\n let networkId: Str = undefined;\n if (currencyId !== undefined) {\n if (currencyId.indexOf ('NFT') < 0) {\n const parts = currencyId.split ('-');\n currencyId = this.safeString (parts, 0);\n networkId = this.safeString (parts, 1);\n }\n }\n const code = this.safeCurrencyCode (currencyId, currency);\n const status = this.parseTransactionStatus (this.safeString (transaction, 'status'));\n const feeCost = this.safeNumber (transaction, 'fee');\n let fee = undefined;\n if (feeCost !== undefined) {\n fee = {\n 'cost': feeCost,\n 'currency': code,\n };\n }\n const txid = this.safeString (transaction, 'tx_id');\n const address = this.safeString (transaction, 'address');\n const tag = this.safeString (transaction, 'address_memo');\n return {\n 'info': transaction,\n 'id': id,\n 'currency': code,\n 'amount': amount,\n 'network': this.networkIdToCode (networkId),\n 'address': address,\n 'addressFrom': undefined,\n 'addressTo': undefined,\n 'tag': tag,\n 'tagFrom': undefined,\n 'tagTo': undefined,\n 'status': status,\n 'type': type,\n 'updated': undefined,\n 'txid': txid,\n 'internal': undefined,\n 'comment': undefined,\n 'timestamp': (timestamp !== 0) ? timestamp : undefined,\n 'datetime': (timestamp !== 0) ? this.iso8601 (timestamp) : undefined,\n 'fee': fee,\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4017, "line_start" => 4007, "mappings" => [], "name" => "parseTransactionStatus", "signature" => "parseTransactionStatus (status: Str)", "source" => "parseTransactionStatus (status: Str) {\n const statuses: Dict = {\n '0': 'pending', // Create\n '1': 'pending', // Submitted, waiting for withdrawal\n '2': 'pending', // Processing\n '3': 'ok', // Success\n '4': 'canceled', // Cancel\n '5': 'failed', // Fail\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"transfer_id\": \"ca90d97a621e47d49774f19af6b029f5\"\n }", "{\n \"currency\": \"USDT\",\n \"amount\": \"5\"\n }", "{\n \"transfer_id\": \"902463535961567232\",\n \"currency\": \"USDT\",\n \"amount\": \"5\",\n \"type\": \"contract_to_spot\",\n \"state\": \"FINISHED\",\n \"timestamp\": 1695330539565\n }" ], "line_end" => 4489, "line_start" => 4451, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString (transfer, 'transfer_id')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (currencyId, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeNumber (transfer, 'amount')" }, %{ "comment" => nil, "key" => "fromAccount", "value" => "this.parseTransferFromAccount (this.safeString (transfer, 'type'))" }, %{ "comment" => nil, "key" => "toAccount", "value" => "this.parseTransferToAccount (this.safeString (transfer, 'type'))" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseTransferStatus (this.safeString (transfer, 'state'))" } ], "name" => "parseTransfer", "signature" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry", "source" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry {\n //\n // margin\n //\n // {\n // \"transfer_id\": \"ca90d97a621e47d49774f19af6b029f5\"\n // }\n //\n // swap\n //\n // {\n // \"currency\": \"USDT\",\n // \"amount\": \"5\"\n // }\n //\n // fetchTransfers\n //\n // {\n // \"transfer_id\": \"902463535961567232\",\n // \"currency\": \"USDT\",\n // \"amount\": \"5\",\n // \"type\": \"contract_to_spot\",\n // \"state\": \"FINISHED\",\n // \"timestamp\": 1695330539565\n // }\n //\n const currencyId = this.safeString (transfer, 'currency');\n const timestamp = this.safeInteger (transfer, 'timestamp');\n return {\n 'id': this.safeString (transfer, 'transfer_id'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'currency': this.safeCurrencyCode (currencyId, currency),\n 'amount': this.safeNumber (transfer, 'amount'),\n 'fromAccount': this.parseTransferFromAccount (this.safeString (transfer, 'type')),\n 'toAccount': this.parseTransferToAccount (this.safeString (transfer, 'type')),\n 'status': this.parseTransferStatus (this.safeString (transfer, 'state')),\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4449, "line_start" => 4443, "mappings" => [], "name" => "parseTransferFromAccount", "signature" => "parseTransferFromAccount (type)", "source" => "parseTransferFromAccount (type) {\n const types: Dict = {\n 'contract_to_spot': 'swap',\n 'spot_to_contract': 'spot',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4433, "line_start" => 4426, "mappings" => [], "name" => "parseTransferStatus", "signature" => "parseTransferStatus (status: Str): Str", "source" => "parseTransferStatus (status: Str): Str {\n const statuses: Dict = {\n '1000': 'ok',\n 'OK': 'ok',\n 'FINISHED': 'ok',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4441, "line_start" => 4435, "mappings" => [], "name" => "parseTransferToAccount", "signature" => "parseTransferToAccount (type)", "source" => "parseTransferToAccount (type) {\n const types: Dict = {\n 'contract_to_spot': 'spot',\n 'spot_to_contract': 'swap',\n };\n return this.safeString (types, type, type);\n }" } ], path_prefix: "", pro: true, quote_json_numbers: nil, rate_limits: %{ interval_ms: 33, period: 1000, requests: 30, rolling_window_size: 60000 }, raw_endpoints: %{ private: [ %{ auth: false, cost: 1.2, method: :get, path: "/contract/private/order" }, %{ auth: false, cost: 10, method: :get, path: "/contract/private/position-v2" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v1/margin/isolated/repay_record" }, %{ auth: false, cost: 10, method: :get, path: "/contract/private/affilate/trade-list" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v1/wallet" }, %{ auth: false, cost: 30, method: :get, path: "/spot/v1/user_fee" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v1/margin/isolated/borrow_record" }, %{ auth: false, cost: 10, method: :get, path: "/contract/private/trades" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v1/margin/isolated/account" }, %{ auth: false, cost: 1.2, method: :get, path: "/contract/private/get-open-orders" }, %{ auth: false, cost: 7.5, method: :get, path: "/account/v1/deposit-withdraw/detail" }, %{ auth: false, cost: 7.5, method: :get, path: "/account/contract/sub-account/v1/transfer-history" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v3/orders" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v1/trades" }, %{ auth: false, cost: 32, method: :get, path: "/account/v1/withdraw/charge" }, %{ auth: false, cost: 10, method: :get, path: "/contract/private/affilate/rebate-list" }, %{ auth: false, cost: 7.5, method: :get, path: "/account/sub-account/main/v1/subaccount-list" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v2/orders" }, %{ auth: false, cost: 7.5, method: :get, path: "/account/sub-account/v1/transfer-history" }, %{ auth: false, cost: 10, method: :get, path: "/contract/private/position" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v1/broker/rebate" }, %{ auth: false, cost: 10, method: :get, path: "/contract/private/position-risk" }, %{ auth: false, cost: 30, method: :get, path: "/account/v1/withdraw/address/list" }, %{ auth: false, cost: 30, method: :get, path: "/spot/v1/trade_fee" }, %{ auth: false, cost: 30, method: :get, path: "/spot/v1/margin/isolated/pairs" }, %{ auth: false, cost: 1, method: :get, path: "/contract/private/get-position-mode" }, %{ auth: false, cost: 30, method: :get, path: "/account/v1/deposit/address" }, %{ auth: false, cost: 10, method: :get, path: "/contract/private/transaction-history" }, %{ auth: false, cost: 4, method: :get, path: "/spot/v2/trades" }, %{ auth: false, cost: 7.5, method: :get, path: "/account/sub-account/v1/transfer-list" }, %{ auth: false, cost: 5, method: :get, path: "/account/sub-account/main/v1/wallet" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v1/order_detail" }, %{ auth: false, cost: 5, method: :get, path: "/account/contract/sub-account/main/v1/wallet" }, %{ auth: false, cost: 7.5, method: :get, path: "/account/v2/deposit-withdraw/history" }, %{ auth: false, cost: 1, method: :get, path: "/spot/v2/order_detail" }, %{ auth: false, cost: 5, method: :get, path: "/contract/private/assets-detail" }, %{ auth: false, cost: 7.5, method: :get, path: "/account/contract/sub-account/main/v1/transfer-list" }, %{ auth: false, cost: 5, method: :get, path: "/account/v1/wallet" }, %{ auth: false, cost: 10, method: :get, path: "/contract/private/order-history" }, %{ auth: false, cost: 1.2, method: :get, path: "/contract/private/current-plan-order" }, %{ auth: false, cost: 30, method: :get, path: "/account/v1/currencies" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/private/submit-tp-sl-order" }, %{ auth: false, cost: 1.5, method: :post, path: "/contract/private/cancel-plan-order" }, %{ auth: false, cost: 1.5, method: :post, path: "/spot/v1/margin/submit_order" }, %{ auth: false, cost: 30, method: :post, path: "/account/sub-account/sub/v1/sub-to-main" }, %{ auth: false, cost: 3, method: :post, path: "/spot/v4/cancel_orders" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/private/modify-tp-sl-order" }, %{ auth: false, cost: 1, method: :post, path: "/contract/private/set-position-mode" }, %{ auth: false, cost: 5, method: :post, path: "/spot/v4/query/order-trades" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/private/modify-limit-order" }, %{ auth: false, cost: 5, method: :post, path: "/spot/v4/query/trades" }, %{ auth: false, cost: 30, method: :post, path: "/spot/v1/margin/isolated/transfer" }, %{ auth: false, cost: 1, method: :post, path: "/spot/v2/cancel_order" }, %{ auth: false, cost: 1, method: :post, path: "/spot/v4/query/client-order" }, %{ auth: false, cost: 30, method: :post, path: "/spot/v1/margin/isolated/borrow" }, %{ auth: false, cost: 30, method: :post, path: "/spot/v1/margin/isolated/repay" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/private/submit-plan-order" }, %{ auth: false, cost: 1, method: :post, path: "/spot/v2/submit_order" }, %{ auth: false, cost: 7.5, method: :post, path: "/account/contract/sub-account/main/v1/sub-to-main" }, %{ auth: false, cost: 7.5, method: :post, path: "/account/contract/sub-account/main/v1/main-to-sub" }, %{ auth: false, cost: 1, method: :post, path: "/spot/v1/batch_orders" }, %{ auth: false, cost: 7.5, method: :post, path: "/account/contract/sub-account/sub/v1/sub-to-main" }, %{ auth: false, cost: 1.5, method: :post, path: "/contract/private/cancel-order" }, %{ auth: false, cost: 5, method: :post, path: "/spot/v4/query/open-orders" }, %{ auth: false, cost: 1.5, method: :post, path: "/contract/private/cancel-trail-order" }, %{ auth: false, cost: 30, method: :post, path: "/account/sub-account/main/v1/sub-to-main" }, %{ auth: false, cost: 60, method: :post, path: "/account/v1/transfer-contract" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/private/submit-leverage" }, %{ auth: false, cost: 30, method: :post, path: "/contract/private/cancel-orders" }, %{ auth: false, cost: 30, method: :post, path: "/account/sub-account/main/v1/sub-to-sub" }, %{ auth: false, cost: 60, method: :post, path: "/account/v1/transfer-contract-list" }, %{ auth: false, cost: 5, method: :post, path: "/spot/v4/query/history-orders" }, %{ auth: false, cost: 15, method: :post, path: "/spot/v1/cancel_orders" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/private/submit-order" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/private/modify-preset-plan-order" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/private/submit-trail-order" }, %{ auth: false, cost: 1, method: :post, path: "/spot/v3/cancel_order" }, %{ auth: false, cost: 1, method: :post, path: "/spot/v1/submit_order" }, %{ auth: false, cost: 3, method: :post, path: "/spot/v4/batch_orders" }, %{ auth: false, cost: 2.5, method: :post, path: "/contract/private/modify-plan-order" }, %{ auth: false, cost: 30, method: :post, path: "/account/sub-account/main/v1/main-to-sub" }, %{ auth: false, cost: 1, method: :post, path: "/spot/v4/query/order" }, %{ auth: false, cost: 7.5, method: :post, path: "/account/v1/withdraw/apply" }, %{ auth: false, cost: 30, method: :post, path: "/account/sub-account/sub/v1/sub-to-sub" }, %{ auth: false, cost: 90, method: :post, path: "/spot/v4/cancel_all" }, %{ auth: false, cost: 1, method: :post, path: "/spot/v2/batch_orders" } ], public: [ %{ auth: false, cost: 30, method: :get, path: "/account/v1/currencies" }, %{ auth: false, cost: 5, method: :get, path: "/contract/public/depth" }, %{ auth: false, cost: 5, method: :get, path: "/contract/public/details" }, %{ auth: false, cost: 30, method: :get, path: "/contract/public/funding-rate" }, %{ auth: false, cost: 30, method: :get, path: "/contract/public/funding-rate-history" }, %{ auth: false, cost: 6, method: :get, path: "/contract/public/kline" }, %{ auth: false, cost: 5, method: :get, path: "/contract/public/markprice-kline" }, %{ auth: false, cost: 30, method: :get, path: "/contract/public/open-interest" }, %{ auth: false, cost: 15, method: :get, path: "/contract/v1/tickers" }, %{ auth: false, cost: 4, method: :get, path: "/spot/quotation/v3/books" }, %{ auth: false, cost: 7, method: :get, path: "/spot/quotation/v3/klines" }, %{ auth: false, cost: 5, method: :get, path: "/spot/quotation/v3/lite-klines" }, %{ auth: false, cost: 4, method: :get, path: "/spot/quotation/v3/ticker" }, %{ auth: false, cost: 6, method: :get, path: "/spot/quotation/v3/tickers" }, %{ auth: false, cost: 4, method: :get, path: "/spot/quotation/v3/trades" }, %{ auth: false, cost: 7.5, method: :get, path: "/spot/v1/currencies" }, %{ auth: false, cost: 30, method: :get, path: "/spot/v1/steps" }, %{ auth: false, cost: 7.5, method: :get, path: "/spot/v1/symbols" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v1/symbols/book" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v1/symbols/details" }, %{ auth: false, cost: 6, method: :get, path: "/spot/v1/symbols/kline" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v1/symbols/trades" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v1/ticker" }, %{ auth: false, cost: 5, method: :get, path: "/spot/v1/ticker_detail" }, %{ auth: false, cost: 30, method: :get, path: "/spot/v2/ticker" }, %{ auth: false, cost: 3, method: :get, path: "/system/service" }, %{ auth: false, cost: 3, method: :get, path: "/system/time" } ] }, required_credentials: %{ api_key: true, password: false, secret: true, uid: true }, requires_eddsa: false, response_error: %{ code_field: "code", field: "message", message_field: "message", success_values: [ "ok", "OK" ], type: :success_message }, signing: %{ api_key_header: "X-BM-KEY", confidence: :high, pattern: :hmac_sha256_headers, signature_header: "X-BM-SIGN", timestamp_header: "X-BM-TIMESTAMP" }, spec_format_version: 1, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ precision_mode: 4, sample_limits: %{ "amount" => %{ "min" => 1 }, "cost" => %{ "min" => 5 }, "price" => %{} }, sample_precision: %{ "amount" => 1, "price" => 1.0e-5 }, spot: %{ base: "$NUT", base_id: "$NUT", case: :upper, contract: false, id: "$NUT_USDT", limits: %{ "amount" => %{ "min" => 1 }, "cost" => %{ "min" => 5 }, "leverage" => %{}, "price" => %{} }, maker: 0.0035, precision: %{ "amount" => 1, "price" => 1.0e-5 }, quote: "USDT", quote_id: "USDT", separator: "_", symbol: "$NUT/USDT", taker: 0.004 }, swap: %{ base: "BTC", base_id: "BTC", case: :upper, contract: true, contract_size: 0.001, id: "BTCUSDT", inverse: false, limits: %{ "amount" => %{ "max" => 500000, "min" => 1 }, "cost" => %{}, "leverage" => %{ "max" => 200, "min" => 1 }, "price" => %{} }, linear: true, maker: 0.0035, precision: %{ "amount" => 1, "price" => 0.1 }, quote: "USDT", quote_id: "USDT", separator: "", settle: "USDT", settle_id: "USDT", symbol: "BTC/USDT:USDT", taker: 0.004 } }, symbol_patterns: %{ spot: %{ case: :upper, component_order: nil, date_format: nil, pattern: :underscore_upper, separator: "_", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :implicit, separator: "", suffix: nil } }, timeframes: %{ "15m" => 15, "1M" => 43200, "1d" => 1440, "1h" => 60, "1m" => 1, "1w" => 10080, "2h" => 120, "30m" => 30, "3h" => 180, "3m" => 3, "45m" => 45, "4h" => 240, "5m" => 5 }, url_strategy: %{ detected_from: "fallback", pattern: :no_prefix, prefix: nil }, urls: %{ api: "https://api-cloud.bitmart.com", api_sections: %{ "spot" => "https://api-cloud.bitmart.com", "swap" => "https://api-cloud-v2.bitmart.com" }, doc: "https://developer-pro.bitmart.com/", other: nil, sandbox: nil, www: "https://www.bitmart.com/" }, version: "v2", ws: %{ auth: %{ algorithm: :sha256, encoding: :hex, market_specific: false, message_format: :op_args, op_field: "op", op_value: "login", pattern: :generic_hmac, payload_format: "custom", requires_passphrase: false, timestamp_unit: :milliseconds }, channel_templates: %{ watch_balance: %{ auth_required: true, market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_bids_asks: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_ohlcv: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "interval" }, %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_order_book: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_order_book_for_symbols: %{ channel_name: "depth/increase100", market_id_format: :native, params: [ %{ "default" => "depth/increase100", "name" => "depth" }, %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_orders: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_positions: %{ auth_required: true, market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_ticker: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_tickers: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_trades: %{ channel_name: "trade", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_trades_for_symbols: %{ channel_name: "trade", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." } }, has: %{ watch_balance: true, watch_bids_asks: true, watch_liquidations: nil, watch_liquidations_for_symbols: nil, watch_my_liquidations: nil, watch_my_liquidations_for_symbols: nil, watch_my_trades: nil, watch_ohlcv: true, watch_ohlcv_for_symbols: nil, watch_order_book: true, watch_order_book_for_symbols: true, watch_orders: true, watch_orders_for_symbols: nil, watch_position: "emulated", watch_positions: true, watch_status: nil, watch_ticker: true, watch_tickers: true, watch_trades: true, watch_trades_for_symbols: true }, hostname: "bitmart.com", message_patterns: [ %{ args_field: "args", format: :action, keys: [ "action", "args" ], kind_field: "action", kind_value: "access", sources: [ :send, :watch ] }, %{ args_field: "args", format: :action, keys: [ "action", "args" ], kind_field: "action", kind_value: "subscribe", sources: [ :send, :watch, :watch_multiple ] }, %{ args_field: "args", format: :op, keys: [ "args", "op" ], kind_field: "op", kind_value: "login", sources: [ :send, :watch ] }, %{ args_field: "args", format: :op, keys: [ "args", "op" ], kind_field: "op", kind_value: "subscribe", sources: [ :send, :watch, :watch_multiple ] }, %{ args_field: "args", format: :op, keys: [ "args", "op" ], kind_field: "op", kind_value: "unsubscribe", sources: [ :send, :watch, :watch_multiple ] } ], options: %{ "watchBalance" => %{ "awaitBalanceSnapshot" => false, "fetchBalanceSnapshot" => true }, "watchOrderBook" => %{ "depth" => "depth/increase100" }, "watchOrderBookForSymbols" => %{ "depth" => "depth/increase100" }, "watchTrades" => %{ "ignoreDuplicates" => true }, "ws" => %{ "inflate" => true } }, streaming: %{ keep_alive: 15000 }, subscription_config: %{ args_field: "args", args_format: :string_list, market_id_format: :native, op_field: "op", separator: "." }, subscription_pattern: :op_subscribe, urls: %{ "spot" => %{ "private" => "wss://ws-manager-compress.{hostname}/user?protocol=1.1", "public" => "wss://ws-manager-compress.{hostname}/api?protocol=1.1" }, "swap" => %{ "private" => "wss://openapi-ws-v2.{hostname}/user?protocol=1.1", "public" => "wss://openapi-ws-v2.{hostname}/api?protocol=1.1" } }, watch_methods: [ "watchBalance", "watchBidsAsks", "watchOHLCV", "watchOrderBook", "watchOrderBookForSymbols", "watchOrders", "watchPositions", "watchTicker", "watchTickers", "watchTrades", "watchTradesForSymbols" ] } }