# Delta Exchange Exchange Specification # # Auto-generated by: mix ccxt.extract delta # 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: :supported, comment: nil, countries: [ "VC" ], currencies: %{}, currency_aliases: %{ "BCHSV" => "BSV", "XBT" => "BTC" }, dex: false, enable_rate_limit: true, endpoint_extraction_stats: %{ "capturedMethods" => 36, "coveragePercent" => 100, "enabledMethods" => 37, "excluded" => [], "excludedMethods" => 0, "extractableMethods" => 37, "failures" => [ %{ "error" => "Cannot read properties of undefined (reading 'symbol')", "method" => "fetchIndexOHLCV" } ] }, endpoints: [ %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :delete, name: :cancel_all_orders, param_mappings: %{}, params: [ :symbol ], path: "/orders/all", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :delete, name: :cancel_order, param_mappings: %{}, params: [ :id, :symbol ], path: "/orders", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "order_type" => "limit_order" }, market_type: :spot, method: :post, name: :create_limit_order, param_mappings: %{ "amount" => "size", "price" => "limit_price" }, params: [ :symbol, :side, :amount, :price ], path: "/orders", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "order_type" => "market_order" }, market_type: :spot, method: :post, name: :create_market_order, param_mappings: %{ "amount" => "size" }, params: [ :symbol, :side, :amount, :price ], path: "/orders", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "order_type" => "limit_order" }, market_type: :spot, method: :post, name: :create_order, param_mappings: %{ "amount" => "size", "price" => "limit_price" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/orders", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "order_type" => "limit_order", "reduce_only" => true }, market_type: :swap, method: :post, name: :create_reduce_only_order, param_mappings: %{ "amount" => "size", "price" => "limit_price" }, params: [ :symbol, :type, :side, :amount, :price ], path: "/orders", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, default_params: %{ "size" => 0 }, market_type: :spot, method: :put, name: :edit_order, param_mappings: %{ "amount" => "size", "price" => "limit_price" }, params: [ :id, :symbol, :type, :side, :amount, :price ], path: "/orders", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_balance, param_mappings: %{}, params: [], path: "/wallet/balances", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_closed_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/orders/history", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_currencies, param_mappings: %{}, params: [], path: "/assets", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_deposit_address, param_mappings: %{ "code" => "asset_symbol" }, params: [ :code ], path: "/deposits/address", response_transformer: {:extract_path_unwrap, ["result"]}, 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: "/tickers/{symbol}", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "contract_types" => "perpetual_futures" }, market_type: :swap, method: :get, name: :fetch_funding_rates, param_mappings: %{}, params: [ :symbols ], path: "/tickers", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "symbol" => "BTC-250103-100000-C" }, market_type: :option, method: :get, name: :fetch_greeks, param_mappings: %{}, params: [ :symbol ], path: "/tickers/{symbol}", response_transformer: {:extract_path, ["result"]}, 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: "/l2orderbook/{symbol}", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_ledger, param_mappings: %{}, params: [ :code, :since, :limit ], path: "/wallet/transactions", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_leverage, param_mappings: %{}, params: [ :symbol ], path: "/products/{product_id}/orders/leverage", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_margin_mode, param_mappings: %{}, params: [ :symbol ], path: "/profile", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "end" => "", "resolution" => "1m", "start" => 1771519419, "symbol" => "MARK:BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_mark_ohlcv, param_mappings: %{ "since" => "start", "timeframe" => "resolution" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/history/candles", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_markets, param_mappings: %{}, params: [], path: "/products", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_my_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/fills", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "end" => "" }, market_type: :spot, method: :get, name: :fetch_ohlcv, param_mappings: %{ "since" => "start", "timeframe" => "resolution" }, params: [ :symbol, :timeframe, :since, :limit ], path: "/history/candles", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "symbol" => "BTCUSDT" }, market_type: :swap, method: :get, name: :fetch_open_interest, param_mappings: %{}, params: [ :symbol ], path: "/tickers/{symbol}", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_open_orders, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/orders", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "symbol" => "BTC-250103-100000-C" }, market_type: :option, method: :get, name: :fetch_option, param_mappings: %{}, params: [ :symbol ], path: "/tickers/{symbol}", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :spot, method: :get, name: :fetch_order, param_mappings: %{ "id" => "order_id" }, params: [ :id, :symbol ], path: "/orders/{order_id}", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_order_book, param_mappings: %{ "limit" => "depth" }, params: [ :symbol, :limit ], path: "/l2orderbook/{symbol}", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_position, param_mappings: %{}, params: [ :symbol ], path: "/positions", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :swap, method: :get, name: :fetch_positions, param_mappings: %{}, params: [ :symbols ], path: "/positions/margined", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, default_params: %{ "states" => "expired" }, market_type: :swap, method: :get, name: :fetch_settlement_history, param_mappings: %{}, params: [], path: "/products", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_status, param_mappings: %{}, params: [], path: "/settings", response_transformer: {:extract_path, ["result", "under_maintenance"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_ticker, param_mappings: %{}, params: [ :symbol ], path: "/tickers/{symbol}", response_transformer: {:extract_path_unwrap, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_tickers, param_mappings: %{}, params: [ :symbols ], path: "/tickers", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_time, param_mappings: %{}, params: [], path: "/settings", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "public", auth: false, cost: 1, market_type: :spot, method: :get, name: :fetch_trades, param_mappings: %{}, params: [ :symbol, :since, :limit ], path: "/trades/{symbol}", response_transformer: {:extract_path, ["result"]}, source: :intercepted }, %{ api_section: "private", auth: true, cost: 1, market_type: :swap, method: :post, name: :set_leverage, param_mappings: %{}, params: [ :leverage, :symbol ], path: "/products/{product_id}/orders/leverage", response_transformer: {:extract_path, ["result"]}, source: :intercepted } ], error_code_details: %{ "bad_schema" => %{ description: "{\"error\":{\"code\":\"bad_schema\",\"context\":{\"schema_errors\":[{\"code\":\"validation_error\",\"message\":\"id is required\",\"param\":\"\"}]}},\"success\":false}", type: :invalid_parameters }, "immediate_execution_post_only" => %{ description: "orders couldn't be placed as it includes post only orders which will be immediately executed", type: :invalid_order }, "immediate_liquidation" => %{ description: "Order will cause immediate liquidation.", type: :invalid_order }, "insufficient_margin" => %{ description: "{\"error\":{\"code\":\"insufficient_margin\",\"context\":{\"available_balance\":\"0.000000000000000000\",\"required_additional_balance\":\"1.618626000000000000000000000\"}},\"success\":false}", type: :insufficient_balance }, "invalid_api_key" => %{ description: "{\"success\":false,\"error\":{\"code\":\"invalid_api_key\"}}", type: :invalid_credentials }, "invalid_contract" => %{ description: "The contract/product is either doesn't exist or has already expired.", type: :invalid_order }, "invalid_signature" => %{ description: "{\"success\":false,\"error\":{\"code\":\"invalid_signature\"}}", type: :invalid_credentials }, "open_order_not_found" => %{ description: "{\"error\":{\"code\":\"open_order_not_found\"},\"success\":false}", type: :order_not_found }, "order_size_exceed_available" => %{ description: "The order book doesn't have sufficient liquidity, hence the order couldnt be filled, for example, ioc orders", type: :invalid_order }, "out_of_bankruptcy" => %{ description: "Order prices are out of position bankruptcy limits.", type: :invalid_order }, "risk_limits_breached" => %{ description: "orders couldn't be placed as it will breach allowed risk limits.", type: :invalid_parameters }, "self_matching_disrupted_post_only" => %{ description: "Self matching is not allowed during auction.", type: :invalid_order }, "unavailable" => %{ description: "{\"error\":{\"code\":\"unavailable\"},\"success\":false}", type: :network_error } }, error_codes: %{ "bad_schema" => :invalid_parameters, "immediate_execution_post_only" => :invalid_order, "immediate_liquidation" => :invalid_order, "insufficient_margin" => :insufficient_balance, "invalid_api_key" => :invalid_credentials, "invalid_contract" => :invalid_order, "invalid_signature" => :invalid_credentials, "open_order_not_found" => :order_not_found, "order_size_exceed_available" => :invalid_order, "out_of_bankruptcy" => :invalid_order, "risk_limits_breached" => :invalid_parameters, "self_matching_disrupted_post_only" => :invalid_order, "unavailable" => :network_error }, exceptions: %{ exact: %{ "bad_schema" => :bad_request, "immediate_execution_post_only" => :invalid_order, "immediate_liquidation" => :invalid_order, "insufficient_margin" => :insufficient_funds, "invalid_api_key" => :authentication_error, "invalid_contract" => :bad_symbol, "invalid_signature" => :authentication_error, "open_order_not_found" => :order_not_found, "order_size_exceed_available" => :invalid_order, "out_of_bankruptcy" => :invalid_order, "risk_limits_breached" => :bad_request, "self_matching_disrupted_post_only" => :invalid_order, "unavailable" => :exchange_not_available } }, exchange_options: %{ "defaultNetworkCodeReplacements" => %{ "BRC20" => %{ "BRC20" => "BTC" }, "CRO" => %{ "CRC20" => "CRONOS" }, "ETH" => %{ "ERC20" => "ETH" }, "TRX" => %{ "TRC20" => "TRX" } }, "networks" => %{ "BEP20" => "BEP20(BSC)", "TRC20" => "TRC20(TRON)" }, "networksById" => %{ "BEP20(BSC)" => "BEP20", "TRC20(TRON)" => "TRC20" } }, extended_metadata: %{ fees_url: "https://www.delta.exchange/fees", limits: %{ "amount" => %{}, "cost" => %{}, "leverage" => %{}, "price" => %{} }, logo_url: "https://user-images.githubusercontent.com/1294454/99450025-3be60a00-2931-11eb-9302-f4fd8d8589aa.jpg", referral_url: "https://www.delta.exchange/app/signup/?code=IULYNB" }, extracted_metadata: %{ ccxt_version: "4.5.34" }, features: %{ default: %{ create_order: %{ attached_stop_loss_take_profit: %{ price: true }, hedged: false, iceberg: false, leverage: false, margin_mode: false, market_buy_by_cost: false, 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: true, last: true, mark: true } }, fetch_closed_orders: %{ days_back: 100000, days_back_canceled: 1, limit: 500, margin_mode: false, symbol_required: false, trailing: false, trigger: false, until_days: 100000 }, fetch_my_trades: %{ days_back: 100000, limit: 100, margin_mode: false, symbol_required: false, until_days: 100000 }, fetch_ohlcv: %{ limit: 2000 }, fetch_open_orders: %{ limit: 100, margin_mode: false, symbol_required: false, trailing: false, trigger: false }, sandbox: true }, future: %{ inverse: %{ extends: "default" }, linear: %{ extends: "default" } }, spot: %{ extends: "default" }, swap: %{ inverse: %{ extends: "default" }, linear: %{ extends: "default" } } }, fees: %{ trading: %{ maker: 0.001, percentage: true, taker: 0.0015, tier_based: true, tiers: %{ maker: [ %{ fee: 0.001, volume: 0 }, %{ fee: 0.001, volume: 100 }, %{ fee: 0.0009, volume: 250 }, %{ fee: 7.5e-4, volume: 1000 }, %{ fee: 0.0006, volume: 5000 }, %{ fee: 0.0005, volume: 10000 }, %{ fee: 0.0005, volume: 20000 } ], taker: [ %{ fee: 0.0015, volume: 0 }, %{ fee: 0.0013, volume: 100 }, %{ fee: 0.0013, volume: 250 }, %{ fee: 0.001, volume: 1000 }, %{ fee: 0.0009, volume: 5000 }, %{ fee: 7.5e-4, volume: 10000 }, %{ fee: 6.5e-4, volume: 20000 } ] } } }, handle_content_type_application_zip: nil, handle_errors_source: "handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (response === undefined) {\n return undefined;\n }\n //\n // {\"error\":{\"code\":\"insufficient_margin\",\"context\":{\"available_balance\":\"0.000000000000000000\",\"required_additional_balance\":\"1.618626000000000000000000000\"}},\"success\":false}\n //\n const error = this.safeDict(response, 'error', {});\n const errorCode = this.safeString(error, 'code');\n if (errorCode !== undefined) {\n const feedback = this.id + ' ' + body;\n this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);\n this.throwBroadlyMatchedException(this.exceptions['broad'], errorCode, feedback);\n throw new errors.ExchangeError(feedback); // unknown message\n }\n return undefined;\n }", has: %{ add_margin: true, borrow_cross_margin: false, borrow_isolated_margin: false, borrow_margin: false, c_o_r_s: false, cancel_all_orders: true, cancel_all_orders_ws: false, cancel_order: true, cancel_order_with_client_order_id: false, cancel_order_ws: false, cancel_orders: false, cancel_orders_with_client_order_id: false, cancel_orders_ws: false, close_all_positions: true, close_position: false, create_deposit_address: false, create_limit_buy_order: false, create_limit_buy_order_ws: false, create_limit_order: true, create_limit_order_ws: false, create_limit_sell_order: false, create_limit_sell_order_ws: false, create_market_buy_order: false, create_market_buy_order_with_cost: false, create_market_buy_order_with_cost_ws: false, create_market_buy_order_ws: false, create_market_order: true, create_market_order_with_cost: false, create_market_order_with_cost_ws: false, create_market_order_ws: true, create_market_sell_order: false, create_market_sell_order_with_cost: false, create_market_sell_order_with_cost_ws: false, create_market_sell_order_ws: false, create_order: true, create_order_with_take_profit_and_stop_loss: false, create_order_with_take_profit_and_stop_loss_ws: false, create_order_ws: false, create_orders: false, create_post_only_order: false, create_post_only_order_ws: false, create_reduce_only_order: true, create_reduce_only_order_ws: false, create_stop_limit_order: false, create_stop_limit_order_ws: false, create_stop_loss_order: false, create_stop_loss_order_ws: false, create_stop_market_order: false, create_stop_market_order_ws: false, create_stop_order: false, create_stop_order_ws: false, create_take_profit_order: false, create_take_profit_order_ws: false, create_trailing_amount_order: false, create_trailing_amount_order_ws: false, create_trailing_percent_order: false, create_trailing_percent_order_ws: false, create_trigger_order: false, create_trigger_order_ws: false, deposit: false, edit_order: true, edit_order_with_client_order_id: false, edit_order_ws: false, edit_orders: false, fetch_accounts: false, fetch_balance: true, fetch_balance_ws: false, fetch_bids_asks: false, fetch_borrow_interest: 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: false, fetch_canceled_orders: false, fetch_closed_order: false, fetch_closed_orders: true, fetch_closed_orders_ws: false, fetch_convert_currencies: false, fetch_convert_quote: false, fetch_convert_trade: false, fetch_convert_trade_history: false, fetch_cross_borrow_rate: false, fetch_cross_borrow_rates: false, fetch_currencies: true, fetch_currencies_ws: true, fetch_deposit: false, fetch_deposit_address: true, fetch_deposit_addresses: false, fetch_deposit_addresses_by_network: false, fetch_deposit_withdraw_fee: false, fetch_deposit_withdraw_fees: false, fetch_deposits: false, 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: false, fetch_funding_rates: true, fetch_greeks: true, fetch_index_ohlcv: true, 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: true, fetch_open_interest_history: false, fetch_open_interests: false, fetch_open_order: false, fetch_open_orders: true, fetch_open_orders_ws: false, fetch_option: true, fetch_option_chain: false, fetch_order: true, fetch_order_book: true, fetch_order_book_ws: false, fetch_order_books: false, fetch_order_trades: false, 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: false, fetch_position_ws: false, fetch_positions: true, fetch_positions_for_symbol: false, fetch_positions_for_symbol_ws: false, fetch_positions_history: false, fetch_positions_risk: false, fetch_positions_ws: false, fetch_premium_index_ohlcv: false, fetch_settlement_history: true, fetch_status: true, fetch_ticker: true, fetch_ticker_ws: false, fetch_tickers: true, fetch_tickers_ws: false, fetch_time: true, fetch_trades: true, fetch_trades_ws: false, fetch_trading_fee: 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: false, fetch_withdrawals_ws: false, future: false, margin: false, option: true, 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: false, set_position_mode: false, 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: false, 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: false, watch_ohlcv_for_symbols: false, watch_order_book: false, watch_order_book_for_symbols: false, watch_orders: false, watch_orders_for_symbols: false, watch_position: false, watch_positions: false, watch_status: false, watch_ticker: false, watch_tickers: false, watch_trades: false, watch_trades_for_symbols: false, withdraw: false, ws: false }, http_config: %{ user_agent: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36" }, id: "delta", markets: nil, name: "Delta Exchange", ohlcv_timestamp_resolution: :seconds, options: %{ networks: %{ "BEP20" => "BEP20(BSC)", "TRC20" => "TRC20(TRON)" } }, order_mappings: %{ side_format: :lowercase, side_key: "side", type_format: nil, type_key: "order_type" }, param_mappings: %{ "amount" => "size", "code" => "asset_symbol", "id" => "order_id", "limit" => "depth", "price" => "limit_price", "since" => "start", "timeframe" => "resolution" }, parse_methods: [ %{ "comment" => nil, "examples" => [], "line_end" => 1687, "line_start" => 1672, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "response" } ], "name" => "parseBalance", "signature" => "parseBalance (response): Balances", "source" => "parseBalance (response): Balances {\n const balances = this.safeList (response, 'result', []);\n const result: Dict = { 'info': response };\n const currenciesByNumericId = this.safeDict (this.options, 'currenciesByNumericId', {});\n for (let i = 0; i < balances.length; i++) {\n const balance = balances[i];\n const currencyId = this.safeString (balance, 'asset_id');\n const currency = this.safeDict (currenciesByNumericId, currencyId);\n const code = (currency === undefined) ? currencyId : currency['code'];\n const account = this.account ();\n account['total'] = this.safeString (balance, 'balance');\n account['free'] = this.safeString (balance, 'available_balance');\n result[code] = account;\n }\n return this.safeBalance (result);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"id\": 1915615,\n \"user_id\": 27854758,\n \"address\": \"TXYB4GdKsXKEWbeSNPsmGZu4ZVCkhVh1Zz\",\n \"memo\": \"\",\n \"status\": \"active\",\n \"updated_at\": \"2023-01-12T06:03:46.000Z\",\n \"created_at\": \"2023-01-12T06:03:46.000Z\",\n \"asset_symbol\": \"USDT\",\n \"network\": \"TRC20(TRON)\",\n \"custodian\": \"fireblocks\"\n }" ], "line_end" => 2640, "line_start" => 2614, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "depositAddress" }, %{ "comment" => nil, "key" => "currency", "value" => "this.safeCurrencyCode (marketId, currency)" }, %{ "comment" => nil, "key" => "network", "value" => "this.networkIdToCode (networkId)" }, %{ "comment" => nil, "key" => "address", "value" => "address" }, %{ "comment" => nil, "key" => "tag", "value" => "this.safeString (depositAddress, 'memo')" } ], "name" => "parseDepositAddress", "signature" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress", "source" => "parseDepositAddress (depositAddress, currency: Currency = undefined): DepositAddress {\n //\n // {\n // \"id\": 1915615,\n // \"user_id\": 27854758,\n // \"address\": \"TXYB4GdKsXKEWbeSNPsmGZu4ZVCkhVh1Zz\",\n // \"memo\": \"\",\n // \"status\": \"active\",\n // \"updated_at\": \"2023-01-12T06:03:46.000Z\",\n // \"created_at\": \"2023-01-12T06:03:46.000Z\",\n // \"asset_symbol\": \"USDT\",\n // \"network\": \"TRC20(TRON)\",\n // \"custodian\": \"fireblocks\"\n // }\n //\n const address = this.safeString (depositAddress, 'address');\n const marketId = this.safeString (depositAddress, 'asset_symbol');\n const networkId = this.safeString (depositAddress, 'network');\n this.checkAddress (address);\n return {\n 'info': depositAddress,\n 'currency': this.safeCurrencyCode (marketId, currency),\n 'network': this.networkIdToCode (networkId),\n 'address': address,\n 'tag': this.safeString (depositAddress, 'memo'),\n } as DepositAddress;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"close\": 30600.5,\n \"contract_type\": \"perpetual_futures\",\n \"funding_rate\": \"0.00602961\",\n \"greeks\": null,\n \"high\": 30803.0,\n \"low\": 30265.5,\n \"mark_basis\": \"-0.45601594\",\n \"mark_price\": \"30600.10481568\",\n \"oi\": \"469.9190\",\n \"oi_change_usd_6h\": \"2226314.9900\",\n \"oi_contracts\": \"469919\",\n \"oi_value\": \"469.9190\",\n \"oi_value_symbol\": \"BTC\",\n \"oi_value_usd\": \"14385640.6802\",\n \"open\": 30458.5,\n \"price_band\": {\n \"lower_limit\": \"29067.08312627\",\n \"upper_limit\": \"32126.77608693\"\n },\n \"product_id\": 139,\n \"quotes\": {\n \"ask_iv\": null,\n \"ask_size\": \"965\",\n \"best_ask\": \"30600.5\",\n \"best_bid\": \"30599.5\",\n \"bid_iv\": null,\n \"bid_size\": \"196\",\n \"impact_mid_price\": null,\n \"mark_iv\": \"-0.44931641\"\n },\n \"size\": 1226303,\n \"spot_price\": \"30612.85362773\",\n \"symbol\": \"BTCUSDT\",\n \"timestamp\": 1689136597460456,\n \"turnover\": 37392218.45999999,\n \"turnover_symbol\": \"USDT\",\n \"turnover_usd\": 37392218.45999999,\n \"volume\": 1226.3029999999485\n }" ], "line_end" => 2844, "line_start" => 2777, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "contract" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (contract, 'mark_price')" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeNumber (contract, 'spot_price')" }, %{ "comment" => nil, "key" => "interestRate", "value" => "undefined" }, %{ "comment" => nil, "key" => "estimatedSettlePrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "fundingRate", "value" => "this.parseNumber (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" }, %{ "comment" => nil, "key" => "interval", "value" => "undefined" } ], "name" => "parseFundingRate", "signature" => "parseFundingRate (contract, market: Market = undefined): FundingRate", "source" => "parseFundingRate (contract, market: Market = undefined): FundingRate {\n //\n // {\n // \"close\": 30600.5,\n // \"contract_type\": \"perpetual_futures\",\n // \"funding_rate\": \"0.00602961\",\n // \"greeks\": null,\n // \"high\": 30803.0,\n // \"low\": 30265.5,\n // \"mark_basis\": \"-0.45601594\",\n // \"mark_price\": \"30600.10481568\",\n // \"oi\": \"469.9190\",\n // \"oi_change_usd_6h\": \"2226314.9900\",\n // \"oi_contracts\": \"469919\",\n // \"oi_value\": \"469.9190\",\n // \"oi_value_symbol\": \"BTC\",\n // \"oi_value_usd\": \"14385640.6802\",\n // \"open\": 30458.5,\n // \"price_band\": {\n // \"lower_limit\": \"29067.08312627\",\n // \"upper_limit\": \"32126.77608693\"\n // },\n // \"product_id\": 139,\n // \"quotes\": {\n // \"ask_iv\": null,\n // \"ask_size\": \"965\",\n // \"best_ask\": \"30600.5\",\n // \"best_bid\": \"30599.5\",\n // \"bid_iv\": null,\n // \"bid_size\": \"196\",\n // \"impact_mid_price\": null,\n // \"mark_iv\": \"-0.44931641\"\n // },\n // \"size\": 1226303,\n // \"spot_price\": \"30612.85362773\",\n // \"symbol\": \"BTCUSDT\",\n // \"timestamp\": 1689136597460456,\n // \"turnover\": 37392218.45999999,\n // \"turnover_symbol\": \"USDT\",\n // \"turnover_usd\": 37392218.45999999,\n // \"volume\": 1226.3029999999485\n // }\n //\n const timestamp = this.safeIntegerProduct (contract, 'timestamp', 0.001);\n const marketId = this.safeString (contract, 'symbol');\n const fundingRateString = this.safeString (contract, 'funding_rate');\n const fundingRate = Precise.stringDiv (fundingRateString, '100');\n return {\n 'info': contract,\n 'symbol': this.safeSymbol (marketId, market),\n 'markPrice': this.safeNumber (contract, 'mark_price'),\n 'indexPrice': this.safeNumber (contract, 'spot_price'),\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'fundingRate': this.parseNumber (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 'interval': undefined,\n } as FundingRate;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"close\": 6793.0,\n \"contract_type\": \"call_options\",\n \"greeks\": {\n \"delta\": \"0.94739174\",\n \"gamma\": \"0.00002206\",\n \"rho\": \"11.00890725\",\n \"spot\": \"36839.58124652\",\n \"theta\": \"-18.18365310\",\n \"vega\": \"7.85209698\"\n },\n \"high\": 7556.0,\n \"low\": 6793.0,\n \"mark_price\": \"6955.70698909\",\n \"mark_vol\": \"0.66916863\",\n \"oi\": \"1.8980\",\n \"oi_change_usd_6h\": \"110.4600\",\n \"oi_contracts\": \"1898\",\n \"oi_value\": \"1.8980\",\n \"oi_value_symbol\": \"BTC\",\n \"oi_value_usd\": \"69940.7319\",\n \"open\": 7.2e3,\n \"price_band\": {\n \"lower_limit\": \"5533.89814767\",\n \"upper_limit\": \"11691.37688371\"\n },\n \"product_id\": 129508,\n \"quotes\": {\n \"ask_iv\": \"0.90180438\",\n \"ask_size\": \"1898\",\n \"best_ask\": \"7210\",\n \"best_bid\": \"6913\",\n \"bid_iv\": \"0.60881706\",\n \"bid_size\": \"3163\",\n \"impact_mid_price\": null,\n \"mark_iv\": \"0.66973549\"\n },\n \"size\": 5,\n \"spot_price\": \"36839.58153868\",\n \"strike_price\": \"30000\",\n \"symbol\": \"C-BTC-30000-241123\",\n \"timestamp\": 1699584998504530,\n \"turnover\": 184.41206804,\n \"turnover_symbol\": \"USDT\",\n \"turnover_usd\": 184.41206804,\n \"volume\": 0.005\n }" ], "line_end" => 3477, "line_start" => 3401, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "delta", "value" => "this.safeNumber (stats, 'delta')" }, %{ "comment" => nil, "key" => "gamma", "value" => "this.safeNumber (stats, 'gamma')" }, %{ "comment" => nil, "key" => "theta", "value" => "this.safeNumber (stats, 'theta')" }, %{ "comment" => nil, "key" => "vega", "value" => "this.safeNumber (stats, 'vega')" }, %{ "comment" => nil, "key" => "rho", "value" => "this.safeNumber (stats, 'rho')" }, %{ "comment" => nil, "key" => "bidSize", "value" => "this.safeNumber (quotes, 'bid_size')" }, %{ "comment" => nil, "key" => "askSize", "value" => "this.safeNumber (quotes, 'ask_size')" }, %{ "comment" => nil, "key" => "bidImpliedVolatility", "value" => "this.safeNumber (quotes, 'bid_iv')" }, %{ "comment" => nil, "key" => "askImpliedVolatility", "value" => "this.safeNumber (quotes, 'ask_iv')" }, %{ "comment" => nil, "key" => "markImpliedVolatility", "value" => "this.safeNumber (quotes, 'mark_iv')" }, %{ "comment" => nil, "key" => "bidPrice", "value" => "this.safeNumber (quotes, 'best_bid')" }, %{ "comment" => nil, "key" => "askPrice", "value" => "this.safeNumber (quotes, 'best_ask')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (greeks, 'mark_price')" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "underlyingPrice", "value" => "this.safeNumber (greeks, 'spot_price')" }, %{ "comment" => nil, "key" => "info", "value" => "greeks" } ], "name" => "parseGreeks", "signature" => "parseGreeks (greeks: Dict, market: Market = undefined): Greeks", "source" => "parseGreeks (greeks: Dict, market: Market = undefined): Greeks {\n //\n // {\n // \"close\": 6793.0,\n // \"contract_type\": \"call_options\",\n // \"greeks\": {\n // \"delta\": \"0.94739174\",\n // \"gamma\": \"0.00002206\",\n // \"rho\": \"11.00890725\",\n // \"spot\": \"36839.58124652\",\n // \"theta\": \"-18.18365310\",\n // \"vega\": \"7.85209698\"\n // },\n // \"high\": 7556.0,\n // \"low\": 6793.0,\n // \"mark_price\": \"6955.70698909\",\n // \"mark_vol\": \"0.66916863\",\n // \"oi\": \"1.8980\",\n // \"oi_change_usd_6h\": \"110.4600\",\n // \"oi_contracts\": \"1898\",\n // \"oi_value\": \"1.8980\",\n // \"oi_value_symbol\": \"BTC\",\n // \"oi_value_usd\": \"69940.7319\",\n // \"open\": 7.2e3,\n // \"price_band\": {\n // \"lower_limit\": \"5533.89814767\",\n // \"upper_limit\": \"11691.37688371\"\n // },\n // \"product_id\": 129508,\n // \"quotes\": {\n // \"ask_iv\": \"0.90180438\",\n // \"ask_size\": \"1898\",\n // \"best_ask\": \"7210\",\n // \"best_bid\": \"6913\",\n // \"bid_iv\": \"0.60881706\",\n // \"bid_size\": \"3163\",\n // \"impact_mid_price\": null,\n // \"mark_iv\": \"0.66973549\"\n // },\n // \"size\": 5,\n // \"spot_price\": \"36839.58153868\",\n // \"strike_price\": \"30000\",\n // \"symbol\": \"C-BTC-30000-241123\",\n // \"timestamp\": 1699584998504530,\n // \"turnover\": 184.41206804,\n // \"turnover_symbol\": \"USDT\",\n // \"turnover_usd\": 184.41206804,\n // \"volume\": 0.005\n // }\n //\n const timestamp = this.safeIntegerProduct (greeks, 'timestamp', 0.001);\n const marketId = this.safeString (greeks, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n const stats = this.safeDict (greeks, 'greeks', {});\n const quotes = this.safeDict (greeks, 'quotes', {});\n return {\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'delta': this.safeNumber (stats, 'delta'),\n 'gamma': this.safeNumber (stats, 'gamma'),\n 'theta': this.safeNumber (stats, 'theta'),\n 'vega': this.safeNumber (stats, 'vega'),\n 'rho': this.safeNumber (stats, 'rho'),\n 'bidSize': this.safeNumber (quotes, 'bid_size'),\n 'askSize': this.safeNumber (quotes, 'ask_size'),\n 'bidImpliedVolatility': this.safeNumber (quotes, 'bid_iv'),\n 'askImpliedVolatility': this.safeNumber (quotes, 'ask_iv'),\n 'markImpliedVolatility': this.safeNumber (quotes, 'mark_iv'),\n 'bidPrice': this.safeNumber (quotes, 'best_bid'),\n 'askPrice': this.safeNumber (quotes, 'best_ask'),\n 'markPrice': this.safeNumber (greeks, 'mark_price'),\n 'lastPrice': undefined,\n 'underlyingPrice': this.safeNumber (greeks, 'spot_price'),\n 'info': greeks,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"amount\":\"29.889184\",\n \"asset_id\":5,\n \"balance\":\"29.889184\",\n \"created_at\":\"2020-11-15T21:25:01Z\",\n \"meta_data\":{\n \"deposit_id\":3884,\n \"transaction_id\":\"0x41a60174849828530abb5008e98fc63c9b598288743ec4ba9620bcce900a3b8d\"\n },\n \"transaction_type\":\"deposit\",\n \"user_id\":22142,\n \"uuid\":\"70bb5679da3c4637884e2dc63efaa846\"\n }" ], "line_end" => 2570, "line_start" => 2515, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "item" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "direction", "value" => "direction" }, %{ "comment" => nil, "key" => "account", "value" => "account" }, %{ "comment" => nil, "key" => "referenceId", "value" => "referenceId" }, %{ "comment" => nil, "key" => "referenceAccount", "value" => "referenceAccount" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "currency", "value" => "code" }, %{ "comment" => nil, "key" => "amount", "value" => "this.parseNumber (amount)" }, %{ "comment" => nil, "key" => "before", "value" => "this.parseNumber (before)" }, %{ "comment" => nil, "key" => "after", "value" => "this.parseNumber (after)" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "fee", "value" => "undefined" } ], "name" => "parseLedgerEntry", "signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry", "source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // {\n // \"amount\":\"29.889184\",\n // \"asset_id\":5,\n // \"balance\":\"29.889184\",\n // \"created_at\":\"2020-11-15T21:25:01Z\",\n // \"meta_data\":{\n // \"deposit_id\":3884,\n // \"transaction_id\":\"0x41a60174849828530abb5008e98fc63c9b598288743ec4ba9620bcce900a3b8d\"\n // },\n // \"transaction_type\":\"deposit\",\n // \"user_id\":22142,\n // \"uuid\":\"70bb5679da3c4637884e2dc63efaa846\"\n // }\n //\n const id = this.safeString (item, 'uuid');\n let direction = undefined;\n const account = undefined;\n const metaData = this.safeDict (item, 'meta_data', {});\n const referenceId = this.safeString (metaData, 'transaction_id');\n const referenceAccount = undefined;\n let type = this.safeString (item, 'transaction_type');\n if ((type === 'deposit') || (type === 'commission_rebate') || (type === 'referral_bonus') || (type === 'pnl') || (type === 'withdrawal_cancellation') || (type === 'promo_credit')) {\n direction = 'in';\n } else if ((type === 'withdrawal') || (type === 'commission') || (type === 'conversion') || (type === 'perpetual_futures_funding')) {\n direction = 'out';\n }\n type = this.parseLedgerEntryType (type);\n const currencyId = this.safeString (item, 'asset_id');\n const currenciesByNumericId = this.safeDict (this.options, 'currenciesByNumericId');\n currency = this.safeValue (currenciesByNumericId, currencyId, currency);\n const code = (currency === undefined) ? undefined : currency['code'];\n const amount = this.safeString (item, 'amount');\n const timestamp = this.parse8601 (this.safeString (item, 'created_at'));\n const after = this.safeString (item, 'balance');\n const before = Precise.stringMax ('0', Precise.stringSub (after, amount));\n const status = 'ok';\n return this.safeLedgerEntry ({\n 'info': item,\n 'id': id,\n 'direction': direction,\n 'account': account,\n 'referenceId': referenceId,\n 'referenceAccount': referenceAccount,\n 'type': type,\n 'currency': code,\n 'amount': this.parseNumber (amount),\n 'before': this.parseNumber (before),\n 'after': this.parseNumber (after),\n 'status': status,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'fee': undefined,\n }, currency) as LedgerEntry;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 2513, "line_start" => 2499, "mappings" => [], "name" => "parseLedgerEntryType", "signature" => "parseLedgerEntryType (type)", "source" => "parseLedgerEntryType (type) {\n const types: Dict = {\n 'pnl': 'pnl',\n 'deposit': 'transaction',\n 'withdrawal': 'transaction',\n 'commission': 'fee',\n 'conversion': 'trade',\n // 'perpetual_futures_funding': 'perpetual_futures_funding',\n // 'withdrawal_cancellation': 'withdrawal_cancellation',\n 'referral_bonus': 'referral',\n 'commission_rebate': 'rebate',\n // 'promo_credit': 'promo_credit',\n };\n return this.safeString (types, type, type);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3132, "line_start" => 3122, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "leverage" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "marginMode", "value" => "this.safeStringLower (leverage, 'margin_mode')" }, %{ "comment" => nil, "key" => "longLeverage", "value" => "leverageValue" }, %{ "comment" => nil, "key" => "shortLeverage", "value" => "leverageValue" } ], "name" => "parseLeverage", "signature" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage", "source" => "parseLeverage (leverage: Dict, market: Market = undefined): Leverage {\n const marketId = this.safeString (leverage, 'index_symbol');\n const leverageValue = this.safeInteger (leverage, 'leverage');\n return {\n 'info': leverage,\n 'symbol': this.safeSymbol (marketId, market),\n 'marginMode': this.safeStringLower (leverage, 'margin_mode'),\n 'longLeverage': leverageValue,\n 'shortLeverage': leverageValue,\n } as Leverage;\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3596, "line_start" => 3586, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "marginMode" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "marginMode", "value" => "this.safeString (marginMode, 'margin_mode')" } ], "name" => "parseMarginMode", "signature" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode", "source" => "parseMarginMode (marginMode: Dict, market = undefined): MarginMode {\n let symbol = undefined;\n if (market !== undefined) {\n symbol = market['symbol'];\n }\n return {\n 'info': marginMode,\n 'symbol': symbol,\n 'marginMode': this.safeString (marginMode, 'margin_mode'),\n } as MarginMode;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"auto_topup\": false,\n \"bankruptcy_price\": \"24934.12\",\n \"commission\": \"0.01197072\",\n \"created_at\": \"2023-07-20T03:49:09.159401Z\",\n \"entry_price\": \"29926.8\",\n \"liquidation_price\": \"25083.754\",\n \"margin\": \"4.99268\",\n \"margin_mode\": \"isolated\",\n \"product_id\": 84,\n \"product_symbol\": \"BTCUSDT\",\n \"realized_cashflow\": \"0\",\n \"realized_funding\": \"0\",\n \"realized_pnl\": \"0\",\n \"size\": 1,\n \"updated_at\": \"2023-07-20T03:49:09.159401Z\",\n \"user_id\": 30084879\n }" ], "line_end" => 2948, "line_start" => 2913, "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" => "'isolated'" }, %{ "comment" => nil, "key" => "amount", "value" => "undefined" }, %{ "comment" => nil, "key" => "total", "value" => "this.safeNumber (data, 'margin')" }, %{ "comment" => nil, "key" => "code", "value" => "undefined" }, %{ "comment" => nil, "key" => "status", "value" => "undefined" }, %{ "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 // \"auto_topup\": false,\n // \"bankruptcy_price\": \"24934.12\",\n // \"commission\": \"0.01197072\",\n // \"created_at\": \"2023-07-20T03:49:09.159401Z\",\n // \"entry_price\": \"29926.8\",\n // \"liquidation_price\": \"25083.754\",\n // \"margin\": \"4.99268\",\n // \"margin_mode\": \"isolated\",\n // \"product_id\": 84,\n // \"product_symbol\": \"BTCUSDT\",\n // \"realized_cashflow\": \"0\",\n // \"realized_funding\": \"0\",\n // \"realized_pnl\": \"0\",\n // \"size\": 1,\n // \"updated_at\": \"2023-07-20T03:49:09.159401Z\",\n // \"user_id\": 30084879\n // }\n //\n const marketId = this.safeString (data, 'product_symbol');\n market = this.safeMarket (marketId, market);\n return {\n 'info': data,\n 'symbol': market['symbol'],\n 'type': undefined,\n 'marginMode': 'isolated',\n 'amount': undefined,\n 'total': this.safeNumber (data, 'margin'),\n 'code': undefined,\n 'status': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"time\":1605393120,\n \"open\":15989,\n \"high\":15989,\n \"low\":15987.5,\n \"close\":15987.5,\n \"volume\":565\n }" ], "line_end" => 1611, "line_start" => 1592, "mappings" => [], "name" => "parseOHLCV", "signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV", "source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n //\n // {\n // \"time\":1605393120,\n // \"open\":15989,\n // \"high\":15989,\n // \"low\":15987.5,\n // \"close\":15987.5,\n // \"volume\":565\n // }\n //\n return [\n this.safeTimestamp (ohlcv, 'time'),\n this.safeNumber (ohlcv, 'open'),\n this.safeNumber (ohlcv, 'high'),\n this.safeNumber (ohlcv, 'low'),\n this.safeNumber (ohlcv, 'close'),\n this.safeNumber (ohlcv, 'volume'),\n ];\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"close\": 894.0,\n \"contract_type\": \"call_options\",\n \"greeks\": {\n \"delta\": \"0.67324861\",\n \"gamma\": \"0.00022178\",\n \"rho\": \"4.34638266\",\n \"spot\": \"30178.53195697\",\n \"theta\": \"-35.64972577\",\n \"vega\": \"16.34381277\"\n },\n \"high\": 946.0,\n \"low\": 893.0,\n \"mark_price\": \"1037.07582681\",\n \"mark_vol\": \"0.35899491\",\n \"oi\": \"0.0910\",\n \"oi_change_usd_6h\": \"-90.5500\",\n \"oi_contracts\": \"91\",\n \"oi_value\": \"0.0910\",\n \"oi_value_symbol\": \"BTC\",\n \"oi_value_usd\": \"2746.3549\",\n \"open\": 946.0,\n \"price_band\": {\n \"lower_limit\": \"133.37794509\",\n \"upper_limit\": \"5663.66930164\"\n },\n \"product_id\": 116171,\n \"quotes\": {\n \"ask_iv\": \"0.36932389\",\n \"ask_size\": \"1321\",\n \"best_ask\": \"1054\",\n \"best_bid\": \"1020\",\n \"bid_iv\": \"0.34851914\",\n \"bid_size\": \"2202\",\n \"impact_mid_price\": null,\n \"mark_iv\": \"0.35896335\"\n },\n \"size\": 152,\n \"spot_price\": \"30178.53195697\",\n \"strike_price\": \"29500\",\n \"symbol\": \"C-BTC-29500-280723\",\n \"timestamp\": 1689834695286094,\n \"turnover\": 4546.601744940001,\n \"turnover_symbol\": \"USDT\",\n \"turnover_usd\": 4546.601744940001,\n \"volume\": 0.15200000000000002\n }" ], "line_end" => 3087, "line_start" => 3025, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "this.safeNumber (interest, 'oi_value')" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "this.safeNumber (interest, 'oi_value_usd')" }, %{ "comment" => nil, "key" => "openInterestAmount", "value" => "this.safeNumber (interest, 'oi_contracts')" }, %{ "comment" => nil, "key" => "openInterestValue", "value" => "this.safeNumber (interest, 'oi')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "info", "value" => "interest" } ], "name" => "parseOpenInterest", "signature" => "parseOpenInterest (interest, market: Market = undefined)", "source" => "parseOpenInterest (interest, market: Market = undefined) {\n //\n // {\n // \"close\": 894.0,\n // \"contract_type\": \"call_options\",\n // \"greeks\": {\n // \"delta\": \"0.67324861\",\n // \"gamma\": \"0.00022178\",\n // \"rho\": \"4.34638266\",\n // \"spot\": \"30178.53195697\",\n // \"theta\": \"-35.64972577\",\n // \"vega\": \"16.34381277\"\n // },\n // \"high\": 946.0,\n // \"low\": 893.0,\n // \"mark_price\": \"1037.07582681\",\n // \"mark_vol\": \"0.35899491\",\n // \"oi\": \"0.0910\",\n // \"oi_change_usd_6h\": \"-90.5500\",\n // \"oi_contracts\": \"91\",\n // \"oi_value\": \"0.0910\",\n // \"oi_value_symbol\": \"BTC\",\n // \"oi_value_usd\": \"2746.3549\",\n // \"open\": 946.0,\n // \"price_band\": {\n // \"lower_limit\": \"133.37794509\",\n // \"upper_limit\": \"5663.66930164\"\n // },\n // \"product_id\": 116171,\n // \"quotes\": {\n // \"ask_iv\": \"0.36932389\",\n // \"ask_size\": \"1321\",\n // \"best_ask\": \"1054\",\n // \"best_bid\": \"1020\",\n // \"bid_iv\": \"0.34851914\",\n // \"bid_size\": \"2202\",\n // \"impact_mid_price\": null,\n // \"mark_iv\": \"0.35896335\"\n // },\n // \"size\": 152,\n // \"spot_price\": \"30178.53195697\",\n // \"strike_price\": \"29500\",\n // \"symbol\": \"C-BTC-29500-280723\",\n // \"timestamp\": 1689834695286094,\n // \"turnover\": 4546.601744940001,\n // \"turnover_symbol\": \"USDT\",\n // \"turnover_usd\": 4546.601744940001,\n // \"volume\": 0.15200000000000002\n // }\n //\n const timestamp = this.safeIntegerProduct (interest, 'timestamp', 0.001);\n const marketId = this.safeString (interest, 'symbol');\n return this.safeOpenInterest ({\n 'symbol': this.safeSymbol (marketId, market),\n 'baseVolume': this.safeNumber (interest, 'oi_value'),\n 'quoteVolume': this.safeNumber (interest, 'oi_value_usd'),\n 'openInterestAmount': this.safeNumber (interest, 'oi_contracts'),\n 'openInterestValue': this.safeNumber (interest, 'oi'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'info': interest,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"close\": 6793.0,\n \"contract_type\": \"call_options\",\n \"greeks\": {\n \"delta\": \"0.94739174\",\n \"gamma\": \"0.00002206\",\n \"rho\": \"11.00890725\",\n \"spot\": \"36839.58124652\",\n \"theta\": \"-18.18365310\",\n \"vega\": \"7.85209698\"\n },\n \"high\": 7556.0,\n \"low\": 6793.0,\n \"mark_price\": \"6955.70698909\",\n \"mark_vol\": \"0.66916863\",\n \"oi\": \"1.8980\",\n \"oi_change_usd_6h\": \"110.4600\",\n \"oi_contracts\": \"1898\",\n \"oi_value\": \"1.8980\",\n \"oi_value_symbol\": \"BTC\",\n \"oi_value_usd\": \"69940.7319\",\n \"open\": 7.2e3,\n \"price_band\": {\n \"lower_limit\": \"5533.89814767\",\n \"upper_limit\": \"11691.37688371\"\n },\n \"product_id\": 129508,\n \"quotes\": {\n \"ask_iv\": \"0.90180438\",\n \"ask_size\": \"1898\",\n \"best_ask\": \"7210\",\n \"best_bid\": \"6913\",\n \"bid_iv\": \"0.60881706\",\n \"bid_size\": \"3163\",\n \"impact_mid_price\": null,\n \"mark_iv\": \"0.66973549\"\n },\n \"size\": 5,\n \"spot_price\": \"36839.58153868\",\n \"strike_price\": \"30000\",\n \"symbol\": \"C-BTC-30000-241123\",\n \"timestamp\": 1699584998504530,\n \"turnover\": 184.41206804,\n \"turnover_symbol\": \"USDT\",\n \"turnover_usd\": 184.41206804,\n \"volume\": 0.005\n }" ], "line_end" => 3743, "line_start" => 3670, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "chain" }, %{ "comment" => nil, "key" => "currency", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "market['symbol']" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "impliedVolatility", "value" => "this.safeNumber (quotes, 'mark_iv')" }, %{ "comment" => nil, "key" => "openInterest", "value" => "this.safeNumber (chain, 'oi')" }, %{ "comment" => nil, "key" => "bidPrice", "value" => "this.safeNumber (quotes, 'best_bid')" }, %{ "comment" => nil, "key" => "askPrice", "value" => "this.safeNumber (quotes, 'best_ask')" }, %{ "comment" => nil, "key" => "midPrice", "value" => "this.safeNumber (quotes, 'impact_mid_price')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (chain, 'mark_price')" }, %{ "comment" => nil, "key" => "lastPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "underlyingPrice", "value" => "this.safeNumber (chain, 'spot_price')" }, %{ "comment" => nil, "key" => "change", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "this.safeNumber (chain, 'volume')" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "undefined" } ], "name" => "parseOption", "signature" => "parseOption (chain: Dict, currency: Currency = undefined, market: Market = undefined): Option", "source" => "parseOption (chain: Dict, currency: Currency = undefined, market: Market = undefined): Option {\n //\n // {\n // \"close\": 6793.0,\n // \"contract_type\": \"call_options\",\n // \"greeks\": {\n // \"delta\": \"0.94739174\",\n // \"gamma\": \"0.00002206\",\n // \"rho\": \"11.00890725\",\n // \"spot\": \"36839.58124652\",\n // \"theta\": \"-18.18365310\",\n // \"vega\": \"7.85209698\"\n // },\n // \"high\": 7556.0,\n // \"low\": 6793.0,\n // \"mark_price\": \"6955.70698909\",\n // \"mark_vol\": \"0.66916863\",\n // \"oi\": \"1.8980\",\n // \"oi_change_usd_6h\": \"110.4600\",\n // \"oi_contracts\": \"1898\",\n // \"oi_value\": \"1.8980\",\n // \"oi_value_symbol\": \"BTC\",\n // \"oi_value_usd\": \"69940.7319\",\n // \"open\": 7.2e3,\n // \"price_band\": {\n // \"lower_limit\": \"5533.89814767\",\n // \"upper_limit\": \"11691.37688371\"\n // },\n // \"product_id\": 129508,\n // \"quotes\": {\n // \"ask_iv\": \"0.90180438\",\n // \"ask_size\": \"1898\",\n // \"best_ask\": \"7210\",\n // \"best_bid\": \"6913\",\n // \"bid_iv\": \"0.60881706\",\n // \"bid_size\": \"3163\",\n // \"impact_mid_price\": null,\n // \"mark_iv\": \"0.66973549\"\n // },\n // \"size\": 5,\n // \"spot_price\": \"36839.58153868\",\n // \"strike_price\": \"30000\",\n // \"symbol\": \"C-BTC-30000-241123\",\n // \"timestamp\": 1699584998504530,\n // \"turnover\": 184.41206804,\n // \"turnover_symbol\": \"USDT\",\n // \"turnover_usd\": 184.41206804,\n // \"volume\": 0.005\n // }\n //\n const marketId = this.safeString (chain, 'symbol');\n market = this.safeMarket (marketId, market);\n const quotes = this.safeDict (chain, 'quotes', {});\n const timestamp = this.safeIntegerProduct (chain, 'timestamp', 0.001);\n return {\n 'info': chain,\n 'currency': undefined,\n 'symbol': market['symbol'],\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'impliedVolatility': this.safeNumber (quotes, 'mark_iv'),\n 'openInterest': this.safeNumber (chain, 'oi'),\n 'bidPrice': this.safeNumber (quotes, 'best_bid'),\n 'askPrice': this.safeNumber (quotes, 'best_ask'),\n 'midPrice': this.safeNumber (quotes, 'impact_mid_price'),\n 'markPrice': this.safeNumber (chain, 'mark_price'),\n 'lastPrice': undefined,\n 'underlyingPrice': this.safeNumber (chain, 'spot_price'),\n 'change': undefined,\n 'percentage': undefined,\n 'baseVolume': this.safeNumber (chain, 'volume'),\n 'quoteVolume': undefined,\n };\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"average_fill_price\":null,\n \"bracket_order\":null,\n \"bracket_stop_loss_limit_price\":null,\n \"bracket_stop_loss_price\":null,\n \"bracket_take_profit_limit_price\":null,\n \"bracket_take_profit_price\":null,\n \"bracket_trail_amount\":null,\n \"cancellation_reason\":null,\n \"client_order_id\":null,\n \"close_on_trigger\":\"false\",\n \"commission\":\"0\",\n \"created_at\":\"2020-11-16T02:38:26Z\",\n \"id\":152870626,\n \"limit_price\":\"10000\",\n \"meta_data\":{\"source\":\"api\"},\n \"order_type\":\"limit_order\",\n \"paid_commission\":\"0\",\n \"product_id\":139,\n \"reduce_only\":false,\n \"side\":\"buy\",\n \"size\":0,\n \"state\":\"open\",\n \"stop_order_type\":null,\n \"stop_price\":null,\n \"stop_trigger_method\":\"mark_price\",\n \"time_in_force\":\"gtc\",\n \"trail_amount\":null,\n \"unfilled_size\":0,\n \"user_id\":22142\n }", "{\n \"id\": 123,\n \"user_id\": 453671,\n \"size\": 10,\n \"unfilled_size\": 2,\n \"side\": \"buy\",\n \"order_type\": \"limit_order\",\n \"limit_price\": \"59000\",\n \"stop_order_type\": \"stop_loss_order\",\n \"stop_price\": \"55000\",\n \"paid_commission\": \"0.5432\",\n \"commission\": \"0.5432\",\n \"reduce_only\": false,\n \"client_order_id\": \"my_signal_34521712\",\n \"state\": \"open\",\n \"created_at\": \"1725865012000000\",\n \"product_id\": 27,\n \"product_symbol\": \"BTCUSD\"\n }" ], "line_end" => 1988, "line_start" => 1871, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "order" }, %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "clientOrderId", "value" => "clientOrderId" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "lastTradeTimestamp", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "price" }, %{ "comment" => nil, "key" => "amount", "value" => "amount" }, %{ "comment" => nil, "key" => "cost", "value" => "undefined" }, %{ "comment" => nil, "key" => "average", "value" => "average" }, %{ "comment" => nil, "key" => "filled", "value" => "undefined" }, %{ "comment" => nil, "key" => "remaining", "value" => "remaining" }, %{ "comment" => nil, "key" => "status", "value" => "status" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "trades", "value" => "undefined" }, %{ "comment" => nil, "key" => "cost", "value" => "feeCostString" }, %{ "comment" => nil, "key" => "currency", "value" => "feeCurrencyCode" } ], "name" => "parseOrder", "signature" => "parseOrder (order: Dict, market: Market = undefined): Order", "source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // createOrder, cancelOrder, editOrder, fetchOpenOrders, fetchClosedOrders\n //\n // {\n // \"average_fill_price\":null,\n // \"bracket_order\":null,\n // \"bracket_stop_loss_limit_price\":null,\n // \"bracket_stop_loss_price\":null,\n // \"bracket_take_profit_limit_price\":null,\n // \"bracket_take_profit_price\":null,\n // \"bracket_trail_amount\":null,\n // \"cancellation_reason\":null,\n // \"client_order_id\":null,\n // \"close_on_trigger\":\"false\",\n // \"commission\":\"0\",\n // \"created_at\":\"2020-11-16T02:38:26Z\",\n // \"id\":152870626,\n // \"limit_price\":\"10000\",\n // \"meta_data\":{\"source\":\"api\"},\n // \"order_type\":\"limit_order\",\n // \"paid_commission\":\"0\",\n // \"product_id\":139,\n // \"reduce_only\":false,\n // \"side\":\"buy\",\n // \"size\":0,\n // \"state\":\"open\",\n // \"stop_order_type\":null,\n // \"stop_price\":null,\n // \"stop_trigger_method\":\"mark_price\",\n // \"time_in_force\":\"gtc\",\n // \"trail_amount\":null,\n // \"unfilled_size\":0,\n // \"user_id\":22142\n // }\n //\n // fetchOrder\n //\n // {\n // \"id\": 123,\n // \"user_id\": 453671,\n // \"size\": 10,\n // \"unfilled_size\": 2,\n // \"side\": \"buy\",\n // \"order_type\": \"limit_order\",\n // \"limit_price\": \"59000\",\n // \"stop_order_type\": \"stop_loss_order\",\n // \"stop_price\": \"55000\",\n // \"paid_commission\": \"0.5432\",\n // \"commission\": \"0.5432\",\n // \"reduce_only\": false,\n // \"client_order_id\": \"my_signal_34521712\",\n // \"state\": \"open\",\n // \"created_at\": \"1725865012000000\",\n // \"product_id\": 27,\n // \"product_symbol\": \"BTCUSD\"\n // }\n //\n const id = this.safeString (order, 'id');\n const clientOrderId = this.safeString (order, 'client_order_id');\n const createdAt = this.safeString (order, 'created_at');\n let timestamp = undefined;\n if (createdAt !== undefined) {\n if (createdAt.indexOf ('-') >= 0) {\n timestamp = this.parse8601 (createdAt);\n } else {\n timestamp = this.safeIntegerProduct (order, 'created_at', 0.001);\n }\n }\n const marketId = this.safeString (order, 'product_id');\n const marketsByNumericId = this.safeDict (this.options, 'marketsByNumericId', {});\n market = this.safeValue (marketsByNumericId, marketId, market);\n const symbol = (market === undefined) ? marketId : market['symbol'];\n const status = this.parseOrderStatus (this.safeString (order, 'state'));\n const side = this.safeString (order, 'side');\n let type = this.safeString (order, 'order_type');\n if (type !== undefined) {\n type = type.replace ('_order', '');\n }\n const price = this.safeString (order, 'limit_price');\n const amount = this.safeString (order, 'size');\n const remaining = this.safeString (order, 'unfilled_size');\n const average = this.safeString (order, 'average_fill_price');\n let fee = undefined;\n const feeCostString = this.safeString (order, 'paid_commission');\n if (feeCostString !== undefined) {\n let feeCurrencyCode = undefined;\n if (market !== undefined) {\n const settlingAsset = this.safeDict (market['info'], 'settling_asset', {});\n const feeCurrencyId = this.safeString (settlingAsset, 'symbol');\n feeCurrencyCode = this.safeCurrencyCode (feeCurrencyId);\n }\n fee = {\n 'cost': feeCostString,\n 'currency': feeCurrencyCode,\n };\n }\n return this.safeOrder ({\n 'info': order,\n 'id': id,\n 'clientOrderId': clientOrderId,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': undefined,\n 'symbol': symbol,\n 'type': type,\n 'side': side,\n 'price': price,\n 'amount': amount,\n 'cost': undefined,\n 'average': average,\n 'filled': undefined,\n 'remaining': remaining,\n 'status': status,\n 'fee': fee,\n 'trades': undefined,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 1869, "line_start" => 1861, "mappings" => [], "name" => "parseOrderStatus", "signature" => "parseOrderStatus (status: Str)", "source" => "parseOrderStatus (status: Str) {\n const statuses: Dict = {\n 'open': 'open',\n 'pending': 'open',\n 'closed': 'closed',\n 'cancelled': 'canceled',\n };\n return this.safeString (statuses, status, status);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"entry_price\":null,\n \"size\":0,\n \"timestamp\":1605454074268079\n }", "{\n \"user_id\": 0,\n \"size\": 0,\n \"entry_price\": \"string\",\n \"margin\": \"string\",\n \"liquidation_price\": \"string\",\n \"bankruptcy_price\": \"string\",\n \"adl_level\": 0,\n \"product_id\": 0,\n \"product_symbol\": \"string\",\n \"commission\": \"string\",\n \"realized_pnl\": \"string\",\n \"realized_funding\": \"string\"\n }" ], "line_end" => 1859, "line_start" => 1791, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "position" }, %{ "comment" => nil, "key" => "id", "value" => "undefined" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "notional", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginMode", "value" => "undefined" }, %{ "comment" => nil, "key" => "liquidationPrice", "value" => "this.safeNumber (position, 'liquidation_price')" }, %{ "comment" => nil, "key" => "entryPrice", "value" => "this.safeNumber (position, 'entry_price')" }, %{ "comment" => nil, "key" => "unrealizedPnl", "value" => "undefined" }, %{ "comment" => nil, "key" => "contracts", "value" => "this.parseNumber (sizeString)" }, %{ "comment" => nil, "key" => "contractSize", "value" => "this.safeNumber (market, 'contractSize')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "hedged", "value" => "undefined" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "maintenanceMargin", "value" => "undefined" }, %{ "comment" => nil, "key" => "maintenanceMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "collateral", "value" => "undefined" }, %{ "comment" => nil, "key" => "initialMargin", "value" => "undefined" }, %{ "comment" => nil, "key" => "initialMarginPercentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "leverage", "value" => "undefined" }, %{ "comment" => nil, "key" => "marginRatio", "value" => "undefined" }, %{ "comment" => nil, "key" => "stopLossPrice", "value" => "undefined" }, %{ "comment" => nil, "key" => "takeProfitPrice", "value" => "undefined" } ], "name" => "parsePosition", "signature" => "parsePosition (position: Dict, market: Market = undefined)", "source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // fetchPosition\n //\n // {\n // \"entry_price\":null,\n // \"size\":0,\n // \"timestamp\":1605454074268079\n // }\n //\n //\n // fetchPositions\n //\n // {\n // \"user_id\": 0,\n // \"size\": 0,\n // \"entry_price\": \"string\",\n // \"margin\": \"string\",\n // \"liquidation_price\": \"string\",\n // \"bankruptcy_price\": \"string\",\n // \"adl_level\": 0,\n // \"product_id\": 0,\n // \"product_symbol\": \"string\",\n // \"commission\": \"string\",\n // \"realized_pnl\": \"string\",\n // \"realized_funding\": \"string\"\n // }\n //\n const marketId = this.safeString (position, 'product_symbol');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n const timestamp = this.safeIntegerProduct (position, 'timestamp', 0.001);\n const sizeString = this.safeString (position, 'size');\n let side = undefined;\n if (sizeString !== undefined) {\n if (Precise.stringGt (sizeString, '0')) {\n side = 'buy';\n } else if (Precise.stringLt (sizeString, '0')) {\n side = 'sell';\n }\n }\n return this.safePosition ({\n 'info': position,\n 'id': undefined,\n 'symbol': symbol,\n 'notional': undefined,\n 'marginMode': undefined,\n 'liquidationPrice': this.safeNumber (position, 'liquidation_price'),\n 'entryPrice': this.safeNumber (position, 'entry_price'),\n 'unrealizedPnl': undefined, // todo - realized_pnl ?\n 'percentage': undefined,\n 'contracts': this.parseNumber (sizeString),\n 'contractSize': this.safeNumber (market, 'contractSize'),\n 'markPrice': undefined,\n 'side': side,\n 'hedged': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'maintenanceMargin': undefined,\n 'maintenanceMarginPercentage': undefined,\n 'collateral': undefined,\n 'initialMargin': undefined,\n 'initialMarginPercentage': undefined,\n 'leverage': undefined,\n 'marginRatio': undefined,\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n });\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"contract_value\": \"0.001\",\n \"basis_factor_max_limit\": \"10.95\",\n \"maker_commission_rate\": \"0.0003\",\n \"launch_time\": \"2023-07-19T04:30:03Z\",\n \"trading_status\": \"operational\",\n \"product_specs\": {\n \"backup_vol_expiry_time\": 31536000,\n \"max_deviation_from_external_vol\": 0.75,\n \"max_lower_deviation_from_external_vol\": 0.75,\n \"max_upper_deviation_from_external_vol\": 0.5,\n \"max_volatility\": 3,\n \"min_volatility\": 0.1,\n \"premium_commission_rate\": 0.1,\n \"settlement_index_price\": \"29993.536675710806\",\n \"vol_calculation_method\": \"orderbook\",\n \"vol_expiry_time\": 31536000\n },\n \"description\": \"BTC call option expiring on 19-7-2023\",\n \"settlement_price\": \"0\",\n \"disruption_reason\": null,\n \"settling_asset\": {},\n \"initial_margin\": \"1\",\n \"tick_size\": \"0.1\",\n \"maintenance_margin\": \"0.5\",\n \"id\": 117542,\n \"notional_type\": \"vanilla\",\n \"ui_config\": {},\n \"contract_unit_currency\": \"BTC\",\n \"symbol\": \"C-BTC-30900-190723\",\n \"insurance_fund_margin_contribution\": \"1\",\n \"price_band\": \"2\",\n \"annualized_funding\": \"10.95\",\n \"impact_size\": 200,\n \"contract_type\": \"call_options\",\n \"position_size_limit\": 255633,\n \"max_leverage_notional\": \"200000\",\n \"initial_margin_scaling_factor\": \"0.000002\",\n \"strike_price\": \"30900\",\n \"is_quanto\": false,\n \"settlement_time\": \"2023-07-19T12:00:00Z\",\n \"liquidation_penalty_factor\": \"0.5\",\n \"funding_method\": \"mark_price\",\n \"taker_commission_rate\": \"0.0003\",\n \"default_leverage\": \"100.000000000000000000\",\n \"state\": \"expired\",\n \"auction_start_time\": null,\n \"short_description\": \"BTC Call\",\n \"quoting_asset\": {},\n \"maintenance_margin_scaling_factor\":\"0.000002\"\n }" ], "line_end" => 3319, "line_start" => 3256, "mappings" => [ %{ "comment" => nil, "key" => "info", "value" => "settlement" }, %{ "comment" => nil, "key" => "symbol", "value" => "this.safeSymbol (marketId, market)" }, %{ "comment" => nil, "key" => "price", "value" => "this.safeNumber (settlement, 'settlement_price')" }, %{ "comment" => nil, "key" => "timestamp", "value" => "this.parse8601 (datetime)" }, %{ "comment" => nil, "key" => "datetime", "value" => "datetime" } ], "name" => "parseSettlement", "signature" => "parseSettlement (settlement, market)", "source" => "parseSettlement (settlement, market) {\n //\n // {\n // \"contract_value\": \"0.001\",\n // \"basis_factor_max_limit\": \"10.95\",\n // \"maker_commission_rate\": \"0.0003\",\n // \"launch_time\": \"2023-07-19T04:30:03Z\",\n // \"trading_status\": \"operational\",\n // \"product_specs\": {\n // \"backup_vol_expiry_time\": 31536000,\n // \"max_deviation_from_external_vol\": 0.75,\n // \"max_lower_deviation_from_external_vol\": 0.75,\n // \"max_upper_deviation_from_external_vol\": 0.5,\n // \"max_volatility\": 3,\n // \"min_volatility\": 0.1,\n // \"premium_commission_rate\": 0.1,\n // \"settlement_index_price\": \"29993.536675710806\",\n // \"vol_calculation_method\": \"orderbook\",\n // \"vol_expiry_time\": 31536000\n // },\n // \"description\": \"BTC call option expiring on 19-7-2023\",\n // \"settlement_price\": \"0\",\n // \"disruption_reason\": null,\n // \"settling_asset\": {},\n // \"initial_margin\": \"1\",\n // \"tick_size\": \"0.1\",\n // \"maintenance_margin\": \"0.5\",\n // \"id\": 117542,\n // \"notional_type\": \"vanilla\",\n // \"ui_config\": {},\n // \"contract_unit_currency\": \"BTC\",\n // \"symbol\": \"C-BTC-30900-190723\",\n // \"insurance_fund_margin_contribution\": \"1\",\n // \"price_band\": \"2\",\n // \"annualized_funding\": \"10.95\",\n // \"impact_size\": 200,\n // \"contract_type\": \"call_options\",\n // \"position_size_limit\": 255633,\n // \"max_leverage_notional\": \"200000\",\n // \"initial_margin_scaling_factor\": \"0.000002\",\n // \"strike_price\": \"30900\",\n // \"is_quanto\": false,\n // \"settlement_time\": \"2023-07-19T12:00:00Z\",\n // \"liquidation_penalty_factor\": \"0.5\",\n // \"funding_method\": \"mark_price\",\n // \"taker_commission_rate\": \"0.0003\",\n // \"default_leverage\": \"100.000000000000000000\",\n // \"state\": \"expired\",\n // \"auction_start_time\": null,\n // \"short_description\": \"BTC Call\",\n // \"quoting_asset\": {},\n // \"maintenance_margin_scaling_factor\":\"0.000002\"\n // }\n //\n const datetime = this.safeString (settlement, 'settlement_time');\n const marketId = this.safeString (settlement, 'symbol');\n return {\n 'info': settlement,\n 'symbol': this.safeSymbol (marketId, market),\n 'price': this.safeNumber (settlement, 'settlement_price'),\n 'timestamp': this.parse8601 (datetime),\n 'datetime': datetime,\n };\n }" }, %{ "comment" => nil, "examples" => [], "line_end" => 3327, "line_start" => 3321, "mappings" => [], "name" => "parseSettlements", "signature" => "parseSettlements (settlements, market)", "source" => "parseSettlements (settlements, market) {\n const result = [];\n for (let i = 0; i < settlements.length; i++) {\n result.push (this.parseSettlement (settlements[i], market));\n }\n return result;\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"close\": 30634.0,\n \"contract_type\": \"spot\",\n \"greeks\": null,\n \"high\": 30780.0,\n \"low\": 30340.5,\n \"mark_price\": \"48000\",\n \"oi\": \"0.0000\",\n \"oi_change_usd_6h\": \"0.0000\",\n \"oi_contracts\": \"0\",\n \"oi_value\": \"0.0000\",\n \"oi_value_symbol\": \"BTC\",\n \"oi_value_usd\": \"0.0000\",\n \"open\": 30464.0,\n \"price_band\": null,\n \"product_id\": 8320,\n \"quotes\": {},\n \"size\": 2.6816639999999996,\n \"spot_price\": \"30637.91465121\",\n \"symbol\": \"BTC_USDT\",\n \"timestamp\": 1689139767621299,\n \"turnover\": 2.6816639999999996,\n \"turnover_symbol\": \"BTC\",\n \"turnover_usd\": 81896.45613400004,\n \"volume\": 2.6816639999999996\n }", "{\n \"close\": 30600.5,\n \"contract_type\": \"perpetual_futures\",\n \"funding_rate\": \"0.00602961\",\n \"greeks\": null,\n \"high\": 30803.0,\n \"low\": 30265.5,\n \"mark_basis\": \"-0.45601594\",\n \"mark_price\": \"30600.10481568\",\n \"oi\": \"469.9190\",\n \"oi_change_usd_6h\": \"2226314.9900\",\n \"oi_contracts\": \"469919\",\n \"oi_value\": \"469.9190\",\n \"oi_value_symbol\": \"BTC\",\n \"oi_value_usd\": \"14385640.6802\",\n \"open\": 30458.5,\n \"price_band\": {\n \"lower_limit\": \"29067.08312627\",\n \"upper_limit\": \"32126.77608693\"\n },\n \"product_id\": 139,\n \"quotes\": {\n \"ask_iv\": null,\n \"ask_size\": \"965\",\n \"best_ask\": \"30600.5\",\n \"best_bid\": \"30599.5\",\n \"bid_iv\": null,\n \"bid_size\": \"196\",\n \"impact_mid_price\": null,\n \"mark_iv\": \"-0.44931641\"\n },\n \"size\": 1226303,\n \"spot_price\": \"30612.85362773\",\n \"symbol\": \"BTCUSDT\",\n \"timestamp\": 1689136597460456,\n \"turnover\": 37392218.45999999,\n \"turnover_symbol\": \"USDT\",\n \"turnover_usd\": 37392218.45999999,\n \"volume\": 1226.3029999999485\n }", "{\n \"contract_type\": \"call_options\",\n \"greeks\": {\n \"delta\": \"0.60873994\",\n \"gamma\": \"0.00014854\",\n \"rho\": \"7.71808010\",\n \"spot\": \"30598.49040622\",\n \"theta\": \"-30.44743017\",\n \"vega\": \"24.83508248\"\n },\n \"mark_price\": \"1347.74819696\",\n \"mark_vol\": \"0.39966303\",\n \"oi\": \"2.7810\",\n \"oi_change_usd_6h\": \"0.0000\",\n \"oi_contracts\": \"2781\",\n \"oi_value\": \"2.7810\",\n \"oi_value_symbol\": \"BTC\",\n \"oi_value_usd\": \"85127.4337\",\n \"price_band\": {\n \"lower_limit\": \"91.27423497\",\n \"upper_limit\": \"7846.19454697\"\n },\n \"product_id\": 107150,\n \"quotes\": {\n \"ask_iv\": \"0.41023239\",\n \"ask_size\": \"2397\",\n \"best_ask\": \"1374\",\n \"best_bid\": \"1322\",\n \"bid_iv\": \"0.38929375\",\n \"bid_size\": \"3995\",\n \"impact_mid_price\": null,\n \"mark_iv\": \"0.39965618\"\n },\n \"spot_price\": \"30598.43379314\",\n \"strike_price\": \"30000\",\n \"symbol\": \"C-BTC-30000-280723\",\n \"timestamp\": 1689136932893181,\n \"turnover_symbol\": \"USDT\"\n }" ], "line_end" => 1114, "line_start" => 969, "mappings" => [ %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "high", "value" => "this.safeNumber (ticker, 'high')" }, %{ "comment" => nil, "key" => "low", "value" => "this.safeNumber (ticker, 'low')" }, %{ "comment" => nil, "key" => "bid", "value" => "this.safeNumber (quotes, 'best_bid')" }, %{ "comment" => nil, "key" => "bidVolume", "value" => "this.safeNumber (quotes, 'bid_size')" }, %{ "comment" => nil, "key" => "ask", "value" => "this.safeNumber (quotes, 'best_ask')" }, %{ "comment" => nil, "key" => "askVolume", "value" => "this.safeNumber (quotes, 'ask_size')" }, %{ "comment" => nil, "key" => "vwap", "value" => "undefined" }, %{ "comment" => nil, "key" => "open", "value" => "this.safeString (ticker, 'open')" }, %{ "comment" => nil, "key" => "close", "value" => "last" }, %{ "comment" => nil, "key" => "last", "value" => "last" }, %{ "comment" => nil, "key" => "previousClose", "value" => "undefined" }, %{ "comment" => nil, "key" => "change", "value" => "undefined" }, %{ "comment" => nil, "key" => "percentage", "value" => "undefined" }, %{ "comment" => nil, "key" => "average", "value" => "undefined" }, %{ "comment" => nil, "key" => "baseVolume", "value" => "this.safeNumber (ticker, 'volume')" }, %{ "comment" => nil, "key" => "quoteVolume", "value" => "this.safeNumber (ticker, 'turnover')" }, %{ "comment" => nil, "key" => "markPrice", "value" => "this.safeNumber (ticker, 'mark_price')" }, %{ "comment" => nil, "key" => "indexPrice", "value" => "this.safeNumber (ticker, 'spot_price')" }, %{ "comment" => nil, "key" => "info", "value" => "ticker" } ], "name" => "parseTicker", "signature" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker", "source" => "parseTicker (ticker: Dict, market: Market = undefined): Ticker {\n //\n // spot: fetchTicker, fetchTickers\n //\n // {\n // \"close\": 30634.0,\n // \"contract_type\": \"spot\",\n // \"greeks\": null,\n // \"high\": 30780.0,\n // \"low\": 30340.5,\n // \"mark_price\": \"48000\",\n // \"oi\": \"0.0000\",\n // \"oi_change_usd_6h\": \"0.0000\",\n // \"oi_contracts\": \"0\",\n // \"oi_value\": \"0.0000\",\n // \"oi_value_symbol\": \"BTC\",\n // \"oi_value_usd\": \"0.0000\",\n // \"open\": 30464.0,\n // \"price_band\": null,\n // \"product_id\": 8320,\n // \"quotes\": {},\n // \"size\": 2.6816639999999996,\n // \"spot_price\": \"30637.91465121\",\n // \"symbol\": \"BTC_USDT\",\n // \"timestamp\": 1689139767621299,\n // \"turnover\": 2.6816639999999996,\n // \"turnover_symbol\": \"BTC\",\n // \"turnover_usd\": 81896.45613400004,\n // \"volume\": 2.6816639999999996\n // }\n //\n // swap: fetchTicker, fetchTickers\n //\n // {\n // \"close\": 30600.5,\n // \"contract_type\": \"perpetual_futures\",\n // \"funding_rate\": \"0.00602961\",\n // \"greeks\": null,\n // \"high\": 30803.0,\n // \"low\": 30265.5,\n // \"mark_basis\": \"-0.45601594\",\n // \"mark_price\": \"30600.10481568\",\n // \"oi\": \"469.9190\",\n // \"oi_change_usd_6h\": \"2226314.9900\",\n // \"oi_contracts\": \"469919\",\n // \"oi_value\": \"469.9190\",\n // \"oi_value_symbol\": \"BTC\",\n // \"oi_value_usd\": \"14385640.6802\",\n // \"open\": 30458.5,\n // \"price_band\": {\n // \"lower_limit\": \"29067.08312627\",\n // \"upper_limit\": \"32126.77608693\"\n // },\n // \"product_id\": 139,\n // \"quotes\": {\n // \"ask_iv\": null,\n // \"ask_size\": \"965\",\n // \"best_ask\": \"30600.5\",\n // \"best_bid\": \"30599.5\",\n // \"bid_iv\": null,\n // \"bid_size\": \"196\",\n // \"impact_mid_price\": null,\n // \"mark_iv\": \"-0.44931641\"\n // },\n // \"size\": 1226303,\n // \"spot_price\": \"30612.85362773\",\n // \"symbol\": \"BTCUSDT\",\n // \"timestamp\": 1689136597460456,\n // \"turnover\": 37392218.45999999,\n // \"turnover_symbol\": \"USDT\",\n // \"turnover_usd\": 37392218.45999999,\n // \"volume\": 1226.3029999999485\n // }\n //\n // option: fetchTicker, fetchTickers\n //\n // {\n // \"contract_type\": \"call_options\",\n // \"greeks\": {\n // \"delta\": \"0.60873994\",\n // \"gamma\": \"0.00014854\",\n // \"rho\": \"7.71808010\",\n // \"spot\": \"30598.49040622\",\n // \"theta\": \"-30.44743017\",\n // \"vega\": \"24.83508248\"\n // },\n // \"mark_price\": \"1347.74819696\",\n // \"mark_vol\": \"0.39966303\",\n // \"oi\": \"2.7810\",\n // \"oi_change_usd_6h\": \"0.0000\",\n // \"oi_contracts\": \"2781\",\n // \"oi_value\": \"2.7810\",\n // \"oi_value_symbol\": \"BTC\",\n // \"oi_value_usd\": \"85127.4337\",\n // \"price_band\": {\n // \"lower_limit\": \"91.27423497\",\n // \"upper_limit\": \"7846.19454697\"\n // },\n // \"product_id\": 107150,\n // \"quotes\": {\n // \"ask_iv\": \"0.41023239\",\n // \"ask_size\": \"2397\",\n // \"best_ask\": \"1374\",\n // \"best_bid\": \"1322\",\n // \"bid_iv\": \"0.38929375\",\n // \"bid_size\": \"3995\",\n // \"impact_mid_price\": null,\n // \"mark_iv\": \"0.39965618\"\n // },\n // \"spot_price\": \"30598.43379314\",\n // \"strike_price\": \"30000\",\n // \"symbol\": \"C-BTC-30000-280723\",\n // \"timestamp\": 1689136932893181,\n // \"turnover_symbol\": \"USDT\"\n // }\n //\n const timestamp = this.safeIntegerProduct (ticker, 'timestamp', 0.001);\n const marketId = this.safeString (ticker, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n const last = this.safeString (ticker, 'close');\n const quotes = this.safeDict (ticker, 'quotes', {});\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'high': this.safeNumber (ticker, 'high'),\n 'low': this.safeNumber (ticker, 'low'),\n 'bid': this.safeNumber (quotes, 'best_bid'),\n 'bidVolume': this.safeNumber (quotes, 'bid_size'),\n 'ask': this.safeNumber (quotes, 'best_ask'),\n 'askVolume': this.safeNumber (quotes, 'ask_size'),\n 'vwap': undefined,\n 'open': this.safeString (ticker, 'open'),\n 'close': last,\n 'last': last,\n 'previousClose': undefined,\n 'change': undefined,\n 'percentage': undefined,\n 'average': undefined,\n 'baseVolume': this.safeNumber (ticker, 'volume'),\n 'quoteVolume': this.safeNumber (ticker, 'turnover'),\n 'markPrice': this.safeNumber (ticker, 'mark_price'),\n 'indexPrice': this.safeNumber (ticker, 'spot_price'),\n 'info': ticker,\n }, market);\n }" }, %{ "comment" => nil, "examples" => [ "{\n \"buyer_role\":\"maker\",\n \"price\":\"15896.5\",\n \"seller_role\":\"taker\",\n \"size\":241,\n \"symbol\":\"BTCUSDT\",\n \"timestamp\":1605376684714595\n }", "{\n \"commission\":\"0.008335000000000000\",\n \"created_at\":\"2020-11-16T19:07:19Z\",\n \"fill_type\":\"normal\",\n \"id\":\"e7ff05c233a74245b72381f8dd91d1ce\",\n \"meta_data\":{\n \"effective_commission_rate\":\"0.0005\",\n \"order_price\":\"16249\",\n \"order_size\":1,\n \"order_type\":\"market_order\",\n \"order_unfilled_size\":0,\n \"trading_fee_credits_used\":\"0\"\n },\n \"order_id\":\"152999629\",\n \"price\":\"16669\",\n \"product\":{\n \"contract_type\":\"perpetual_futures\",\n \"contract_unit_currency\":\"BTC\",\n \"contract_value\":\"0.001\",\n \"id\":139,\n \"notional_type\":\"vanilla\",\n \"quoting_asset\":{\"minimum_precision\":2,\"precision\":6,\"symbol\":\"USDT\"},\n \"settling_asset\":{\"minimum_precision\":2,\"precision\":6,\"symbol\":\"USDT\"},\n \"symbol\":\"BTCUSDT\",\n \"tick_size\":\"0.5\",\n \"underlying_asset\":{\"minimum_precision\":4,\"precision\":8,\"symbol\":\"BTC\"}\n },\n \"product_id\":139,\n \"role\":\"taker\",\n \"side\":\"sell\",\n \"size\":1\n }" ], "line_end" => 1553, "line_start" => 1455, "mappings" => [ %{ "comment" => nil, "key" => "id", "value" => "id" }, %{ "comment" => nil, "key" => "order", "value" => "orderId" }, %{ "comment" => nil, "key" => "timestamp", "value" => "timestamp" }, %{ "comment" => nil, "key" => "datetime", "value" => "this.iso8601 (timestamp)" }, %{ "comment" => nil, "key" => "symbol", "value" => "symbol" }, %{ "comment" => nil, "key" => "type", "value" => "type" }, %{ "comment" => nil, "key" => "side", "value" => "side" }, %{ "comment" => nil, "key" => "price", "value" => "priceString" }, %{ "comment" => nil, "key" => "amount", "value" => "amountString" }, %{ "comment" => nil, "key" => "cost", "value" => "undefined" }, %{ "comment" => nil, "key" => "takerOrMaker", "value" => "takerOrMaker" }, %{ "comment" => nil, "key" => "fee", "value" => "fee" }, %{ "comment" => nil, "key" => "info", "value" => "trade" }, %{ "comment" => nil, "key" => "cost", "value" => "feeCostString" }, %{ "comment" => nil, "key" => "currency", "value" => "feeCurrencyCode" } ], "name" => "parseTrade", "signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade", "source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // public fetchTrades\n //\n // {\n // \"buyer_role\":\"maker\",\n // \"price\":\"15896.5\",\n // \"seller_role\":\"taker\",\n // \"size\":241,\n // \"symbol\":\"BTCUSDT\",\n // \"timestamp\":1605376684714595\n // }\n //\n // private fetchMyTrades\n //\n // {\n // \"commission\":\"0.008335000000000000\",\n // \"created_at\":\"2020-11-16T19:07:19Z\",\n // \"fill_type\":\"normal\",\n // \"id\":\"e7ff05c233a74245b72381f8dd91d1ce\",\n // \"meta_data\":{\n // \"effective_commission_rate\":\"0.0005\",\n // \"order_price\":\"16249\",\n // \"order_size\":1,\n // \"order_type\":\"market_order\",\n // \"order_unfilled_size\":0,\n // \"trading_fee_credits_used\":\"0\"\n // },\n // \"order_id\":\"152999629\",\n // \"price\":\"16669\",\n // \"product\":{\n // \"contract_type\":\"perpetual_futures\",\n // \"contract_unit_currency\":\"BTC\",\n // \"contract_value\":\"0.001\",\n // \"id\":139,\n // \"notional_type\":\"vanilla\",\n // \"quoting_asset\":{\"minimum_precision\":2,\"precision\":6,\"symbol\":\"USDT\"},\n // \"settling_asset\":{\"minimum_precision\":2,\"precision\":6,\"symbol\":\"USDT\"},\n // \"symbol\":\"BTCUSDT\",\n // \"tick_size\":\"0.5\",\n // \"underlying_asset\":{\"minimum_precision\":4,\"precision\":8,\"symbol\":\"BTC\"}\n // },\n // \"product_id\":139,\n // \"role\":\"taker\",\n // \"side\":\"sell\",\n // \"size\":1\n // }\n //\n const id = this.safeString (trade, 'id');\n const orderId = this.safeString (trade, 'order_id');\n let timestamp = this.parse8601 (this.safeString (trade, 'created_at'));\n timestamp = this.safeIntegerProduct (trade, 'timestamp', 0.001, timestamp);\n const priceString = this.safeString (trade, 'price');\n const amountString = this.safeString (trade, 'size');\n const product = this.safeDict (trade, 'product', {});\n const marketId = this.safeString (product, 'symbol');\n const symbol = this.safeSymbol (marketId, market);\n const sellerRole = this.safeString (trade, 'seller_role');\n let side = this.safeString (trade, 'side');\n if (side === undefined) {\n if (sellerRole === 'taker') {\n side = 'sell';\n } else if (sellerRole === 'maker') {\n side = 'buy';\n }\n }\n const takerOrMaker = this.safeString (trade, 'role');\n const metaData = this.safeDict (trade, 'meta_data', {});\n let type = this.safeString (metaData, 'order_type');\n if (type !== undefined) {\n type = type.replace ('_order', '');\n }\n const feeCostString = this.safeString (trade, 'commission');\n let fee = undefined;\n if (feeCostString !== undefined) {\n const settlingAsset = this.safeDict (product, 'settling_asset', {});\n const feeCurrencyId = this.safeString (settlingAsset, 'symbol');\n const feeCurrencyCode = this.safeCurrencyCode (feeCurrencyId);\n fee = {\n 'cost': feeCostString,\n 'currency': feeCurrencyCode,\n };\n }\n return this.safeTrade ({\n 'id': id,\n 'order': orderId,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': symbol,\n 'type': type,\n 'side': side,\n 'price': priceString,\n 'amount': amountString,\n 'cost': undefined,\n 'takerOrMaker': takerOrMaker,\n 'fee': fee,\n 'info': trade,\n }, market);\n }" } ], path_prefix: "/v2/", pro: false, quote_json_numbers: nil, rate_limits: %{ interval_ms: 300, period: 1000, requests: 3, rolling_window_size: 60000 }, raw_endpoints: %{ private: [], public: [] }, required_credentials: %{ api_key: true, password: false, secret: true, uid: false }, requires_eddsa: false, response_error: nil, signing: %{ confidence: :medium, pattern: :hmac_sha256_query, signature_header: "signature" }, spec_format_version: 1, status: %{ "eta" => nil, "status" => "ok", "updated" => nil, "url" => nil }, symbol_format: nil, symbol_formats: %{ option: %{ base: "ETH", base_id: "ETH", case: :upper, contract: true, contract_size: 0.01, expiry: 1771761600000, expiry_datetime: "2026-02-22T12:00:00.000Z", id: "C-ETH-2000-220226", inverse: false, limits: %{ "amount" => %{ "max" => 173467, "min" => 1 }, "cost" => %{}, "leverage" => %{}, "price" => %{} }, linear: true, maker: 1.5e-4, precision: %{ "amount" => 1, "price" => 0.01 }, quote: "USDT", quote_id: "USDT", separator: "-", settle: "USDT", settle_id: "USDT", symbol: "ETH/USDT:USDT-260222-2000-C", taker: 1.5e-4 }, precision_mode: 4, sample_limits: %{ "amount" => %{ "max" => 10000000, "min" => 1 }, "cost" => %{}, "price" => %{} }, sample_precision: %{ "amount" => 1.0e-5, "price" => 0.01 }, spot: %{ base: "ETH", base_id: "ETH", case: :upper, contract: false, id: "ETH_USDT", limits: %{ "amount" => %{ "max" => 10000000, "min" => 1 }, "cost" => %{}, "leverage" => %{}, "price" => %{} }, maker: 7.5e-4, precision: %{ "amount" => 1.0e-5, "price" => 0.01 }, quote: "USDT", quote_id: "USDT", separator: "_", symbol: "ETH/USDT", taker: 7.5e-4 }, swap: %{ base: "AR", base_id: "AR", case: :upper, contract: true, contract_size: 1, id: "ARUSDT", inverse: false, limits: %{ "amount" => %{ "max" => 15434, "min" => 1 }, "cost" => %{}, "leverage" => %{}, "price" => %{} }, linear: true, maker: 0.0003, precision: %{ "amount" => 1, "price" => 0.001 }, quote: "USDT", quote_id: "USDT", separator: "", settle: "USDT", settle_id: "USDT", symbol: "AR/USDT:USDT", taker: 0.0003 } }, symbol_patterns: %{ option: %{ case: :upper, component_order: [ :type, :base, :strike, :date ], date_format: :yymmdd, pattern: :option_yymmdd, separator: "-", suffix: nil }, spot: %{ case: :upper, component_order: nil, date_format: nil, pattern: :underscore_upper, separator: "_", suffix: nil }, swap: %{ case: :upper, component_order: nil, date_format: nil, pattern: :implicit, separator: "", suffix: nil } }, timeframes: %{ "15m" => "15m", "1M" => "30d", "1d" => "1d", "1h" => "1h", "1m" => "1m", "1w" => "1w", "2h" => "2h", "2w" => "2w", "30m" => "30m", "3m" => "3m", "4h" => "4h", "5m" => "5m", "6h" => "6h", "7d" => "7d" }, url_strategy: %{ detected_from: "sign_method", pattern: :version_slash, prefix: "/v2/" }, urls: %{ api: "https://api.delta.exchange", api_sections: %{ "private" => "https://api.delta.exchange", "public" => "https://api.delta.exchange" }, doc: [ "https://docs.delta.exchange" ], other: nil, sandbox: %{ "private" => "https://testnet-api.delta.exchange", "public" => "https://testnet-api.delta.exchange" }, www: "https://www.delta.exchange" }, version: "v2", ws: nil }