# CoinCatch Exchange Specification # # Auto-generated by: mix ccxt.extract coincatch # 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: false, classification: :pro, comment: nil, countries: [ "VG" ], currencies: %{}, currency_aliases: %{ "BCHSV" => "BSV", "XBT" => "BTC" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 49, "coveragePercent" => 100, "enabledMethods" => 55, "excluded" => [ %{ "method" => "editOrder", "reason" => "emulated (returns cached data, no HTTP call)" } ], "excludedMethods" => 1, "extractableMethods" => 54, "failures" => [ %{ "error" => "coincatch createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument", "method" => "createMarketBuyOrder" }, %{ "error" => "coincatch createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument", "method" => "createMarketOrder" }, %{ "error" => "coincatch createOrder() supports does not support limit type of stop loss and take profit orders (only market type is supported for stop loss and take profit orders). To create a market order with stop loss or take profit attached use createOrderWithTakeProfitAndStopLoss()", "method" => "createStopLossOrder" }, %{ "error" => "coincatch createOrder() supports does not support limit type of stop loss and take profit orders (only market type is supported for stop loss and take profit orders). To create a market order with stop loss or take profit attached use createOrderWithTakeProfitAndStopLoss()", "method" => "createTakeProfitOrder" }, %{ "error" => "coincatch fetchDepositAddress() requires a network parameter or a default network code", "method" => "fetchDepositAddress" } ] }, endpoints: [ %{ api_section: "private", auth: true, cost: 2, market_type: :spot, method: :post, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/api/spot/v1/trade/cancel-symbol-order", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, market_type: :spot, method: :post, name: :cancel_order, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol ], path: "/api/spot/v1/trade/cancel-order-v2", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "orderIds" => [ "test-order-id" ], "symbol" => "BTCUSDT" }, market_type: :spot, method: :post, name: :cancel_orders, param_mappings: %{}, params: [ :ids, :symbol ], path: "/api/mix/v1/order/cancel-batch-orders", response_transformer: {:extract_path, ["data", "resultList"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "force" => "normal", "orderType" => "limit", "side" => "buy" }, market_type: :spot, method: :post, name: :create_limit_buy_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :amount, :price ], path: "/api/spot/v1/trade/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "force" => "normal", "orderType" => "limit" }, market_type: :spot, method: :post, name: :create_limit_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :side, :amount, :price ], path: "/api/spot/v1/trade/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "force" => "normal", "orderType" => "limit", "side" => "sell" }, market_type: :spot, method: :post, name: :create_limit_sell_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :amount, :price ], path: "/api/spot/v1/trade/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "force" => "normal", "orderType" => "market", "side" => "buy" }, market_type: :spot, method: :post, name: :create_market_buy_order_with_cost, param_mappings: %{ "cost" => "quantity" }, params: [ :symbol, :cost ], path: "/api/spot/v1/trade/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "force" => "normal", "orderType" => "market", "side" => "sell" }, market_type: :spot, method: :post, name: :create_market_sell_order, param_mappings: %{ "amount" => "quantity" }, params: [ :symbol, :amount ], path: "/api/spot/v1/trade/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "force" => "normal" }, market_type: :spot, method: :post, name: :create_order, param_mappings: %{ "amount" => "quantity", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/api/spot/v1/trade/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "side" => "buy_single", "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :create_order_with_take_profit_and_stop_loss, param_mappings: %{ "amount" => "size", "stopLoss" => "presetStopLossPrice", "takeProfit" => "presetTakeProfitPrice", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :takeProfit, :stopLoss ], path: "/api/mix/v1/order/placeOrder", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, default_params: %{ "marginCoin" => "USDT", "methodName" => "createOrders", "orderDataList" => [ %{ "clientOrderId" => "", "endpointType" => "standard", "marginCoin" => "USDT", "orderType" => "limit", "price" => "50000", "side" => "buy_single", "size" => "0.001", "symbol" => "BTCUSDT" } ], "symbol" => "BTCUSDT" }, market_type: :spot, method: :post, name: :create_orders, param_mappings: %{}, params: [ :orders ], path: "/api/mix/v1/order/batch-orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "force" => "post_only" }, market_type: :spot, method: :post, name: :create_post_only_order, param_mappings: %{ "amount" => "quantity", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/api/spot/v1/trade/orders", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "reduceOnly" => true, "side" => "buy_single", "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :create_reduce_only_order, param_mappings: %{ "amount" => "size", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/api/mix/v1/order/placeOrder", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "orderType" => "limit", "side" => "buy_single", "symbol" => "BTCUSDT", "triggerDirection" => "below", "triggerType" => "fill_price" }, market_type: :swap, method: :post, name: :create_stop_limit_order, param_mappings: %{ "amount" => "size", "price" => "executePrice" }, params: [ :symbol, :side, :amount, :price, :triggerPrice ], path: "/api/mix/v1/plan/placePlan", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "orderType" => "market", "side" => "buy_single", "symbol" => "BTCUSDT", "triggerDirection" => "below", "triggerType" => "market_price" }, market_type: :swap, method: :post, name: :create_stop_market_order, param_mappings: %{ "amount" => "size" }, params: [ :symbol, :side, :amount, :triggerPrice ], path: "/api/mix/v1/plan/placePlan", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "side" => "buy_single", "symbol" => "BTCUSDT", "triggerDirection" => "below", "triggerType" => "fill_price" }, market_type: :swap, method: :post, name: :create_stop_order, param_mappings: %{ "amount" => "size", "price" => "executePrice", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/api/mix/v1/plan/placePlan", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "side" => "buy_single", "symbol" => "BTCUSDT", "triggerDirection" => "below", "triggerType" => "fill_price" }, market_type: :swap, method: :post, name: :create_trigger_order, param_mappings: %{ "amount" => "size", "price" => "executePrice", "type" => "orderType" }, params: [ :symbol, :type, :side, :amount, :price, :triggerPrice ], path: "/api/mix/v1/plan/placePlan", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/api/spot/v1/account/assets", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :fetch_canceled_and_closed_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/api/spot/v1/trade/history", response_transformer: {:extract_path, ["data", "orderList"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 6.666666666666667, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/api/spot/v1/public/currencies", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 6.666666666666667, market_type: :spot, method: :get, name: :fetch_deposit_withdraw_fees, param_mappings: %{}, params: [ :codes ], path: "/api/spot/v1/public/currencies", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_deposits, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/api/spot/v1/wallet/deposit-list", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_rate, param_mappings: %{}, params: [ :symbol ], path: "/api/mix/v1/market/current-fundRate", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_funding_rate_history, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/api/mix/v1/market/history-fundRate", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_l2_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/api/spot/v1/market/merge-depth", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, market_type: :spot, method: :post, name: :fetch_ledger, param_mappings: %{}, params: [ :code, :since, :limit ], path: "/api/spot/v1/account/bills", response_transformer: {:extract_path, ["data", "result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_leverage, param_mappings: %{}, params: [ :symbol ], path: "/api/mix/v1/account/account", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_margin_mode, param_mappings: %{}, params: [ :symbol ], path: "/api/mix/v1/account/account", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "endTime" => "", "granularity" => "1m", "kLineType" => "market mark index", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_mark_ohlcv, param_mappings: %{ "since" => "startTime", "timeframe" => "granularity" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/api/mix/v1/market/candles", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/api/spot/v1/market/tickers", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :fetch_my_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/api/spot/v1/trade/fills", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "limit" => 1000 }, market_type: :spot, method: :get, name: :fetch_ohlcv, param_mappings: %{ "since" => "after", "timeframe" => "period" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/api/spot/v1/market/candles", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :fetch_open_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/api/spot/v1/trade/open-orders", response_transformer: {:extract_path, ["data", "orderList"]}, 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: "/api/spot/v1/trade/orderInfo", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{}, params: [ :symbol, :limit ], path: "/api/spot/v1/market/merge-depth", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :post, name: :fetch_order_trades, param_mappings: %{ "id" => "orderId" }, params: [ :id, :symbol, :since, :limit ], path: "/api/spot/v1/trade/fills", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_position, param_mappings: %{}, params: [ :symbol ], path: "/api/mix/v1/position/singlePosition-v2", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_position_mode, param_mappings: %{}, params: [ :symbol ], path: "/api/mix/v1/account/account", response_transformer: {:extract_path, ["data", "holdMode"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, market_type: :swap, method: :get, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/api/mix/v1/position/allPosition-v2", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 2, default_params: %{ "marginCoin" => "USDT", "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_positions_for_symbol, param_mappings: %{}, params: [ :symbol ], path: "/api/mix/v1/position/singlePosition-v2", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{}, params: [ :symbol ], path: "/api/spot/v1/market/ticker", response_transformer: {:extract_path_unwrap, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/api/spot/v1/market/tickers", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/api/spot/v1/public/time", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 2, default_params: %{ "limit" => 1000 }, market_type: :spot, method: :get, name: :fetch_trades, param_mappings: %{ "since" => "startTime" }, params: [ :symbol, :since, :limit ], path: "/api/spot/v1/market/fills-history", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_withdrawals, param_mappings: %{ "code" => "coin" }, params: [ :code, :since, :limit ], path: "/api/spot/v1/wallet/withdrawal-list-v2", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, default_params: %{ "marginCoin" => "USDT", "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{}, params: [ :leverage, :symbol ], path: "/api/mix/v1/account/setLeverage", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, default_params: %{ "marginCoin" => "USDT", "marginMode" => "fixed", "symbol" => "BTCUSDT" }, market_type: :swap, method: :post, name: :set_margin_mode, param_mappings: %{}, params: [ :marginMode, :symbol ], path: "/api/mix/v1/account/setMarginMode", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, default_params: %{ "holdMode" => "double_hold" }, market_type: :swap, method: :post, name: :set_position_mode, param_mappings: %{}, params: [ :hedged, :symbol ], path: "/api/mix/v1/account/setPositionMode", response_transformer: {:extract_path, ["data"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 4, market_type: :spot, method: :post, name: :withdraw, param_mappings: %{ "code" => "coin" }, params: [ :code, :amount, :address, :tag ], path: "/api/spot/v1/wallet/withdrawal-v2", response_transformer: {:extract_path, ["data"]}, source: :intercepted } ], error_code_details: %{ 22001 => %{ description: "No order to cancel", type: :order_not_found }, 40001 => %{ description: "The request header \"ACCESS_KEY\" cannot be empty", type: :invalid_credentials }, 40002 => %{ description: "The request header \"ACCESS_SIGN\" cannot be empty", type: :invalid_credentials }, 40003 => %{ description: "The request header \"ACCESS_TIMESTAMP\" cannot be empty", type: :invalid_credentials }, 40005 => %{ description: "Invalid ACCESS_TIMESTAMP", type: :invalid_credentials }, 40006 => %{ description: "Invalid ACCESS_KEY", type: :invalid_credentials }, 40007 => %{ description: "Invalid Content_Type,please use“application/json”format", type: :invalid_parameters }, 40008 => %{ description: "Request timestamp expired", type: :invalid_credentials }, 40009 => %{ description: "api verification failed", type: :invalid_credentials }, 40011 => %{ description: "The request header \"ACCESS_PASSPHRASE\" cannot be empty", type: :invalid_credentials }, 40012 => %{ description: "apikey/passphrase is incorrect", type: :invalid_credentials }, 40013 => %{ description: "User has been frozen", type: :exchange_error }, 40014 => %{ description: "Incorrect permissions", type: :access_restricted }, 40015 => %{ description: "System error", type: :exchange_error }, 40016 => %{ description: "The user must bind a mobile phone or Google authenticator", type: :access_restricted }, 40017 => %{ description: "Parameter verification failed", type: :exchange_error }, 400172 => %{ description: "symbol cannot be empty", type: :invalid_parameters }, 40018 => %{ description: "Illegal IP request", type: :access_restricted }, 40019 => %{ description: "Parameter {0} cannot be empty", type: :invalid_parameters }, 40020 => %{ description: "Parameter orderIds or clientOids error", type: :invalid_parameters }, 40034 => %{ description: "Parameter {0} does not exist", type: :invalid_parameters }, 40102 => %{ description: "The contract configuration does not exist, please check the parameters", type: :invalid_parameters }, 40200 => %{ description: "Server upgrade, please try again later", type: :network_error }, 40305 => %{ description: "client_oid length is not greater than 40, and cannot be Martian characters", type: :invalid_parameters }, 40409 => %{ description: "wrong format", type: :exchange_error }, 40704 => %{ description: "Only check the data of the last three months", type: :exchange_error }, 40724 => %{ description: "Parameter is empty", type: :invalid_parameters }, 40725 => %{ description: "spot service return an error", type: :exchange_error }, 40762 => %{ description: "The order amount exceeds the balance", type: :insufficient_balance }, 40774 => %{ description: "The order type for unilateral position must also be the unilateral position type.", type: :invalid_parameters }, 40808 => %{ description: "Parameter verification exception {0}", type: :invalid_parameters }, 40912 => %{ description: "Batch processing orders can only process up to 50", type: :invalid_parameters }, 40913 => %{ description: "orderId or clientOrderId must be passed one", type: :invalid_parameters }, 429 => %{ description: "Request is too frequent", type: :rate_limited }, 43001 => %{ description: "The order does not exist", type: :order_not_found }, 43002 => %{ description: "Pending order failed", type: :invalid_order }, 43004 => %{ description: "There is no order to cancel", type: :order_not_found }, 43005 => %{ description: "Exceeded the maximum order limit of transaction volume", type: :rate_limited }, 43006 => %{ description: "The order quantity is less than the minimum transaction quantity", type: :invalid_parameters }, 43007 => %{ description: "The order quantity is greater than the maximum transaction quantity", type: :invalid_parameters }, 43008 => %{ description: "The current order price cannot be less than {0}", type: :invalid_parameters }, 43009 => %{ description: "The current commission price exceeds the limit {0}", type: :invalid_parameters }, 43010 => %{ description: "The transaction amount cannot be less than {0}", type: :invalid_parameters }, 43011 => %{ description: "The current order price cannot be less than {0}", type: :invalid_parameters }, 43012 => %{ description: "Insufficient balance", type: :insufficient_balance }, 43117 => %{ description: "Exceeds the maximum amount that can be transferred", type: :insufficient_balance }, 43118 => %{ description: "clientOrderId duplicate", type: :invalid_parameters }, 43122 => %{ description: "The purchase limit of this currency is {0}, and there is still {1} left", type: :invalid_parameters }, 45006 => %{ description: "Insufficient position", type: :insufficient_balance }, 45110 => %{ description: "less than the minimum amount {0} {1}", type: :invalid_parameters } }, error_codes: %{ 22001 => :order_not_found, 40001 => :invalid_credentials, 40002 => :invalid_credentials, 40003 => :invalid_credentials, 40005 => :invalid_credentials, 40006 => :invalid_credentials, 40007 => :invalid_parameters, 40008 => :invalid_credentials, 40009 => :invalid_credentials, 40011 => :invalid_credentials, 40012 => :invalid_credentials, 40013 => :exchange_error, 40014 => :access_restricted, 40015 => :exchange_error, 40016 => :access_restricted, 40017 => :exchange_error, 400172 => :invalid_parameters, 40018 => :access_restricted, 40019 => :invalid_parameters, 40020 => :invalid_parameters, 40034 => :invalid_parameters, 40102 => :invalid_parameters, 40200 => :network_error, 40305 => :invalid_parameters, 40409 => :exchange_error, 40704 => :exchange_error, 40724 => :invalid_parameters, 40725 => :exchange_error, 40762 => :insufficient_balance, 40774 => :invalid_parameters, 40808 => :invalid_parameters, 40912 => :invalid_parameters, 40913 => :invalid_parameters, 429 => :rate_limited, 43001 => :order_not_found, 43002 => :invalid_order, 43004 => :order_not_found, 43005 => :rate_limited, 43006 => :invalid_parameters, 43007 => :invalid_parameters, 43008 => :invalid_parameters, 43009 => :invalid_parameters, 43010 => :invalid_parameters, 43011 => :invalid_parameters, 43012 => :insufficient_balance, 43117 => :insufficient_balance, 43118 => :invalid_parameters, 43122 => :invalid_parameters, 45006 => :insufficient_balance, 45110 => :invalid_parameters }, exceptions: %{ exact: %{ "22001" => :order_not_found, "40001" => :authentication_error, "40002" => :authentication_error, "40003" => :authentication_error, "40005" => :invalid_nonce, "40006" => :authentication_error, "40007" => :bad_request, "40008" => :invalid_nonce, "40009" => :authentication_error, "40011" => :authentication_error, "40012" => :authentication_error, "40013" => :exchange_error, "40014" => :permission_denied, "40015" => :exchange_error, "40016" => :permission_denied, "40017" => :exchange_error, "400172" => :bad_request, "40018" => :permission_denied, "40019" => :bad_request, "40020" => :bad_request, "40034" => :bad_request, "40102" => :bad_request, "40200" => :on_maintenance, "40305" => :bad_request, "40409" => :exchange_error, "40704" => :exchange_error, "40724" => :bad_request, "40725" => :exchange_error, "40762" => :insufficient_funds, "40774" => :bad_request, "40808" => :bad_request, "40912" => :bad_request, "40913" => :bad_request, "429" => :ddos_protection, "43001" => :order_not_found, "43002" => :invalid_order, "43004" => :order_not_found, "43005" => :rate_limit_exceeded, "43006" => :bad_request, "43007" => :bad_request, "43008" => :bad_request, "43009" => :bad_request, "43010" => :bad_request, "43011" => :bad_request, "43012" => :insufficient_funds, "43117" => :insufficient_funds, "43118" => :bad_request, "43122" => :bad_request, "45006" => :insufficient_funds, "45110" => :bad_request } }, exchange_options: %{ "broker" => "", "brokerId" => "47cfy", "createMarketBuyOrderRequiresPrice" => true, "currencyIdsListForParseMarket" => nil, "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "networks" => %{ "ACA" => "AcalaToken", "ADA" => "Cardano", "APT" => "Aptos", "ARB" => "ArbitrumOne", "ATOM" => "ATOM", "AVAX" => "C-Chain", "BCH" => "BCH", "BEP20" => "BEP20", "BTC" => "BITCOIN", "CAP20" => "CAP20", "CELO" => "CELO", "CFX" => "CFX", "CRO" => "CronosChain", "CSPR" => "CSPR", "ChilizChain" => "ChilizChain", "DOGE" => "DOGECOIN", "DOT" => "DOT", "EGLD" => "Elrond", "EOS" => "EOS", "ERC20" => "ERC20", "ETC" => "ETC", "FET" => "FET", "FIL" => "FIL", "FTM" => "Fantom", "GLMR" => "Moonbeam", "ICP" => "ICP", "KLAY" => "Klaytn", "LTC" => "LTC", "MATIC" => "Polygon", "MINA" => "MINA", "NEAR" => "NEARProtocol", "NEO3" => "NEO3", "ONT" => "Ontology", "OPTIMISM" => "Optimism", "RUNE" => "THORChain", "SEI" => "SEI", "SOL" => "SOL", "STRAT" => "StratisEVM", "STX" => "stacks", "SUI" => "SUI", "SXP" => "Solar", "TAO" => "TAO", "TERRA" => "Terra", "TIA" => "Celestia", "TRC20" => "TRC20", "WAVES" => "WAVES", "XLM" => "StellarLumens", "XRP" => "XRP", "ZIL" => "ZIL" }, "networksById" => %{ "ATOM" => "ATOM", "AcalaToken" => "ACA", "Aptos" => "APT", "ArbitrumOne" => "ARB", "BCH" => "BCH", "BEP20" => "BEP20", "BITCOIN" => "BTC", "C-Chain" => "AVAX", "CAP20" => "CAP20", "CELO" => "CELO", "CFX" => "CFX", "CFXeSpace" => "CFX", "CSPR" => "CSPR", "Cardano" => "ADA", "Celestia" => "TIA", "ChilizChain" => "ChilizChain", "CronosChain" => "CRO", "DOGECOIN" => "DOGE", "DOT" => "DOT", "EOS" => "EOS", "ERC20" => "ERC20", "ETC" => "ETC", "Elrond" => "EGLD", "FET" => "FET", "FIL" => "FIL", "Fantom" => "FTM", "ICP" => "ICP", "Klaytn" => "KLAY", "LTC" => "LTC", "MINA" => "MINA", "Moonbeam" => "GLMR", "NEARProtocol" => "NEAR", "NEO3" => "NEO3", "Ontology" => "ONT", "Optimism" => "Optimism", "Polygon" => "MATIC", "SEI" => "SEI", "SOL" => "SOL", "SUI" => "SUI", "Solar" => "SXP", "StellarLumens" => "XLM", "StratisEVM" => "STRAT", "TAO" => "TAO", "THORChain" => "RUNE", "TRC20" => "TRC20", "TRX(TRC20)" => "TRC20", "Terra" => "TERRA", "WAVES" => "WAVES", "XRP" => "XRP", "ZIL" => "ZIL", "stacks" => "STX" }, "timeframes" => %{ "spot" => %{ "12h" => "12h", "15m" => "15min", "1M" => "1M", "1d" => "1day", "1h" => "1h", "1m" => "1min", "1w" => "1week", "30m" => "30min", "3d" => "3day", "4h" => "4h", "5m" => "5min", "6h" => "6h" }, "swap" => %{ "12h" => "12H", "15" => "15m", "1M" => "1M", "1d" => "1D", "1h" => "1H", "1m" => "1m", "1w" => "1W", "2h" => "2H", "30" => "30m", "3d" => "3D", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6H" } } }, extended_metadata: %{ fees_url: "https://www.coincatch.com/en/rate/", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://github.com/user-attachments/assets/3d49065f-f05d-4573-88a2-1b5201ec6ff3", referral_discount: 0.1, referral_url: "https://partner.coincatch.cc/bg/92hy70391729607848548" }, extracted_metadata: %{ ccxt_version: "4.5.34" }, features: %{ default: %{ create_order: %{ hedged: false, iceberg: false, leverage: false, margin_mode: false, 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: true, gtd: false, ioc: true, po: true }, trailing: false, trigger_direction: false, trigger_price: true, trigger_price_type: %{ index: false, last: true, mark: true } }, create_orders: %{ max: 50 }, fetch_my_trades: %{ days_back: 100000, limit: 500, margin_mode: false, symbol_required: true, until_days: 100000 }, fetch_ohlcv: %{ limit: 1000 }, fetch_open_orders: %{ limit: 100, margin_mode: false, market_type: true, symbol_required: false, trailing: false, trigger: true }, 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 } }, extends: "default", fetch_my_trades: %{ limit: 100 } }, future: %{}, spot: %{ extends: "default" }, swap: %{ inverse: %{ extends: "forDerivatives" }, linear: %{ extends: "forDerivatives" } } }, fees: nil, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (!response) {\n return undefined; // fallback to default error handler\n }\n let message = this.safeString(response, 'msg');\n const feedback = this.id + ' ' + body;\n let messageCode = this.safeString(response, 'code');\n let success = (message === 'success') || (message === undefined);\n if (url.indexOf('batch') >= 0) { // createOrders, cancelOrders\n const data = this.safeDict(response, 'data', {});\n const failure = this.safeList2(data, 'failure', 'fail_infos', []);\n if (!this.isEmpty(failure)) {\n success = false;\n const firstEntry = this.safeDict(failure, 0, {});\n messageCode = this.safeString(firstEntry, 'errorCode');\n message = this.safeString(firstEntry, 'errorMsg');\n }\n }\n if (!success) {\n this.throwExactlyMatchedException(this.exceptions['exact'], messageCode, feedback);\n this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);\n throw new errors.ExchangeError(feedback); // unknown message\n }\n return undefined;\n }", has: %{ add_margin: true, borrow_cross_margin: false, borrow_isolated_margin: false, borrow_margin: false, c_o_r_s: false, cancel_all_orders: true, cancel_all_orders_after: false, 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, cancel_withdraw: false, close_all_positions: false, close_position: false, create_convert_trade: false, create_deposit_address: false, create_limit_buy_order: true, create_limit_buy_order_ws: false, create_limit_order: true, create_limit_order_ws: false, create_limit_sell_order: true, create_limit_sell_order_ws: false, create_market_buy_order: true, 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: true, 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: true, 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: true, create_stop_limit_order_ws: false, create_stop_loss_order: true, create_stop_loss_order_ws: false, create_stop_market_order: true, create_stop_market_order_ws: false, create_stop_order: true, create_stop_order_ws: false, create_take_profit_order: true, create_take_profit_order_ws: false, create_trailing_amount_order: false, create_trailing_amount_order_ws: false, create_trailing_percent_order: false, create_trailing_percent_order_ws: false, create_trigger_order: true, 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: false, 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: true, fetch_canceled_orders: false, fetch_closed_order: false, fetch_closed_orders: false, 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: false, fetch_deposit_address: true, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: false, fetch_deposit_withdraw_fee: false, fetch_deposit_withdraw_fees: true, fetch_deposits: true, fetch_deposits_withdrawals: false, fetch_deposits_ws: false, fetch_funding_history: false, fetch_funding_interval: false, fetch_funding_intervals: false, fetch_funding_rate: true, fetch_funding_rate_history: true, fetch_funding_rates: false, fetch_greeks: false, fetch_index_ohlcv: false, fetch_isolated_borrow_rate: false, fetch_isolated_borrow_rates: false, 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: true, 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: true, 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: false, fetch_my_settlement_history: false, fetch_my_trades: true, fetch_my_trades_ws: false, fetch_ohlcv: true, fetch_ohlcv_ws: false, fetch_open_interest: false, 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: true, 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: false, 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: false, fetch_trading_fees: false, fetch_trading_fees_ws: false, fetch_trading_limits: false, fetch_transaction_fee: false, fetch_transaction_fees: false, fetch_transactions: false, fetch_transfer: false, fetch_transfers: false, fetch_underlying_assets: false, fetch_volatility_history: false, fetch_withdraw_addresses: false, fetch_withdrawal: false, fetch_withdrawal_whitelist: false, fetch_withdrawals: true, fetch_withdrawals_ws: false, future: false, margin: false, option: false, private_api: true, public_api: true, reduce_margin: true, repay_cross_margin: false, repay_isolated_margin: false, sandbox: false, set_leverage: true, set_margin: false, set_margin_mode: true, set_position_mode: true, sign_in: false, spot: true, swap: true, transfer: false, 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: false, 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: false, 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: "coincatch", markets: nil, name: "CoinCatch", ohlcv_timestamp_resolution: :unknown, options: %{ broker: "", broker_id: "47cfy", create_market_buy_order_requires_price: true, currency_ids_list_for_parse_market: nil, networks: %{ "ACA" => "AcalaToken", "ADA" => "Cardano", "APT" => "Aptos", "ARB" => "ArbitrumOne", "ATOM" => "ATOM", "AVAX" => "C-Chain", "BCH" => "BCH", "BEP20" => "BEP20", "BTC" => "BITCOIN", "CAP20" => "CAP20", "CELO" => "CELO", "CFX" => "CFX", "CRO" => "CronosChain", "CSPR" => "CSPR", "ChilizChain" => "ChilizChain", "DOGE" => "DOGECOIN", "DOT" => "DOT", "EGLD" => "Elrond", "EOS" => "EOS", "ERC20" => "ERC20", "ETC" => "ETC", "FET" => "FET", "FIL" => "FIL", "FTM" => "Fantom", "GLMR" => "Moonbeam", "ICP" => "ICP", "KLAY" => "Klaytn", "LTC" => "LTC", "MATIC" => "Polygon", "MINA" => "MINA", "NEAR" => "NEARProtocol", "NEO3" => "NEO3", "ONT" => "Ontology", "OPTIMISM" => "Optimism", "RUNE" => "THORChain", "SEI" => "SEI", "SOL" => "SOL", "STRAT" => "StratisEVM", "STX" => "stacks", "SUI" => "SUI", "SXP" => "Solar", "TAO" => "TAO", "TERRA" => "Terra", "TIA" => "Celestia", "TRC20" => "TRC20", "WAVES" => "WAVES", "XLM" => "StellarLumens", "XRP" => "XRP", "ZIL" => "ZIL" }, networks_by_id: %{ "ArbitrumOne" => "ARB", "C-Chain" => "AVAX", "CAP20" => "CAP20", "CFX" => "CFX", "CFXeSpace" => "CFX", "ChilizChain" => "ChilizChain", "CronosChain" => "CRO", "Optimism" => "Optimism", "Solar" => "SXP", "StellarLumens" => "XLM", "StratisEVM" => "STRAT", "THORChain" => "RUNE", "TRC20" => "TRC20", "TRX(TRC20)" => "TRC20" }, timeframes: %{ "spot" => %{ "12h" => "12h", "15m" => "15min", "1M" => "1M", "1d" => "1day", "1h" => "1h", "1m" => "1min", "1w" => "1week", "30m" => "30min", "3d" => "3day", "4h" => "4h", "5m" => "5min", "6h" => "6h" }, "swap" => %{ "12h" => "12H", "15" => "15m", "1M" => "1M", "1d" => "1D", "1h" => "1H", "1m" => "1m", "1w" => "1W", "2h" => "2H", "30" => "30m", "3d" => "3D", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6H" } } }, order_mappings: %{ side_format: :lowercase, side_key: "side", type_format: :lowercase, type_key: "orderType" }, param_mappings: %{ "amount" => "size", "code" => "coin", "cost" => "quantity", "id" => "orderId", "price" => "executePrice", "since" => "startTime", "stopLoss" => "presetStopLossPrice", "takeProfit" => "presetTakeProfitPrice", "timeframe" => "period", "type" => "orderType" }, parse_methods: [ %{ "comment" => nil, "examples" => [ "[\n {\n \"coinId\": 2,\n \"coinName\": \"USDT\",\n \"available\": \"99.20000000\",\n \"frozen\": \"0.00000000\",\n \"lock\": \"0.00000000\",\n \"uTime\": \"1724938746000\"\n }\n ]", "[\n {\n \"marginCoin\": \"USDT\",\n \"locked\": \"0\",\n \"available\": \"60\",\n \"crossMaxAvailable\": \"60\",\n \"fixedMaxAvailable\": \"60\",\n \"maxTransferOut\": \"60\",\n \"equity\": \"60\",\n \"usdtEquity\": \"60\",\n \"btcEquity\": \"0.001002360626\",\n \"crossRiskRate\": \"0\",\n \"unrealizedPL\": \"0\",\n \"bonus\": \"0\",\n \"crossedUnrealizedPL\": null,\n \"isolatedUnrealizedPL\": null\n }\n ]" ], "line_end" => 1908, "line_start" => 1858, "mappings" => [], "name" => "parseBalance", "signature" => "parseBalance (balances): Balances", "source" => "parseBalance (balances): Balances {\n //\n // spot\n // [\n // {\n // \"coinId\": 2,\n // \"coinName\": \"USDT\",\n // \"available\": \"99.20000000\",\n // \"frozen\": \"0.00000000\",\n // \"lock\": \"0.00000000\",\n // \"uTime\": \"1724938746000\"\n // }\n // ]\n //\n // swap\n // [\n // {\n // \"marginCoin\": \"USDT\",\n // \"locked\": \"0\",\n // \"available\": \"60\",\n // \"crossMaxAvailable\": \"60\",\n // \"fixedMaxAvailable\": \"60\",\n // \"maxTransferOut\": \"60\",\n // \"equity\": \"60\",\n // \"usdtEquity\": \"60\",\n // \"btcEquity\": \"0.001002360626\",\n // \"crossRiskRate\": \"0\",\n // \"unrealizedPL\": \"0\",\n // \"bonus\": \"0\",\n // \"crossedUnrealizedPL\": null,\n // \"isolatedUnrealizedPL\": null\n // }\n // ]\n //\n const result: Dict = {\n 'info': balances,\n };\n for (let i = 0; i < balances.length; i++) {\n const balanceEntry = this.safeDict (balances, i, {});\n const currencyId = this.safeString2 (balanceEntry, 'coinName', 'marginCoin');\n const code = this.safeCurrencyCode (currencyId);\n const account = this.account ();\n account['free'] = this.safeString (balanceEntry, 'available');\n const locked = this.safeString2 (balanceEntry, 'lock', 'locked');\n const frozen = this.safeString (balanceEntry, 'frozen', '0');\n account['used'] = Precise.stringAdd (locked, frozen);\n account['total'] = this.safeString (balanceEntry, 'equity');\n result[code] = account;\n }\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coin\": \"USDT\",\n \"address\": \"TKTUt7qiTaMgnTwZXjE3ZBkPB6LKhLPJyZ\",\n \"chain\": \"TRC20\",\n \"tag\": null,\n \"url\": \"https://tronscan.org/#/transaction/\"\n }" ], "line_end" => 2053, "line_start" => 2031, "mappings" => [ %{ "comment" => nil, "key" => "currency", "value" => "currency['code']" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "tag", "value" => "tag" }, %{ "comment" => nil, "key" => "network", "value" => "network" }, %{ "comment" => nil, "key" => "info", "value" => "depositAddress" } ], "name" => "parseDepositAddress", "signature" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress", "source" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress {\n //\n // {\n // \"coin\": \"USDT\",\n // \"address\": \"TKTUt7qiTaMgnTwZXjE3ZBkPB6LKhLPJyZ\",\n // \"chain\": \"TRC20\",\n // \"tag\": null,\n // \"url\": \"https://tronscan.org/#/transaction/\"\n // }\n //\n const address = this.safeString (depositAddress, 'address');\n this.checkAddress (address);\n const networkId = this.safeString (depositAddress, 'chain');\n const network = this.safeString (this.options['networksById'], networkId, networkId);\n const tag = this.safeString (depositAddress, 'tag');\n return {\n 'currency': currency['code'],\n 'address': address,\n 'tag': tag,\n 'network': network,\n 'info': depositAddress,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"coinId\":\"1\",\n \"coinName\":\"BTC\",\n \"transfer\":\"true\",\n \"chains\":[\n {\n \"chain\":null,\n \"needTag\":\"false\",\n \"withdrawable\":\"true\",\n \"rechargeAble\":\"true\",\n \"withdrawFee\":\"0.005\",\n \"depositConfirm\":\"1\",\n \"withdrawConfirm\":\"1\",\n \"minDepositAmount\":\"0.001\",\n \"minWithdrawAmount\":\"0.001\",\n \"browserUrl\":\"https://blockchair.com/bitcoin/testnet/transaction/\"\n }\n ]\n }" ], "line_end" => 736, "line_start" => 685, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "fee" }, %{ "comment" => nil, "key" => "withdraw", "value" => "{\n 'fee': undefined,\n 'percentage': undefined,\n }" }, %{ "comment" => nil, "key" => "deposit", "value" => "{\n 'fee': undefined,\n 'percentage': undefined,\n }" }, %{ "comment" => nil, "key" => "networks", "value" => "{}" }, %{ "comment" => nil, "key" => "deposit", "value" => "{ 'fee': undefined, 'percentage': undefined }" }, %{ "comment" => nil, "key" => "withdraw", "value" => "{ 'fee': this.safeNumber (chain, 'withdrawFee'), 'percentage': false }" } ], "name" => "parseDepositWithdrawFee", "signature" => "parseDepositWithdrawFee (fee, currency: Currency = undefined)", "source" => "parseDepositWithdrawFee (fee, currency: Currency = undefined) {\n //\n // {\n // \"coinId\":\"1\",\n // \"coinName\":\"BTC\",\n // \"transfer\":\"true\",\n // \"chains\":[\n // {\n // \"chain\":null,\n // \"needTag\":\"false\",\n // \"withdrawable\":\"true\",\n // \"rechargeAble\":\"true\",\n // \"withdrawFee\":\"0.005\",\n // \"depositConfirm\":\"1\",\n // \"withdrawConfirm\":\"1\",\n // \"minDepositAmount\":\"0.001\",\n // \"minWithdrawAmount\":\"0.001\",\n // \"browserUrl\":\"https://blockchair.com/bitcoin/testnet/transaction/\"\n // }\n // ]\n // }\n //\n const chains = this.safeList (fee, 'chains', []);\n const chainsLength = chains.length;\n const result: Dict = {\n 'info': fee,\n 'withdraw': {\n 'fee': undefined,\n 'percentage': undefined,\n },\n 'deposit': {\n 'fee': undefined,\n 'percentage': undefined,\n },\n 'networks': {},\n };\n for (let i = 0; i < chainsLength; i++) {\n const chain = chains[i];\n const networkId = this.safeString (chain, 'chain');\n const currencyCode = this.safeString (currency, 'code');\n const networkCode = this.networkIdToCode (networkId, currencyCode);\n result['networks'][networkCode] = {\n 'deposit': { 'fee': undefined, 'percentage': undefined },\n 'withdraw': { 'fee': this.safeNumber (chain, 'withdrawFee'), 'percentage': false },\n };\n if (chainsLength === 1) {\n result['withdraw']['fee'] = this.safeNumber (chain, 'withdrawFee');\n result['withdraw']['percentage'] = false;\n }\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4330, "line_start" => 4311, "mappings" => [ %{ "comment" => nil, "key" => "currency", "value" => "currency" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" } ], "name" => "parseFeeDetailString", "signature" => "parseFeeDetailString (feeDetailString: Str)", "source" => "parseFeeDetailString (feeDetailString: Str) {\n const result = [];\n const feeDetail = this.parseJson (feeDetailString);\n if (feeDetail) {\n const keys = Object.keys (feeDetail);\n for (let i = 0; i < keys.length; i++) {\n const currencyId = this.safeString (keys, i);\n if (currencyId in this.currencies_by_id) {\n const currency = this.safeCurrencyCode (currencyId);\n const feeEntry = this.safeDict (feeDetail, currencyId, {});\n const amount = Precise.stringAbs (this.safeString (feeEntry, 'totalFee'));\n result.push ({\n 'currency': currency,\n 'amount': amount,\n });\n }\n }\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1712, "line_start" => 1689, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "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" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "fundingRate" }, %{ "comment" => nil, "key" => "fundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "fundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "nextFundingDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "previousFundingDatetime", "value" => "undefined" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (contract, market: Market = undefined)", "source" => "parseFundingRate (contract, market: Market = undefined) {\n const marketId = this.safeString (contract, 'symbol');\n market = this.safeMarketCustom (marketId, market);\n const fundingRate = this.safeNumber (contract, 'fundingRate');\n return {\n 'info': contract,\n 'symbol': market['symbol'],\n 'markPrice': undefined,\n 'indexPrice': undefined,\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'fundingRate': fundingRate,\n 'fundingTimestamp': undefined,\n 'fundingDatetime': undefined,\n 'nextFundingRate': undefined,\n 'nextFundingTimestamp': undefined,\n 'nextFundingDatetime': undefined,\n 'previousFundingRate': undefined,\n 'previousFundingTimestamp': undefined,\n 'previousFundingDatetime': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"billId\": \"1220289012519190529\",\n \"coinId\": 2,\n \"coinName\": \"USDT\",\n \"groupType\": \"transfer\",\n \"bizType\": \"Transfer out\",\n \"quantity\": \"-40.00000000\",\n \"balance\": \"4.43878673\",\n \"fees\": \"0.00000000\",\n \"cTime\": \"1726665493092\"\n }", "{\n \"id\": \"1220288640761122816\",\n \"symbol\": null,\n \"marginCoin\": \"ETH\",\n \"amount\": \"0.01\",\n \"fee\": \"0\",\n \"feeByCoupon\": \"\",\n \"feeCoin\": \"ETH\",\n \"business\": \"trans_from_exchange\",\n \"cTime\": \"1726665404563\"\n }" ], "line_end" => 5408, "line_start" => 5347, "mappings" => [ %{ "comment" => nil, "key" => "cost", "value" => "Precise.stringAbs (this.safeString2 (item, 'fee', 'fees'))" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeString (item, 'feeCoin')" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (item, 'billId', 'id')" }, %{ "comment" => nil, "key" => "info", "value" => "item" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "account", "value" => "undefined" }, %{ "comment" => nil, "key" => "direction", "value" => "direction" }, %{ "comment" => nil, "key" => "referenceId", "value" => "undefined" }, %{ "comment" => nil, "key" => "referenceAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "this.parseLedgerEntryType (this.safeStringLower2 (item, 'bizType', 'business'))" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (settleId, currency)" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "amount", "value" => "amountString" }, %{ "comment" => nil, "key" => "before", "value" => "undefined" }, %{ "comment" => nil, "key" => "after", "value" => "this.safeString (item, 'balance')" }, %{ "comment" => nil, "key" => "status", "value" => "'ok'" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // spot\n // {\n // \"billId\": \"1220289012519190529\",\n // \"coinId\": 2,\n // \"coinName\": \"USDT\",\n // \"groupType\": \"transfer\",\n // \"bizType\": \"Transfer out\",\n // \"quantity\": \"-40.00000000\",\n // \"balance\": \"4.43878673\",\n // \"fees\": \"0.00000000\",\n // \"cTime\": \"1726665493092\"\n // }\n //\n // swap\n // {\n // \"id\": \"1220288640761122816\",\n // \"symbol\": null,\n // \"marginCoin\": \"ETH\",\n // \"amount\": \"0.01\",\n // \"fee\": \"0\",\n // \"feeByCoupon\": \"\",\n // \"feeCoin\": \"ETH\",\n // \"business\": \"trans_from_exchange\",\n // \"cTime\": \"1726665404563\"\n // }\n //\n const timestamp = this.safeInteger (item, 'cTime');\n const settleId = this.safeString2 (item, 'coinName', 'marginCoin');\n let market: Market = undefined;\n const marketId = this.safeString (item, 'symbol');\n market = this.safeMarketCustom (marketId, market, settleId);\n let amountString = this.safeString2 (item, 'quantity', 'amount');\n let direction = 'in';\n if (Precise.stringLt (amountString, '0')) {\n direction = 'out';\n amountString = Precise.stringMul (amountString, '-1');\n }\n const fee = {\n 'cost': Precise.stringAbs (this.safeString2 (item, 'fee', 'fees')),\n 'currency': this.safeString (item, 'feeCoin'),\n };\n return this.safeLedgerEntry ({\n 'id': this.safeString2 (item, 'billId', 'id'),\n 'info': item,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'account': undefined,\n 'direction': direction,\n 'referenceId': undefined,\n 'referenceAccount': undefined,\n 'type': this.parseLedgerEntryType (this.safeStringLower2 (item, 'bizType', 'business')),\n 'currency': this.safeCurrencyCode (settleId, currency),\n 'symbol': market['symbol'],\n 'amount': amountString,\n 'before': undefined,\n 'after': this.safeString (item, 'balance'),\n 'status': 'ok',\n 'fee': fee,\n }, currency);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 5437, "line_start" => 5410, "mappings" => [ %{ "comment" => nil, "key" => "deposit", "value" => "'deposit'" }, %{ "comment" => nil, "key" => "withdraw", "value" => "'withdrawal'" }, %{ "comment" => nil, "key" => "buy", "value" => "'trade'" }, %{ "comment" => nil, "key" => "sell", "value" => "'trade'" }, %{ "comment" => nil, "key" => "deduction of handling fee", "value" => "'fee'" }, %{ "comment" => nil, "key" => "transfer in", "value" => "'transfer'" }, %{ "comment" => nil, "key" => "transfer out", "value" => "'transfer'" }, %{ "comment" => nil, "key" => "rebate rewards", "value" => "'rebate'" }, %{ "comment" => nil, "key" => "user lock", "value" => "'user lock'" }, %{ "comment" => nil, "key" => "open_long", "value" => "'trade'" }, %{ "comment" => nil, "key" => "open_short", "value" => "'trade'" }, %{ "comment" => nil, "key" => "close_long", "value" => "'trade'" }, %{ "comment" => nil, "key" => "close_short", "value" => "'trade'" }, %{ "comment" => nil, "key" => "trans_from_exchange", "value" => "'transfer'" }, %{ "comment" => nil, "key" => "trans_to_exchange", "value" => "'transfer'" }, %{ "comment" => nil, "key" => "contract_settle_fee", "value" => "'fee'" } ], "name" => "parseLedgerEntryType", "signature" => "parseLedgerEntryType (type: string): string", "source" => "parseLedgerEntryType (type: string): string {\n const types = {\n 'deposit': 'deposit',\n 'withdraw': 'withdrawal',\n 'buy': 'trade',\n 'sell': 'trade',\n 'deduction of handling fee': 'fee', // todo check\n 'transfer-in': 'transfer',\n 'transfer in': 'transfer',\n 'transfer out': 'transfer',\n 'rebate rewards': 'rebate', // todo check\n 'airdrop rewards': 'rebate', // todo check\n 'usdt contract rewards': 'rebate', // todo check\n 'mix contract rewards': 'rebate', // todo check\n 'system lock': 'system lock',\n 'user lock': 'user lock',\n 'open_long': 'trade',\n 'open_short': 'trade',\n 'close_long': 'trade',\n 'close_short': 'trade',\n 'trans_from_exchange': 'transfer',\n 'trans_to_exchange': 'transfer',\n 'contract_settle_fee': 'fee', // todo check sometimes it is positive, sometimes negative\n 'burst_long_loss_query': 'trade', // todo check\n 'burst_short_loss_query': 'trade', // todo check\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"marginCoin\": \"ETH\",\n \"locked\": \"0\",\n \"available\": \"0.01\",\n \"crossMaxAvailable\": \"0.01\",\n \"fixedMaxAvailable\": \"0.01\",\n \"maxTransferOut\": \"0.01\",\n \"equity\": \"0.01\",\n \"usdtEquity\": \"22.97657025\",\n \"btcEquity\": \"0.000386195288\",\n \"crossRiskRate\": \"0\",\n \"crossMarginLeverage\": 100,\n \"fixedLongLeverage\": 100,\n \"fixedShortLeverage\": 100,\n \"marginMode\": \"crossed\",\n \"holdMode\": \"double_hold\",\n \"unrealizedPL\": \"0\",\n \"bonus\": \"0\",\n \"crossedUnrealizedPL\": \"0\",\n \"isolatedUnrealizedPL\": \"\"\n }", "{\n \"symbol\": \"ETHUSD_DMCBL\",\n \"marginCoin\": \"ETH\",\n \"longLeverage\": 2,\n \"shortLeverage\": 2,\n \"crossMarginLeverage\": 2,\n \"marginMode\": \"crossed\"\n }" ], "line_end" => 4826, "line_start" => 4774, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "leverage" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "marginMode", "value" => "marginMode" }, %{ "comment" => nil, "key" => "longLeverage", "value" => "longLeverage" }, %{ "comment" => nil, "key" => "shortLeverage", "value" => "shortLeverage" } ], "name" => "parseLeverage", "signature" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage", "source" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage {\n //\n // fetchLeverage\n // {\n // \"marginCoin\": \"ETH\",\n // \"locked\": \"0\",\n // \"available\": \"0.01\",\n // \"crossMaxAvailable\": \"0.01\",\n // \"fixedMaxAvailable\": \"0.01\",\n // \"maxTransferOut\": \"0.01\",\n // \"equity\": \"0.01\",\n // \"usdtEquity\": \"22.97657025\",\n // \"btcEquity\": \"0.000386195288\",\n // \"crossRiskRate\": \"0\",\n // \"crossMarginLeverage\": 100,\n // \"fixedLongLeverage\": 100,\n // \"fixedShortLeverage\": 100,\n // \"marginMode\": \"crossed\",\n // \"holdMode\": \"double_hold\",\n // \"unrealizedPL\": \"0\",\n // \"bonus\": \"0\",\n // \"crossedUnrealizedPL\": \"0\",\n // \"isolatedUnrealizedPL\": \"\"\n // }\n //\n // setLeverage\n // {\n // \"symbol\": \"ETHUSD_DMCBL\",\n // \"marginCoin\": \"ETH\",\n // \"longLeverage\": 2,\n // \"shortLeverage\": 2,\n // \"crossMarginLeverage\": 2,\n // \"marginMode\": \"crossed\"\n // }\n //\n const marketId = this.safeString (leverage, 'symbol');\n market = this.safeMarketCustom (marketId, market);\n const marginMode = this.parseMarginModeType (this.safeStringLower (leverage, 'marginMode'));\n let longLeverage = this.safeInteger2 (leverage, 'fixedLongLeverage', 'longLeverage');\n let shortLeverage = this.safeInteger2 (leverage, 'fixedShortLeverage', 'shortLeverage');\n const crossMarginLeverage = this.safeInteger (leverage, 'crossMarginLeverage');\n if (marginMode === 'cross') {\n longLeverage = crossMarginLeverage;\n shortLeverage = crossMarginLeverage;\n }\n return {\n 'info': leverage,\n 'symbol': market['symbol'],\n 'marginMode': marginMode,\n 'longLeverage': longLeverage,\n 'shortLeverage': shortLeverage,\n } as Leverage;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4559, "line_start" => 4552, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "marginMode" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (undefined, market)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "this.parseMarginModeType (marginType)" } ], "name" => "parseMarginMode", "signature" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode", "source" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode {\n const marginType = this.safeStringLower (marginMode, 'marginMode');\n return {\n 'info': marginMode,\n 'symbol': this.safeSymbol (undefined, market),\n 'marginMode': this.parseMarginModeType (marginType),\n } as MarginMode;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4567, "line_start" => 4561, "mappings" => [], "name" => "parseMarginModeType", "signature" => "parseMarginModeType (type: string): string", "source" => "parseMarginModeType (type: string): string {\n const types: Dict = {\n 'crossed': 'cross',\n 'fixed': 'isolated',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4878, "line_start" => 4861, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "data" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "type", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginMode", "value" => "undefined" }, %{ "comment" => nil, "key" => "amount", "value" => "undefined" }, %{ "comment" => nil, "key" => "total", "value" => "undefined" }, %{ "comment" => nil, "key" => "code", "value" => "market['quote']" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" } ], "name" => "parseMarginModification", "signature" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification", "source" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification {\n //\n //\n const msg = this.safeString (data, 'msg');\n const status = (msg === 'success') ? 'ok' : 'failed';\n return {\n 'info': data,\n 'symbol': market['symbol'],\n 'type': undefined,\n 'marginMode': undefined,\n 'amount': undefined,\n 'total': undefined,\n 'code': market['quote'],\n 'status': status,\n 'timestamp': undefined,\n 'datetime': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"high24h\": \"59461.34\",\n \"low24h\": \"57723.23\",\n \"close\": \"59056.02\",\n \"quoteVol\": \"18240112.23368\",\n \"baseVol\": \"309.05564\",\n \"usdtVol\": \"18240112.2336744\",\n \"ts\": \"1725114038951\",\n \"buyOne\": \"59055.85\",\n \"sellOne\": \"59057.45\",\n \"bidSz\": \"0.0139\",\n \"askSz\": \"0.0139\",\n \"openUtc0\": \"59126.71\",\n \"changeUtc\": \"-0.0012\",\n \"change\": \"0.01662\"\n },", "{\n \"symbol\": \"BTCUSDT_UMCBL\",\n \"makerFeeRate\": \"0.0002\",\n \"takerFeeRate\": \"0.0006\",\n \"feeRateUpRatio\": \"0.005\",\n \"openCostUpRatio\": \"0.01\",\n \"quoteCoin\": \"USDT\",\n \"baseCoin\": \"BTC\",\n \"buyLimitPriceRatio\": \"0.01\",\n \"sellLimitPriceRatio\": \"0.01\",\n \"supportMarginCoins\": [ \"USDT\" ],\n \"minTradeNum\": \"0.001\",\n \"priceEndStep\": \"1\",\n \"volumePlace\": \"3\",\n \"pricePlace\": \"1\",\n \"sizeMultiplier\": \"0.001\",\n \"symbolType\": \"perpetual\",\n \"symbolStatus\": \"normal\",\n \"offTime\": \"-1\",\n \"limitOpenTime\": \"-1\",\n \"maintainTime\": \"\",\n \"symbolName\": \"BTCUSDT\",\n \"minTradeUSDT\": null,\n \"maxPositionNum\": null,\n \"maxOrderNum\": null\n }" ], "line_end" => 1027, "line_start" => 879, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "marketId" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "base", "value" => "base" }, %{ "comment" => nil, "key" => "quote", "value" => "quote" }, %{ "comment" => nil, "key" => "baseId", "value" => "baseId" }, %{ "comment" => nil, "key" => "quoteId", "value" => "quoteId" }, %{ "comment" => nil, "key" => "active", "value" => "active" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "subType", "value" => "subType" }, %{ "comment" => nil, "key" => "spot", "value" => "isSpot" }, %{ "comment" => nil, "key" => "margin", "value" => "isSpot ? false : undefined" }, %{ "comment" => nil, "key" => "swap", "value" => "!isSpot" }, %{ "comment" => nil, "key" => "future", "value" => "false" }, %{ "comment" => nil, "key" => "option", "value" => "false" }, %{ "comment" => nil, "key" => "contract", "value" => "!isSpot" }, %{ "comment" => nil, "key" => "settle", "value" => "settle" }, %{ "comment" => nil, "key" => "settleId", "value" => "settleId" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.safeNumber (market, 'sizeMultiplier')" }, %{ "comment" => nil, "key" => "linear", "value" => "isLinear" }, %{ "comment" => nil, "key" => "inverse", "value" => "isInverse" }, %{ "comment" => nil, "key" => "taker", "value" => "this.safeNumber (fees, 'taker')" }, %{ "comment" => nil, "key" => "maker", "value" => "this.safeNumber (fees, 'maker')" }, %{ "comment" => nil, "key" => "percentage", "value" => "this.safeBool (fees, 'percentage')" }, %{ "comment" => nil, "key" => "tierBased", "value" => "this.safeBool (fees, 'tierBased')" }, %{ "comment" => nil, "key" => "feeSide", "value" => "this.safeString (fees, 'feeSide')" }, %{ "comment" => nil, "key" => "expiry", "value" => "undefined" }, %{ "comment" => nil, "key" => "expiryDatetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "strike", "value" => "undefined" }, %{ "comment" => nil, "key" => "optionType", "value" => "undefined" }, %{ "comment" => nil, "key" => "precision", "value" => "{\n 'amount': this.parseNumber (amountPrecisionString),\n 'price': this.parseNumber (pricePrecisionString),\n }" }, %{ "comment" => nil, "key" => "limits", "value" => "{\n 'amount': {\n 'min': this.safeNumber (market, 'minTradeNum'),\n 'max': undefined,\n },\n 'price': {\n 'min': undefined,\n 'max': undefined,\n },\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'cost': {\n 'min': undefined,\n 'max': undefined,\n },\n }" }, %{ "comment" => nil, "key" => "created", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "market" }, %{ "comment" => nil, "key" => "amount", "value" => "this.parseNumber (amountPrecisionString)" }, %{ "comment" => nil, "key" => "price", "value" => "this.parseNumber (pricePrecisionString)" }, %{ "comment" => nil, "key" => "min", "value" => "undefined" }, %{ "comment" => nil, "key" => "max", "value" => "undefined" } ], "name" => "parseMarket", "signature" => "parseMarket (market: Dict): Market", "source" => "parseMarket (market: Dict): Market {\n //\n // spot\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"high24h\": \"59461.34\",\n // \"low24h\": \"57723.23\",\n // \"close\": \"59056.02\",\n // \"quoteVol\": \"18240112.23368\",\n // \"baseVol\": \"309.05564\",\n // \"usdtVol\": \"18240112.2336744\",\n // \"ts\": \"1725114038951\",\n // \"buyOne\": \"59055.85\",\n // \"sellOne\": \"59057.45\",\n // \"bidSz\": \"0.0139\",\n // \"askSz\": \"0.0139\",\n // \"openUtc0\": \"59126.71\",\n // \"changeUtc\": \"-0.0012\",\n // \"change\": \"0.01662\"\n // },\n //\n // swap\n // {\n // \"symbol\": \"BTCUSDT_UMCBL\",\n // \"makerFeeRate\": \"0.0002\",\n // \"takerFeeRate\": \"0.0006\",\n // \"feeRateUpRatio\": \"0.005\",\n // \"openCostUpRatio\": \"0.01\",\n // \"quoteCoin\": \"USDT\",\n // \"baseCoin\": \"BTC\",\n // \"buyLimitPriceRatio\": \"0.01\",\n // \"sellLimitPriceRatio\": \"0.01\",\n // \"supportMarginCoins\": [ \"USDT\" ],\n // \"minTradeNum\": \"0.001\",\n // \"priceEndStep\": \"1\",\n // \"volumePlace\": \"3\",\n // \"pricePlace\": \"1\",\n // \"sizeMultiplier\": \"0.001\",\n // \"symbolType\": \"perpetual\",\n // \"symbolStatus\": \"normal\",\n // \"offTime\": \"-1\",\n // \"limitOpenTime\": \"-1\",\n // \"maintainTime\": \"\",\n // \"symbolName\": \"BTCUSDT\",\n // \"minTradeUSDT\": null,\n // \"maxPositionNum\": null,\n // \"maxOrderNum\": null\n // }\n //\n let marketId = this.safeString (market, 'symbol');\n const tradingFees = this.safeDict (this.fees, 'trading');\n const fees = this.safeDict (tradingFees, 'spot');\n let baseId = this.safeString (market, 'baseCoin');\n let quoteId = this.safeString (market, 'quoteCoin');\n let settleId: Str = undefined;\n let suffix = '';\n let settle: Str = undefined;\n let type = 'spot';\n let isLinear: Bool = undefined;\n let isInverse: Bool = undefined;\n let subType: Str = undefined;\n const isSpot = baseId === undefined; // for now spot markets have no properties baseCoin and quoteCoin\n if (isSpot) {\n const parsedMarketId = this.parseSpotMarketId (marketId);\n baseId = this.safeString (parsedMarketId, 'baseId');\n quoteId = this.safeString (parsedMarketId, 'quoteId');\n marketId += '_SPBL'; // spot markets should have current suffix\n } else {\n type = 'swap';\n fees['taker'] = this.safeNumber (market, 'takerFeeRate');\n fees['maker'] = this.safeNumber (market, 'makerFeeRate');\n const supportMarginCoins = this.safeList (market, 'supportMarginCoins', []);\n settleId = this.safeString (supportMarginCoins, 0);\n settle = this.safeCurrencyCode (settleId);\n suffix = ':' + settle;\n isLinear = quoteId === settleId; // todo check\n isInverse = baseId === settleId; // todo check\n if (isLinear) {\n subType = 'linear';\n } else if (isInverse) {\n subType = 'inverse';\n }\n }\n const base = this.safeCurrencyCode (baseId);\n const quote = this.safeCurrencyCode (quoteId);\n const symbol = base + '/' + quote + suffix;\n const symbolStatus = this.safeString (market, 'symbolStatus');\n const active = symbolStatus ? (symbolStatus === 'normal') : undefined;\n const volumePlace = this.safeString (market, 'volumePlace');\n const amountPrecisionString = this.parsePrecision (volumePlace);\n const pricePlace = this.safeString (market, 'pricePlace');\n const priceEndStep = this.safeString (market, 'priceEndStep');\n const pricePrecisionString = Precise.stringMul (this.parsePrecision (pricePlace), priceEndStep);\n return this.safeMarketStructure ({\n 'id': marketId,\n 'symbol': symbol,\n 'base': base,\n 'quote': quote,\n 'baseId': baseId,\n 'quoteId': quoteId,\n 'active': active,\n 'type': type,\n 'subType': subType,\n 'spot': isSpot,\n 'margin': isSpot ? false : undefined,\n 'swap': !isSpot,\n 'future': false,\n 'option': false,\n 'contract': !isSpot,\n 'settle': settle,\n 'settleId': settleId,\n 'contractSize': this.safeNumber (market, 'sizeMultiplier'),\n 'linear': isLinear,\n 'inverse': isInverse,\n 'taker': this.safeNumber (fees, 'taker'),\n 'maker': this.safeNumber (fees, 'maker'),\n 'percentage': this.safeBool (fees, 'percentage'),\n 'tierBased': this.safeBool (fees, 'tierBased'),\n 'feeSide': this.safeString (fees, 'feeSide'),\n 'expiry': undefined,\n 'expiryDatetime': undefined,\n 'strike': undefined,\n 'optionType': undefined,\n 'precision': {\n 'amount': this.parseNumber (amountPrecisionString),\n 'price': this.parseNumber (pricePrecisionString),\n },\n 'limits': {\n 'amount': {\n 'min': this.safeNumber (market, 'minTradeNum'),\n 'max': undefined,\n },\n 'price': {\n 'min': undefined,\n 'max': undefined,\n },\n 'leverage': {\n 'min': undefined,\n 'max': undefined,\n },\n 'cost': {\n 'min': undefined,\n 'max': undefined,\n },\n },\n 'created': undefined,\n 'info': market,\n });\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1480, "line_start" => 1471, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n return [\n this.safeInteger2 (ohlcv, 'ts', 0),\n this.safeNumber2 (ohlcv, 'open', 1),\n this.safeNumber2 (ohlcv, 'high', 2),\n this.safeNumber2 (ohlcv, 'low', 3),\n this.safeNumber2 (ohlcv, 'close', 4),\n this.safeNumber2 (ohlcv, 'baseVol', 5),\n ];\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"orderId\": \"1217143186968068096\",\n \"clientOrderId\": \"8fa3eb89-2377-4519-a199-35d5db9ed262\"\n }", "{\n \"clientOid\": \"1225791137701519360\",\n \"orderId\": \"1225791137697325056\"\n }", "{\n \"accountId\": \"1002820815393\",\n \"symbol\": \"ETHUSDT_SPBL\",\n \"orderId\": \"1217143186968068096\",\n \"clientOrderId\": \"8fa3eb89-2377-4519-a199-35d5db9ed262\",\n \"price\": \"0\",\n \"quantity\": \"10.0000000000000000\",\n \"orderType\": \"market\",\n \"side\": \"buy\",\n \"status\": \"full_fill\",\n \"fillPrice\": \"2340.5500000000000000\",\n \"fillQuantity\": \"0.0042000000000000\",\n \"fillTotalAmount\": \"9.8303100000000000\",\n \"enterPointSource\": \"API\",\n \"feeDetail\": \"{\n \\\"ETH\\\": {\n \\\"deduction\\\": false,\n \\\"feeCoinCode\\\": \\\"ETH\\\",\n \\\"totalDeductionFee\\\": 0,\n \\\"totalFee\\\": -0.0000042000000000},\n \\\"newFees\\\": {\n \\\"c\\\": 0,\n \\\"d\\\": 0,\n \\\"deduction\\\": false,\n \\\"r\\\": -0.0000042,\n \\\"t\\\": -0.0000042,\n \\\"totalDeductionFee\\\": 0\n }\n }\",\n \"orderSource\": \"market\",\n \"cTime\": \"1725915469877\"\n }", "{\n \"symbol\": \"ETHUSDT_UMCBL\",\n \"size\": 0.01,\n \"orderId\": \"1225791137697325056\",\n \"clientOid\": \"1225791137701519360\",\n \"filledQty\": 0.01,\n \"fee\": -0.01398864,\n \"price\": null,\n \"priceAvg\": 2331.44,\n \"state\": \"filled\",\n \"side\": \"close_long\",\n \"timeInForce\": \"normal\",\n \"totalProfits\": -2.23680000,\n \"posSide\": \"long\",\n \"marginCoin\": \"USDT\",\n \"filledAmount\": 23.3144,\n \"orderType\": \"market\",\n \"leverage\": \"5\",\n \"marginMode\": \"crossed\",\n \"reduceOnly\": true,\n \"enterPointSource\": \"API\",\n \"tradeSide\": \"close_long\",\n \"holdMode\": \"double_hold\",\n \"orderSource\": \"market\",\n \"cTime\": \"1727977302003\",\n \"uTime\": \"1727977303604\"\n }", "{\n \"accountId\": \"1002820815393\",\n \"symbol\": \"ETHUSDT_SPBL\",\n \"orderId\": \"1217347655911653376\",\n \"clientOrderId\": \"c57c07d1-bd00-4167-95e2-9b22a55fbc28\",\n \"price\": \"2000.0000000000000000\",\n \"quantity\": \"0.0010000000000000\",\n \"orderType\": \"limit\",\n \"side\": \"buy\",\n \"status\": \"new\",\n \"fillPrice\": \"0\",\n \"fillQuantity\": \"0.0000000000000000\",\n \"fillTotalAmount\": \"0.0000000000000000\",\n \"enterPointSource\": \"API\",\n \"feeDetail\": \"\",\n \"orderSource\": \"normal\",\n \"cTime\": \"1725964219072\"\n }" ], "line_end" => 4262, "line_start" => 4049, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString (order, 'orderId')" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "this.safeString2 (order, 'clientOrderId', 'clientOid')" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "lastTradeTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "this.safeInteger (order, 'uTime')" }, %{ "comment" => nil, "key" => "status", "value" => "this.parseOrderStatus (status)" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "timeInForce", "value" => "timeInForce" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "average", "value" => "priceAvg ? priceAvg : this.safeString (order, 'fillPrice')" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "filled", "value" => "this.safeString2 (order, 'fillQuantity', 'filledQty')" }, %{ "comment" => nil, "key" => "remaining", "value" => "undefined" }, %{ "comment" => nil, "key" => "triggerPrice", "value" => "triggerPrice" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "takeProfitPrice" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "stopLossPrice" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeString2 (order, 'fillTotalAmount', 'filledAmount')" }, %{ "comment" => nil, "key" => "trades", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'currency': feeCurrency,\n 'cost': feeCost,\n }" }, %{ "comment" => nil, "key" => "fees", "value" => "fees" }, %{ "comment" => nil, "key" => "reduceOnly", "value" => "this.safeBool (order, 'reduceOnly')" }, %{ "comment" => nil, "key" => "postOnly", "value" => "postOnly" }, %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "currency", "value" => "feeCurrency" }, %{ "comment" => nil, "key" => "cost", "value" => "feeCost" } ], "name" => "parseOrder", "signature" => "parseOrder (order, market = undefined): Order", "source" => "parseOrder (order, market = undefined): Order {\n //\n // createOrder spot\n // {\n // \"orderId\": \"1217143186968068096\",\n // \"clientOrderId\": \"8fa3eb89-2377-4519-a199-35d5db9ed262\"\n // }\n //\n // createOrder swap\n // {\n // \"clientOid\": \"1225791137701519360\",\n // \"orderId\": \"1225791137697325056\"\n // }\n //\n // privatePostApiSpotV1TradeOrderInfo, privatePostApiSpotV1TradeHistory\n // {\n // \"accountId\": \"1002820815393\",\n // \"symbol\": \"ETHUSDT_SPBL\",\n // \"orderId\": \"1217143186968068096\",\n // \"clientOrderId\": \"8fa3eb89-2377-4519-a199-35d5db9ed262\",\n // \"price\": \"0\",\n // \"quantity\": \"10.0000000000000000\",\n // \"orderType\": \"market\",\n // \"side\": \"buy\",\n // \"status\": \"full_fill\",\n // \"fillPrice\": \"2340.5500000000000000\",\n // \"fillQuantity\": \"0.0042000000000000\",\n // \"fillTotalAmount\": \"9.8303100000000000\",\n // \"enterPointSource\": \"API\",\n // \"feeDetail\": \"{\n // \\\"ETH\\\": {\n // \\\"deduction\\\": false,\n // \\\"feeCoinCode\\\": \\\"ETH\\\",\n // \\\"totalDeductionFee\\\": 0,\n // \\\"totalFee\\\": -0.0000042000000000},\n // \\\"newFees\\\": {\n // \\\"c\\\": 0,\n // \\\"d\\\": 0,\n // \\\"deduction\\\": false,\n // \\\"r\\\": -0.0000042,\n // \\\"t\\\": -0.0000042,\n // \\\"totalDeductionFee\\\": 0\n // }\n // }\",\n // \"orderSource\": \"market\",\n // \"cTime\": \"1725915469877\"\n // }\n //\n // privatePostApiMixV1OrderDetail, privateGetApiMixV1OrderMarginCoinCurrent\n // {\n // \"symbol\": \"ETHUSDT_UMCBL\",\n // \"size\": 0.01,\n // \"orderId\": \"1225791137697325056\",\n // \"clientOid\": \"1225791137701519360\",\n // \"filledQty\": 0.01,\n // \"fee\": -0.01398864,\n // \"price\": null,\n // \"priceAvg\": 2331.44,\n // \"state\": \"filled\",\n // \"side\": \"close_long\",\n // \"timeInForce\": \"normal\",\n // \"totalProfits\": -2.23680000,\n // \"posSide\": \"long\",\n // \"marginCoin\": \"USDT\",\n // \"filledAmount\": 23.3144,\n // \"orderType\": \"market\",\n // \"leverage\": \"5\",\n // \"marginMode\": \"crossed\",\n // \"reduceOnly\": true,\n // \"enterPointSource\": \"API\",\n // \"tradeSide\": \"close_long\",\n // \"holdMode\": \"double_hold\",\n // \"orderSource\": \"market\",\n // \"cTime\": \"1727977302003\",\n // \"uTime\": \"1727977303604\"\n // }\n //\n // privatePostApiSpotV1TradeOpenOrders\n // {\n // \"accountId\": \"1002820815393\",\n // \"symbol\": \"ETHUSDT_SPBL\",\n // \"orderId\": \"1217347655911653376\",\n // \"clientOrderId\": \"c57c07d1-bd00-4167-95e2-9b22a55fbc28\",\n // \"price\": \"2000.0000000000000000\",\n // \"quantity\": \"0.0010000000000000\",\n // \"orderType\": \"limit\",\n // \"side\": \"buy\",\n // \"status\": \"new\",\n // \"fillPrice\": \"0\",\n // \"fillQuantity\": \"0.0000000000000000\",\n // \"fillTotalAmount\": \"0.0000000000000000\",\n // \"enterPointSource\": \"API\",\n // \"feeDetail\": \"\",\n // \"orderSource\": \"normal\",\n // \"cTime\": \"1725964219072\"\n // }\n //\n // privatePostApiSpotV1PlanCurrentPlan, privatePostApiSpotV1PlanHistoryPlan\n // {\n // \"orderId\": \"1228669617606991872\",\n // \"clientOid\": \"1228669617573437440\",\n // \"symbol\": \"ETHUSDT_SPBL\",\n // \"size\": \"50\",\n // \"executePrice\": \"0\",\n // \"triggerPrice\": \"4000\",\n // \"status\": \"not_trigger\",\n // \"orderType\": \"market\",\n // \"side\": \"sell\",\n // \"triggerType\": \"fill_price\",\n // \"enterPointSource\": \"API\",\n // \"placeType\": null,\n // \"cTime\": \"1728663585092\",\n // \"uTime\": null\n // }\n //\n // privateGetApiMixV1PlanCurrentPlan\n // {\n // \"orderId\": \"1230779428914049025\",\n // \"clientOid\": \"1230779428914049024\",\n // \"symbol\": \"ETHUSDT_UMCBL\",\n // \"marginCoin\": \"USDT\",\n // \"size\": \"0.01\",\n // \"executePrice\": \"1000\",\n // \"triggerPrice\": \"1200\",\n // \"status\": \"not_trigger\",\n // \"orderType\": \"limit\",\n // \"planType\": \"normal_plan\",\n // \"side\": \"buy_single\",\n // \"triggerType\": \"fill_price\",\n // \"presetTakeProfitPrice\": \"4000\",\n // \"presetTakeLossPrice\": \"900\",\n // \"rangeRate\": \"\",\n // \"enterPointSource\": \"API\",\n // \"tradeSide\": \"buy_single\",\n // \"holdMode\": \"single_hold\",\n // \"reduceOnly\": false,\n // \"cTime\": \"1729166603306\",\n // \"uTime\": null\n // }\n //\n const marketId = this.safeString (order, 'symbol');\n const marginCoin = this.safeString (order, 'marginCoin');\n market = this.safeMarketCustom (marketId, market, marginCoin);\n const timestamp = this.safeInteger (order, 'cTime');\n let price = this.omitZero (this.safeString2 (order, 'price', 'executePrice')); // price is zero for market orders\n const priceAvg = this.omitZero (this.safeString (order, 'priceAvg'));\n if (price === undefined) {\n price = priceAvg;\n }\n const type = this.safeString (order, 'orderType');\n const side = this.parseOrderSide (this.safeStringLower (order, 'side'));\n let amount = this.safeString2 (order, 'quantity', 'size');\n const isTrigger = this.safeString (order, 'triggerType') !== undefined;\n const isMarketBuy = (type === 'market') && (side === 'buy');\n if ((market['spot']) && (isMarketBuy) && (!isTrigger)) {\n amount = undefined; // cost instead of amount is returned for market buy spot non-trigger orders\n }\n const status = this.safeString2 (order, 'status', 'state');\n const feeDetailString = this.safeString (order, 'feeDetail');\n let fees = undefined;\n let feeCurrency: Str = undefined;\n let feeCost: Str = undefined;\n if (feeDetailString !== undefined) {\n fees = this.parseFeeDetailString (feeDetailString);\n } else {\n feeCurrency = marginCoin ? this.safeCurrencyCode (marginCoin) : undefined;\n feeCost = Precise.stringAbs (this.safeString (order, 'fee'));\n }\n const timeInForce = this.parseOrderTimeInForce (this.safeStringLower (order, 'timeInForce'));\n let postOnly: Bool = undefined;\n if (timeInForce !== undefined) {\n postOnly = timeInForce === 'PO';\n }\n const triggerPrice = this.omitZero (this.safeString (order, 'triggerPrice'));\n let takeProfitPrice = this.omitZero (this.safeString (order, 'presetTakeProfitPrice'));\n let stopLossPrice = this.omitZero (this.safeString2 (order, 'presetTakeProfitPrice', 'presetTakeLossPrice'));\n const planType = this.safeString (order, 'planType');\n if (planType === 'loss_plan') {\n stopLossPrice = triggerPrice;\n } else if (planType === 'profit_plan') {\n takeProfitPrice = triggerPrice;\n }\n return this.safeOrder ({\n 'id': this.safeString (order, 'orderId'),\n 'clientOrderId': this.safeString2 (order, 'clientOrderId', 'clientOid'),\n 'datetime': this.iso8601 (timestamp),\n 'timestamp': timestamp,\n 'lastTradeTimestamp': undefined,\n 'lastUpdateTimestamp': this.safeInteger (order, 'uTime'),\n 'status': this.parseOrderStatus (status),\n 'symbol': market['symbol'],\n 'type': type,\n 'timeInForce': timeInForce,\n 'side': side,\n 'price': price,\n 'average': priceAvg ? priceAvg : this.safeString (order, 'fillPrice'),\n 'amount': amount,\n 'filled': this.safeString2 (order, 'fillQuantity', 'filledQty'),\n 'remaining': undefined,\n 'triggerPrice': triggerPrice,\n 'takeProfitPrice': takeProfitPrice,\n 'stopLossPrice': stopLossPrice,\n 'cost': this.safeString2 (order, 'fillTotalAmount', 'filledAmount'),\n 'trades': undefined,\n 'fee': {\n 'currency': feeCurrency,\n 'cost': feeCost,\n },\n 'fees': fees,\n 'reduceOnly': this.safeBool (order, 'reduceOnly'),\n 'postOnly': postOnly,\n 'info': order,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4299, "line_start" => 4279, "mappings" => [ %{ "comment" => nil, "key" => "buy", "value" => "'buy'" }, %{ "comment" => nil, "key" => "sell", "value" => "'sell'" }, %{ "comment" => nil, "key" => "open_long", "value" => "'buy'" }, %{ "comment" => nil, "key" => "open_short", "value" => "'sell'" }, %{ "comment" => nil, "key" => "close_long", "value" => "'sell'" }, %{ "comment" => nil, "key" => "close_short", "value" => "'buy'" }, %{ "comment" => nil, "key" => "reduce_close_long", "value" => "'sell'" }, %{ "comment" => nil, "key" => "reduce_close_short", "value" => "'buy'" }, %{ "comment" => nil, "key" => "offset_close_long", "value" => "'sell'" }, %{ "comment" => nil, "key" => "offset_close_short", "value" => "'buy'" }, %{ "comment" => nil, "key" => "burst_close_long", "value" => "'sell'" }, %{ "comment" => nil, "key" => "burst_close_short", "value" => "'buy'" }, %{ "comment" => nil, "key" => "delivery_close_long", "value" => "'sell'" }, %{ "comment" => nil, "key" => "delivery_close_short", "value" => "'buy'" }, %{ "comment" => nil, "key" => "buy_single", "value" => "'buy'" }, %{ "comment" => nil, "key" => "sell_single", "value" => "'sell'" } ], "name" => "parseOrderSide", "signature" => "parseOrderSide (side: Str): Str", "source" => "parseOrderSide (side: Str): Str {\n const sides = {\n 'buy': 'buy',\n 'sell': 'sell',\n 'open_long': 'buy',\n 'open_short': 'sell',\n 'close_long': 'sell',\n 'close_short': 'buy',\n 'reduce_close_long': 'sell',\n 'reduce_close_short': 'buy',\n 'offset_close_long': 'sell',\n 'offset_close_short': 'buy',\n 'burst_close_long': 'sell',\n 'burst_close_short': 'buy',\n 'delivery_close_long': 'sell',\n 'delivery_close_short': 'buy',\n 'buy_single': 'buy',\n 'sell_single': 'sell',\n };\n return this.safeString (sides, side, side);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4277, "line_start" => 4264, "mappings" => [ %{ "comment" => nil, "key" => "not_trigger", "value" => "'open'" }, %{ "comment" => nil, "key" => "init", "value" => "'open'" }, %{ "comment" => nil, "key" => "new", "value" => "'open'" }, %{ "comment" => nil, "key" => "partially_filled", "value" => "'open'" }, %{ "comment" => nil, "key" => "full_fill", "value" => "'closed'" }, %{ "comment" => nil, "key" => "filled", "value" => "'closed'" }, %{ "comment" => nil, "key" => "cancel", "value" => "'canceled'" }, %{ "comment" => nil, "key" => "canceled", "value" => "'canceled'" }, %{ "comment" => nil, "key" => "cancelled", "value" => "'canceled'" } ], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str): Str", "source" => "parseOrderStatus (status: Str): Str {\n const satuses = {\n 'not_trigger': 'open',\n 'init': 'open',\n 'new': 'open',\n 'partially_filled': 'open',\n 'full_fill': 'closed',\n 'filled': 'closed',\n 'cancel': 'canceled',\n 'canceled': 'canceled',\n 'cancelled': 'canceled',\n };\n return this.safeString (satuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 4309, "line_start" => 4301, "mappings" => [ %{ "comment" => nil, "key" => "normal", "value" => "'GTC'" }, %{ "comment" => nil, "key" => "post_only", "value" => "'PO'" }, %{ "comment" => nil, "key" => "iok", "value" => "'IOC'" }, %{ "comment" => nil, "key" => "fok", "value" => "'FOK'" } ], "name" => "parseOrderTimeInForce", "signature" => "parseOrderTimeInForce (timeInForce: Str): Str", "source" => "parseOrderTimeInForce (timeInForce: Str): Str {\n const timeInForces = {\n 'normal': 'GTC',\n 'post_only': 'PO',\n 'iok': 'IOC',\n 'fok': 'FOK',\n };\n return this.safeString (timeInForces, timeInForce, timeInForce);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"marginCoin\": \"USDT\",\n \"symbol\": \"ETHUSDT_UMCBL\",\n \"holdSide\": \"long\",\n \"openDelegateCount\": \"0\",\n \"margin\": \"2.55512\",\n \"available\": \"0.01\",\n \"locked\": \"0\",\n \"total\": \"0.01\",\n \"leverage\": 10,\n \"achievedProfits\": \"0\",\n \"averageOpenPrice\": \"2555.12\",\n \"marginMode\": \"crossed\",\n \"holdMode\": \"double_hold\",\n \"unrealizedPL\": \"0.0093\",\n \"liquidationPrice\": \"-3433.378333\",\n \"keepMarginRate\": \"0.0033\",\n \"marketPrice\": \"2556.05\",\n \"marginRatio\": \"0.001661599511\",\n \"autoMargin\": \"off\",\n \"cTime\": \"1726919819686\",\n \"uTime\": \"1726919819686\"\n }" ], "line_end" => 5144, "line_start" => 5074, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.safeNumber (position, 'total')" }, %{ "comment" => nil, "key" => "side", "value" => "this.safeStringLower (position, 'holdSide')" }, %{ "comment" => nil, "key" => "notional", "value" => "margin" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "this.safeNumber (position, 'unrealizedPL')" }, %{ "comment" => nil, "key" => "realizedPnl", "value" => "this.safeNumber (position, 'achievedProfits')" }, %{ "comment" => nil, "key" => "collateral", "value" => "undefined" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (position, 'marketPrice')" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "this.safeNumber (position, 'liquidationPrice')" }, %{ "comment" => nil, "key" => "marginMode", "value" => "this.parseMarginModeType (marginMode)" }, %{ "comment" => nil, "key" => "hedged", "value" => "isHedged" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "this.safeNumber (position, 'marginRatio')" }, %{ "comment" => nil, "key" => "lastUpdateTimestamp", "value" => "this.safeInteger (position, 'uTime')" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "position" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined)", "source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // {\n // \"marginCoin\": \"USDT\",\n // \"symbol\": \"ETHUSDT_UMCBL\",\n // \"holdSide\": \"long\",\n // \"openDelegateCount\": \"0\",\n // \"margin\": \"2.55512\",\n // \"available\": \"0.01\",\n // \"locked\": \"0\",\n // \"total\": \"0.01\",\n // \"leverage\": 10,\n // \"achievedProfits\": \"0\",\n // \"averageOpenPrice\": \"2555.12\",\n // \"marginMode\": \"crossed\",\n // \"holdMode\": \"double_hold\",\n // \"unrealizedPL\": \"0.0093\",\n // \"liquidationPrice\": \"-3433.378333\",\n // \"keepMarginRate\": \"0.0033\",\n // \"marketPrice\": \"2556.05\",\n // \"marginRatio\": \"0.001661599511\",\n // \"autoMargin\": \"off\",\n // \"cTime\": \"1726919819686\",\n // \"uTime\": \"1726919819686\"\n // }\n //\n const marketId = this.safeString (position, 'symbol');\n const settleId = this.safeString (position, 'marginCoin');\n market = this.safeMarketCustom (marketId, market, settleId);\n const timestamp = this.safeInteger (position, 'cTime');\n const marginMode = this.safeString (position, 'marginMode');\n let isHedged: Bool = undefined;\n const holdMode = this.safeString (position, 'holdMode');\n if (holdMode === 'double_hold') {\n isHedged = true;\n } else if (holdMode === 'single_hold') {\n isHedged = false;\n }\n const margin = this.safeNumber (position, 'margin');\n const keepMarginRate = this.safeString (position, 'keepMarginRate');\n return this.safePosition ({\n 'symbol': market['symbol'],\n 'id': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'contracts': this.safeNumber (position, 'total'), // todo check\n 'contractSize': undefined,\n 'side': this.safeStringLower (position, 'holdSide'),\n 'notional': margin, // todo check\n 'leverage': this.safeInteger (position, 'leverage'),\n 'unrealizedPnl': this.safeNumber (position, 'unrealizedPL'),\n 'realizedPnl': this.safeNumber (position, 'achievedProfits'),\n 'collateral': undefined, // todo check\n 'entryPrice': this.safeNumber (position, 'averageOpenPrice'),\n 'markPrice': this.safeNumber (position, 'marketPrice'),\n 'liquidationPrice': this.safeNumber (position, 'liquidationPrice'),\n 'marginMode': this.parseMarginModeType (marginMode),\n 'hedged': isHedged,\n 'maintenanceMargin': undefined, // todo check\n 'maintenanceMarginPercentage': this.parseNumber (Precise.stringMul (keepMarginRate, '100')), // todo check\n 'initialMargin': margin, // todo check\n 'initialMarginPercentage': undefined,\n 'marginRatio': this.safeNumber (position, 'marginRatio'),\n 'lastUpdateTimestamp': this.safeInteger (position, 'uTime'),\n 'lastPrice': undefined,\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n 'percentage': undefined,\n 'info': position,\n });\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1053, "line_start" => 1029, "mappings" => [], "name" => "parseSpotMarketId", "signature" => "parseSpotMarketId (marketId)", "source" => "parseSpotMarketId (marketId) {\n let baseId = undefined;\n let quoteId = undefined;\n const currencyIds = this.safeList (this.options, 'currencyIdsListForParseMarket', []);\n for (let i = 0; i < currencyIds.length; i++) {\n const currencyId = currencyIds[i];\n const entryIndex = marketId.indexOf (currencyId);\n if (entryIndex > -1) {\n const restId = marketId.replace (currencyId, '');\n if (entryIndex === 0) {\n baseId = currencyId;\n quoteId = restId;\n } else {\n baseId = restId;\n quoteId = currencyId;\n }\n break;\n }\n }\n const result: Dict = {\n 'baseId': baseId,\n 'quoteId': quoteId,\n };\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"BTCUSDT\",\n \"high24h\": \"59461.34\",\n \"low24h\": \"57723.23\",\n \"close\": \"59056.02\",\n \"quoteVol\": \"18240112.23368\",\n \"baseVol\": \"309.05564\",\n \"usdtVol\": \"18240112.2336744\",\n \"ts\": \"1725114038951\",\n \"buyOne\": \"59055.85\",\n \"sellOne\": \"59057.45\",\n \"bidSz\": \"0.0139\",\n \"askSz\": \"0.0139\",\n \"openUtc0\": \"59126.71\",\n \"changeUtc\": \"-0.0012\",\n \"change\": \"0.01662\"\n }", "{\n \"symbol\": \"ETHUSDT_UMCBL\",\n \"last\": \"2540.6\",\n \"bestAsk\": \"2540.71\",\n \"bestBid\": \"2540.38\",\n \"bidSz\": \"12.1\",\n \"askSz\": \"20\",\n \"high24h\": \"2563.91\",\n \"low24h\": \"2398.3\",\n \"timestamp\": \"1725316687177\",\n \"priceChangePercent\": \"0.01134\",\n \"baseVolume\": \"706928.96\",\n \"quoteVolume\": \"1756401737.8766\",\n \"usdtVolume\": \"1756401737.8766\",\n \"openUtc\": \"2424.49\",\n \"chgUtc\": \"0.04789\",\n \"indexPrice\": \"2541.977142\",\n \"fundingRate\": \"0.00006\",\n \"holdingAmount\": \"144688.49\",\n \"deliveryStartTime\": null,\n \"deliveryTime\": null,\n \"deliveryStatus\": \"normal\"\n }" ], "line_end" => 1310, "line_start" => 1233, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "high", "value" => "this.safeString (ticker, 'high24h')" }, %{ "comment" => nil, "key" => "low", "value" => "this.safeString (ticker, 'low24h')" }, %{ "comment" => nil, "key" => "bid", "value" => "this.safeString2 (ticker, 'buyOne', 'bestBid')" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "this.safeString (ticker, 'bidSz')" }, %{ "comment" => nil, "key" => "ask", "value" => "this.safeString2 (ticker, 'sellOne', 'bestAsk')" }, %{ "comment" => nil, "key" => "askVolume", "value" => "this.safeString (ticker, 'askSz')" }, %{ "comment" => nil, "key" => "vwap", "value" => "undefined" }, %{ "comment" => nil, "key" => "open", "value" => "this.safeString2 (ticker, 'openUtc0', 'openUtc')" }, %{ "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" => "Precise.stringMul (this.safeString2 (ticker, 'changeUtc', 'chgUtc'), '100')" }, %{ "comment" => nil, "key" => "average", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "this.safeString2 (ticker, 'baseVol', 'baseVolume')" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "this.safeString2 (ticker, 'quoteVol', 'quoteVolume')" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeString (ticker, 'indexPrice')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "info", "value" => "ticker" } ], "name" => "parseTicker", "signature" => "parseTicker (ticker, market: Market = undefined): Ticker", "source" => "parseTicker (ticker, market: Market = undefined): Ticker {\n //\n // spot\n // {\n // \"symbol\": \"BTCUSDT\",\n // \"high24h\": \"59461.34\",\n // \"low24h\": \"57723.23\",\n // \"close\": \"59056.02\",\n // \"quoteVol\": \"18240112.23368\",\n // \"baseVol\": \"309.05564\",\n // \"usdtVol\": \"18240112.2336744\",\n // \"ts\": \"1725114038951\",\n // \"buyOne\": \"59055.85\",\n // \"sellOne\": \"59057.45\",\n // \"bidSz\": \"0.0139\",\n // \"askSz\": \"0.0139\",\n // \"openUtc0\": \"59126.71\",\n // \"changeUtc\": \"-0.0012\",\n // \"change\": \"0.01662\"\n // }\n //\n // swap\n // {\n // \"symbol\": \"ETHUSDT_UMCBL\",\n // \"last\": \"2540.6\",\n // \"bestAsk\": \"2540.71\",\n // \"bestBid\": \"2540.38\",\n // \"bidSz\": \"12.1\",\n // \"askSz\": \"20\",\n // \"high24h\": \"2563.91\",\n // \"low24h\": \"2398.3\",\n // \"timestamp\": \"1725316687177\",\n // \"priceChangePercent\": \"0.01134\",\n // \"baseVolume\": \"706928.96\",\n // \"quoteVolume\": \"1756401737.8766\",\n // \"usdtVolume\": \"1756401737.8766\",\n // \"openUtc\": \"2424.49\",\n // \"chgUtc\": \"0.04789\",\n // \"indexPrice\": \"2541.977142\",\n // \"fundingRate\": \"0.00006\",\n // \"holdingAmount\": \"144688.49\",\n // \"deliveryStartTime\": null,\n // \"deliveryTime\": null,\n // \"deliveryStatus\": \"normal\"\n // }\n //\n const timestamp = this.safeInteger2 (ticker, 'ts', 'timestamp');\n let marketId = this.safeString (ticker, 'symbol', '');\n if (marketId.indexOf ('_') < 0) {\n marketId += '_SPBL'; // spot markets from tickers endpoints have no suffix specific for market id\n }\n market = this.safeMarketCustom (marketId, market);\n const last = this.safeString2 (ticker, 'close', 'last');\n return this.safeTicker ({\n 'symbol': market['symbol'],\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': this.safeString (ticker, 'high24h'),\n 'low': this.safeString (ticker, 'low24h'),\n 'bid': this.safeString2 (ticker, 'buyOne', 'bestBid'),\n 'bidVolume': this.safeString (ticker, 'bidSz'),\n 'ask': this.safeString2 (ticker, 'sellOne', 'bestAsk'),\n 'askVolume': this.safeString (ticker, 'askSz'),\n 'vwap': undefined,\n 'open': this.safeString2 (ticker, 'openUtc0', 'openUtc'),\n 'close': last,\n 'last': last,\n 'previousClose': undefined,\n 'change': undefined,\n 'percentage': Precise.stringMul (this.safeString2 (ticker, 'changeUtc', 'chgUtc'), '100'),\n 'average': undefined,\n 'baseVolume': this.safeString2 (ticker, 'baseVol', 'baseVolume'),\n 'quoteVolume': this.safeString2 (ticker, 'quoteVol', 'quoteVolume'),\n 'indexPrice': this.safeString (ticker, 'indexPrice'),\n 'markPrice': undefined,\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"symbol\": \"ETHUSDT_SPBL\",\n \"tradeId\": \"1214135619719827457\",\n \"side\": \"Buy\",\n \"fillPrice\": \"2458.62\",\n \"fillQuantity\": \"0.4756\",\n \"fillTime\": \"1725198409967\"\n }", "{\n \"tradeId\": \"1214936067582234782\",\n \"price\": \"57998.5\",\n \"size\": \"1.918\",\n \"side\": \"Sell\",\n \"timestamp\": \"1725389251000\",\n \"symbol\": \"BTCUSDT_UMCBL\"\n }", "{\n \"accountId\": \"1002820815393\",\n \"symbol\": \"ETHUSDT_SPBL\",\n \"orderId\": \"1217143186968068096\",\n \"fillId\": \"1217143193356505089\",\n \"orderType\": \"market\",\n \"side\": \"buy\",\n \"fillPrice\": \"2340.55\",\n \"fillQuantity\": \"0.0042\",\n \"fillTotalAmount\": \"9.83031\",\n \"feeCcy\": \"ETH\",\n \"fees\": \"-0.0000042\",\n \"takerMakerFlag\": \"taker\",\n \"cTime\": \"1725915471400\"\n }", "{\n \"tradeId\": \"1225467075440189441\",\n \"symbol\": \"ETHUSD_DMCBL\",\n \"orderId\": \"1225467075288719360\",\n \"price\": \"2362.03\",\n \"sizeQty\": \"0.1\",\n \"fee\": \"-0.00005996\",\n \"side\": \"burst_close_long\",\n \"fillAmount\": \"236.203\",\n \"profit\": \"-0.0083359\",\n \"enterPointSource\": \"SYS\",\n \"tradeSide\": \"burst_close_long\",\n \"holdMode\": \"double_hold\",\n \"takerMakerFlag\": \"taker\",\n \"cTime\": \"1727900039539\"\n }" ], "line_end" => 1653, "line_start" => 1565, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (trade, 'tradeId', 'fillId')" }, %{ "comment" => nil, "key" => "order", "value" => "this.safeString (trade, 'orderId')" }, %{ "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" => "this.safeString (trade, 'orderType')" }, %{ "comment" => nil, "key" => "side", "value" => "this.parseOrderSide (side)" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "this.safeString (trade, 'takerMakerFlag')" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeString2 (trade, 'fillPrice', 'price')" }, %{ "comment" => nil, "key" => "amount", "value" => "this.safeStringN (trade, [ 'fillQuantity', 'size', 'sizeQty' ])" }, %{ "comment" => nil, "key" => "cost", "value" => "this.safeString2 (trade, 'fillTotalAmount', 'fillAmount')" }, %{ "comment" => nil, "key" => "fee", "value" => "{\n 'cost': feeCost,\n 'currency': feeCurrency,\n }" }, %{ "comment" => nil, "key" => "info", "value" => "trade" }, %{ "comment" => nil, "key" => "cost", "value" => "feeCost" }, %{ "comment" => nil, "key" => "currency", "value" => "feeCurrency" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // fetchTrades spot\n // {\n // \"symbol\": \"ETHUSDT_SPBL\",\n // \"tradeId\": \"1214135619719827457\",\n // \"side\": \"Buy\",\n // \"fillPrice\": \"2458.62\",\n // \"fillQuantity\": \"0.4756\",\n // \"fillTime\": \"1725198409967\"\n // }\n //\n // fetchTrades swap\n // {\n // \"tradeId\": \"1214936067582234782\",\n // \"price\": \"57998.5\",\n // \"size\": \"1.918\",\n // \"side\": \"Sell\",\n // \"timestamp\": \"1725389251000\",\n // \"symbol\": \"BTCUSDT_UMCBL\"\n // }\n //\n // fetchMyTrades spot\n // {\n // \"accountId\": \"1002820815393\",\n // \"symbol\": \"ETHUSDT_SPBL\",\n // \"orderId\": \"1217143186968068096\",\n // \"fillId\": \"1217143193356505089\",\n // \"orderType\": \"market\",\n // \"side\": \"buy\",\n // \"fillPrice\": \"2340.55\",\n // \"fillQuantity\": \"0.0042\",\n // \"fillTotalAmount\": \"9.83031\",\n // \"feeCcy\": \"ETH\",\n // \"fees\": \"-0.0000042\",\n // \"takerMakerFlag\": \"taker\",\n // \"cTime\": \"1725915471400\"\n // }\n //\n // fetchMyTrades swap\n // {\n // \"tradeId\": \"1225467075440189441\",\n // \"symbol\": \"ETHUSD_DMCBL\",\n // \"orderId\": \"1225467075288719360\",\n // \"price\": \"2362.03\",\n // \"sizeQty\": \"0.1\",\n // \"fee\": \"-0.00005996\",\n // \"side\": \"burst_close_long\",\n // \"fillAmount\": \"236.203\",\n // \"profit\": \"-0.0083359\",\n // \"enterPointSource\": \"SYS\",\n // \"tradeSide\": \"burst_close_long\",\n // \"holdMode\": \"double_hold\",\n // \"takerMakerFlag\": \"taker\",\n // \"cTime\": \"1727900039539\"\n // }\n //\n const marketId = this.safeString (trade, 'symbol');\n market = this.safeMarketCustom (marketId, market);\n const timestamp = this.safeIntegerN (trade, [ 'fillTime', 'timestamp', 'cTime' ]);\n const fees = this.safeString2 (trade, 'fees', 'fee');\n let feeCost: Str = undefined;\n if (fees !== undefined) {\n feeCost = Precise.stringAbs (fees);\n }\n let feeCurrency = this.safeString (trade, 'feeCcy');\n if ((feeCurrency === undefined) && (market['settle'] !== undefined)) {\n feeCurrency = market['settle'];\n }\n const side = this.safeStringLower2 (trade, 'tradeSide', 'side');\n return this.safeTrade ({\n 'id': this.safeString2 (trade, 'tradeId', 'fillId'),\n 'order': this.safeString (trade, 'orderId'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': market['symbol'],\n 'type': this.safeString (trade, 'orderType'),\n 'side': this.parseOrderSide (side),\n 'takerOrMaker': this.safeString (trade, 'takerMakerFlag'),\n 'price': this.safeString2 (trade, 'fillPrice', 'price'),\n 'amount': this.safeStringN (trade, [ 'fillQuantity', 'size', 'sizeQty' ]),\n 'cost': this.safeString2 (trade, 'fillTotalAmount', 'fillAmount'),\n 'fee': {\n 'cost': feeCost,\n 'currency': feeCurrency,\n },\n 'info': trade,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"id\": \"1213046466852196352\",\n \"txId\": \"824246b030cd84d56400661303547f43a1d9fef66cf968628dd5112f362053ff\",\n \"coin\": \"USDT\",\n \"type\": \"deposit\",\n \"amount\": \"99.20000000\",\n \"status\": \"success\",\n \"toAddress\": \"TKTUt7qiTaMgnTwZXjE3ZBkPB6LKhLPJyZ\",\n \"fee\": null,\n \"chain\": \"TRX(TRC20)\",\n \"confirm\": null,\n \"clientOid\": null,\n \"tag\": null,\n \"fromAddress\": null,\n \"dest\": \"on_chain\",\n \"cTime\": \"1724938735688\",\n \"uTime\": \"1724938746015\"\n }", "{\n \"code\": \"00000\",\n \"msg\": \"success\",\n \"data\": {\n \"orderId\":888291686266343424\",\n \"clientOrderId\":\"123\"\n }\n }" ], "line_end" => 2286, "line_start" => 2207, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "transaction" }, %{ "comment" => nil, "key" => "id", "value" => "this.safeString2 (transaction, 'id', 'orderId')" }, %{ "comment" => nil, "key" => "txid", "value" => "txid" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "network", "value" => "network" }, %{ "comment" => nil, "key" => "address", "value" => "undefined" }, %{ "comment" => nil, "key" => "addressTo", "value" => "addressTo" }, %{ "comment" => nil, "key" => "addressFrom", "value" => "addressFrom" }, %{ "comment" => nil, "key" => "tag", "value" => "tag" }, %{ "comment" => nil, "key" => "tagTo", "value" => "undefined" }, %{ "comment" => nil, "key" => "tagFrom", "value" => "undefined" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "updated", "value" => "undefined" }, %{ "comment" => nil, "key" => "internal", "value" => "undefined" }, %{ "comment" => nil, "key" => "comment", "value" => "undefined" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" } ], "name" => "parseTransaction", "signature" => "parseTransaction (transaction, currency: Currency = undefined): Transaction", "source" => "parseTransaction (transaction, currency: Currency = undefined): Transaction {\n //\n // fetchDeposits\n //\n // {\n // \"id\": \"1213046466852196352\",\n // \"txId\": \"824246b030cd84d56400661303547f43a1d9fef66cf968628dd5112f362053ff\",\n // \"coin\": \"USDT\",\n // \"type\": \"deposit\",\n // \"amount\": \"99.20000000\",\n // \"status\": \"success\",\n // \"toAddress\": \"TKTUt7qiTaMgnTwZXjE3ZBkPB6LKhLPJyZ\",\n // \"fee\": null,\n // \"chain\": \"TRX(TRC20)\",\n // \"confirm\": null,\n // \"clientOid\": null,\n // \"tag\": null,\n // \"fromAddress\": null,\n // \"dest\": \"on_chain\",\n // \"cTime\": \"1724938735688\",\n // \"uTime\": \"1724938746015\"\n // }\n //\n // withdraw\n //\n // {\n // \"code\": \"00000\",\n // \"msg\": \"success\",\n // \"data\": {\n // \"orderId\":888291686266343424\",\n // \"clientOrderId\":\"123\"\n // }\n // }\n //\n let status = this.safeString (transaction, 'status');\n if (status === 'success') {\n status = 'ok';\n }\n const txid = this.safeString (transaction, 'txId');\n const coin = this.safeString (transaction, 'coin');\n const code = this.safeCurrencyCode (coin, currency);\n const timestamp = this.safeInteger (transaction, 'cTime');\n const amount = this.safeNumber (transaction, 'amount');\n const networkId = this.safeString (transaction, 'chain');\n const network = this.safeString (this.options['networksById'], networkId, networkId);\n const addressTo = this.safeString (transaction, 'toAddress');\n const addressFrom = this.safeString (transaction, 'fromAddress');\n const tag = this.safeString (transaction, 'tag');\n const type = this.safeString (transaction, 'type');\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 return {\n 'info': transaction,\n 'id': this.safeString2 (transaction, 'id', 'orderId'),\n 'txid': txid,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'network': network,\n 'address': undefined,\n 'addressTo': addressTo,\n 'addressFrom': addressFrom,\n 'tag': tag,\n 'tagTo': undefined,\n 'tagFrom': undefined,\n 'type': type,\n 'amount': amount,\n 'currency': code,\n 'status': status,\n 'updated': undefined,\n 'internal': undefined,\n 'comment': undefined,\n 'fee': fee,\n } as Transaction;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1984, "line_start" => 1966, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "this.safeString (data, 'transferId')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "datetime", "value" => "undefined" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (undefined, currency)" }, %{ "comment" => nil, "key" => "amount", "value" => "undefined" }, %{ "comment" => nil, "key" => "fromAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "toAccount", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "info", "value" => "transfer" } ], "name" => "parseTransfer", "signature" => "parseTransfer (transfer, currency: Currency = undefined)", "source" => "parseTransfer (transfer, currency: Currency = undefined) {\n const msg = this.safeString (transfer, 'msg');\n let status: Str = undefined;\n if (msg === 'success') {\n status = 'ok';\n }\n const data = this.safeDict (transfer, 'data', {});\n return {\n 'id': this.safeString (data, 'transferId'),\n 'timestamp': undefined,\n 'datetime': undefined,\n 'currency': this.safeCurrencyCode (undefined, currency),\n 'amount': undefined,\n 'fromAccount': undefined,\n 'toAccount': undefined,\n 'status': status,\n 'info': transfer,\n };\n }" } ], path_prefix: "", pro: true, quote_json_numbers: nil, rate_limits: %{ interval_ms: 50, period: 1000, requests: 20, rolling_window_size: 60000 }, raw_endpoints: %{ private: [ %{ auth: false, cost: 2, method: :get, path: "/api/mix/v1/account/account" }, %{ auth: false, cost: 2, method: :get, path: "/api/mix/v1/account/accountBill" }, %{ auth: false, cost: 4, method: :get, path: "/api/mix/v1/account/accountBusinessBill" }, %{ auth: false, cost: 2, method: :get, path: "/api/mix/v1/account/accounts" }, %{ auth: false, cost: 2, method: :get, path: "/api/mix/v1/order/allFills" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/order/current" }, %{ auth: false, cost: 2, method: :get, path: "/api/mix/v1/order/detail" }, %{ auth: false, cost: 2, method: :get, path: "/api/mix/v1/order/fills" }, %{ auth: false, cost: 2, method: :get, path: "/api/mix/v1/order/history" }, %{ auth: false, cost: 4, method: :get, path: "/api/mix/v1/order/historyProductType" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/order/marginCoinCurrent" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/plan/currentPlan" }, %{ auth: false, cost: 2, method: :get, path: "/api/mix/v1/plan/historyPlan" }, %{ auth: false, cost: 4, method: :get, path: "/api/mix/v1/position/allPosition-v2" }, %{ auth: false, cost: 2, method: :get, path: "/api/mix/v1/position/singlePosition-v2" }, %{ auth: false, cost: 2, method: :get, path: "/api/spot/v1/account/assets" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/account/getInfo" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/account/transferRecords" }, %{ auth: false, cost: 4, method: :get, path: "/api/spot/v1/wallet/deposit-address" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/wallet/deposit-list" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/wallet/withdrawal-list-v2" }, %{ auth: false, cost: 1, method: :get, path: "/pi/spot/v1/wallet/withdrawal-list" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/plan/historyPlan" }, %{ auth: false, cost: 4, method: :post, path: "/api/mix/v1/account/setMargin" }, %{ auth: false, cost: 4, method: :post, path: "/api/spot/v1/wallet/withdrawal-v2" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/placePositionsTPSL" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/trade/cancel-batch-orders" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/order/cancel-order" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/trade/cancel-batch-orders-v2" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/trade/fills" }, %{ auth: false, cost: 4, method: :post, path: "/api/mix/v1/account/setLeverage" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/plan/currentPlan" }, %{ auth: false, cost: 4, method: :post, path: "/api/spot/v1/wallet/transfer-v2" }, %{ auth: false, cost: 2, method: :post, path: "/api/spot/v1/trade/cancel-symbol-order" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/placeTrailStop" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/cancelAllPlan" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/placeTPSL" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/wallet/withdrawal-inner-v2" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/plan/placePlan" }, %{ auth: false, cost: 4, method: :post, path: "/api/mix/v1/account/setMarginMode" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/order/cancel-symbol-orders" }, %{ auth: false, cost: 1, method: :post, path: "/api/mix/v1/order/batch-orders" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/cancelSymbolPlan" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/cancelPlan" }, %{ auth: false, cost: 2, method: :post, path: "/api/spot/v1/plan/batchCancelPlan" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/trade/cancel-order" }, %{ auth: false, cost: 4, method: :post, path: "/api/mix/v1/account/setPositionMode" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/order/placeOrder" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/trade/open-orders" }, %{ auth: false, cost: 2, method: :post, path: "/api/spot/v1/trade/orders" }, %{ auth: false, cost: 2, method: :post, path: "/api/spot/v1/account/bills" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/order/cancel-all-orders" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/trade/history" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/trade/batch-orders" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/plan/modifyPlan" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/modifyPlan" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/modifyPlanPreset" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/modifyTPSLPlan" }, %{ auth: false, cost: 2, method: :post, path: "/api/spot/v1/trade/cancel-order-v2" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/plan/cancelPlan" }, %{ auth: false, cost: 1, method: :post, path: "/api/spot/v1/trade/orderInfo" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/order/cancel-batch-orders" }, %{ auth: false, cost: 2, method: :post, path: "/api/mix/v1/plan/placePlan" }, %{ auth: false, cost: 1, method: :post, path: "/api/mix/v1/account/open-count" } ], public: [ %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/candles" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/contracts" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/current-fundRate" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/depth" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/fills" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/fills-history" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/funding-time" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/history-fundRate" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/mark-price" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/merge-depth" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/open-interest" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/queryPositionLever" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/symbol-leverage" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/ticker" }, %{ auth: false, cost: 1, method: :get, path: "/api/mix/v1/market/tickers" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/market/candles" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/market/depth" }, %{ auth: false, cost: 2, method: :get, path: "/api/spot/v1/market/fills" }, %{ auth: false, cost: 2, method: :get, path: "/api/spot/v1/market/fills-history" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/market/history-candles" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/market/merge-depth" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/market/ticker" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/market/tickers" }, %{ auth: false, cost: 6.666666666666667, method: :get, path: "/api/spot/v1/public/currencies" }, %{ auth: false, cost: 1, method: :get, path: "/api/spot/v1/public/time" }, %{ auth: false, cost: 1, method: :get, path: "/pi/mix/v1/market/index" } ] }, required_credentials: %{ api_key: true, password: true, secret: true, uid: false }, requires_eddsa: false, response_error: %{ code_field: "error", field: "success", message_field: "message", success_values: nil, type: :success_bool }, signing: %{ api_key_header: "ACCESS-KEY", confidence: :high, has_passphrase: true, passphrase_header: "ACCESS-PASSPHRASE", pattern: :hmac_sha256_passphrase_signed, signature_encoding: :base64, signature_header: "ACCESS-SIGN", timestamp_header: "ACCESS-TIMESTAMP" }, spec_format_version: 1, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: nil, symbol_patterns: %{}, timeframes: %{ "12h" => "12H", "15" => "15m", "1M" => "1M", "1d" => "1D", "1h" => "1H", "1m" => "1m", "1w" => "1W", "2h" => "2H", "30" => "30m", "3d" => "3D", "3m" => "3m", "4h" => "4H", "5m" => "5m", "6h" => "6H" }, url_strategy: %{ detected_from: "fallback", pattern: :no_prefix, prefix: nil }, urls: %{ api: "https://api.coincatch.com", api_sections: %{ "private" => "https://api.coincatch.com", "public" => "https://api.coincatch.com" }, doc: "https://coincatch.github.io/github.io/en/", other: nil, sandbox: nil, www: "https://www.coincatch.com/" }, version: "v1", ws: %{ auth: %{ algorithm: :sha256, encoding: :base64, market_specific: false, message_format: :op_args, op_field: "op", op_value: "auth", pattern: :generic_hmac, payload_format: "custom", requires_passphrase: true, timestamp_unit: :seconds }, channel_templates: %{ watch_balance: %{ channel_name: "account", market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_ohlcv: %{ channel_name: "candle", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_order_book: %{ channel_name: "books", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_order_book_for_symbols: %{ channel_name: "books", market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_orders: %{ channel_name: "orders", 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_private: %{ auth_required: true, market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_private_multiple: %{ auth_required: true, market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_public: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_public_multiple: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_ticker: %{ channel_name: "ticker", market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_tickers: %{ market_id_format: :native, params: [], pattern: :topic_based, separator: "." }, watch_trades: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." }, watch_trades_for_symbols: %{ market_id_format: :native, params: [ %{ "default" => nil, "name" => "limit" } ], pattern: :topic_based, separator: "." } }, has: %{ watch_balance: true, watch_bids_asks: nil, watch_liquidations: nil, watch_liquidations_for_symbols: nil, watch_my_liquidations: nil, watch_my_liquidations_for_symbols: nil, 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: nil, watch_position: nil, watch_positions: true, watch_status: nil, watch_ticker: true, watch_tickers: true, watch_trades: true, watch_trades_for_symbols: true }, message_patterns: [ %{ 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 ] }, %{ format: :string, sources: [ :ping ] } ], options: %{ "timeframesForWs" => %{ "12h" => "12H", "15m" => "15m", "1d" => "1D", "1h" => "1H", "1m" => "1m", "1w" => "1W", "30m" => "30m", "4h" => "4H", "5m" => "5m" }, "watchOrderBook" => %{ "checksum" => true } }, subscription_config: %{ args_field: "args", args_format: :string_list, market_id_format: :native, op_field: "op", separator: "." }, subscription_pattern: :op_subscribe, urls: %{ "private" => "wss://ws.coincatch.com/private/v1/stream", "public" => "wss://ws.coincatch.com/public/v1/stream" }, watch_methods: [ "watchBalance", "watchOHLCV", "watchOrderBook", "watchOrderBookForSymbols", "watchOrders", "watchPositions", "watchPrivate", "watchPrivateMultiple", "watchPublic", "watchPublicMultiple", "watchTicker", "watchTickers", "watchTrades", "watchTradesForSymbols" ] } }