Current section
Files
Jump to
Current section
Files
priv/specs/extracted/defx.exs
# Defx X Exchange Specification
#
# Auto-generated by: mix ccxt.extract defx
# CCXT version: 4.5.42
# Spec format version: 2
#
# 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: nil,
currencies: %{},
currency_aliases: %{
"BCHSV" => "BSV",
"XBT" => "BTC"
},
dex: true,
enable_rate_limit: true,
endpoint_extraction_stats: %{
"capturedMethods" => 29,
"coveragePercent" => 100,
"enabledMethods" => 31,
"excluded" => [
%{
"method" => "editOrder",
"reason" => "emulated (returns cached data, no HTTP call)"
}
],
"excludedMethods" => 1,
"extractableMethods" => 30,
"failures" => [
%{
"error" => "defx fetchTickers() is not supported for spot markets",
"method" => "fetchTickers"
}
]
},
endpoints: [
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"symbols" => [
"BTCUSDT"
]
},
expects: :list,
market_type: :swap,
method: :delete,
name: :cancel_all_orders,
param_mappings: %{},
params: [
:symbol
],
path: "/api/orders/allOpen",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"idType" => "orderId"
},
expects: :single,
market_type: :swap,
method: :delete,
name: :cancel_order,
param_mappings: %{
"id" => "orderId"
},
params: [
:id,
:symbol
],
path: "/api/order/{orderId}",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"timeInForce" => "GTC",
"type" => "LIMIT"
},
expects: :single,
market_type: :swap,
method: :post,
name: :create_limit_order,
param_mappings: %{
"amount" => "quantity"
},
params: [
:symbol,
:side,
:amount,
:price
],
path: "/api/order",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"timeInForce" => "GTC"
},
expects: :single,
market_type: :swap,
method: :post,
name: :create_order,
param_mappings: %{
"amount" => "quantity"
},
params: [
:symbol,
:type,
:side,
:amount,
:price
],
path: "/api/order",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"stopLoss" => %{
"triggerPrice" => 48000
},
"takeProfit" => %{
"triggerPrice" => 52000
},
"timeInForce" => "GTC"
},
expects: :list,
market_type: :swap,
method: :post,
name: :create_order_with_take_profit_and_stop_loss,
param_mappings: %{
"amount" => "quantity"
},
params: [
:symbol,
:type,
:side,
:amount,
:price,
:takeProfit,
:stopLoss
],
path: "/api/order",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"reduceOnly" => true,
"timeInForce" => "GTC"
},
expects: :single,
market_type: :swap,
method: :post,
name: :create_reduce_only_order,
param_mappings: %{
"amount" => "quantity"
},
params: [
:symbol,
:type,
:side,
:amount,
:price
],
path: "/api/order",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"timeInForce" => "GTC",
"triggerDirection" => "above",
"type" => "TAKE_PROFIT_LIMIT",
"workingType" => "MARK_PRICE"
},
expects: :single,
market_type: :swap,
method: :post,
name: :create_take_profit_order,
param_mappings: %{
"amount" => "quantity",
"takeProfitPrice" => "stopPrice"
},
params: [
:symbol,
:type,
:side,
:amount,
:price,
:takeProfitPrice
],
path: "/api/order",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"timeInForce" => "GTC",
"triggerDirection" => "below",
"type" => "STOP_LIMIT",
"workingType" => "MARK_PRICE"
},
expects: :single,
market_type: :swap,
method: :post,
name: :create_trigger_order,
param_mappings: %{
"amount" => "quantity",
"triggerPrice" => "stopPrice"
},
params: [
:symbol,
:type,
:side,
:amount,
:price,
:triggerPrice
],
path: "/api/order",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_balance,
param_mappings: %{},
params: [],
path: "/api/wallet/balance",
response_transformer: {:extract_path_unwrap, ["assets"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"statuses" => "CANCELED"
},
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_canceled_orders,
param_mappings: %{
"symbol" => "symbols"
},
params: [
:symbol,
:since,
:limit
],
path: "/api/orders",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"statuses" => "FILLED"
},
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_closed_orders,
param_mappings: %{
"symbol" => "symbols"
},
params: [
:symbol,
:since,
:limit
],
path: "/api/orders",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/public",
auth: false,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_funding_rate,
param_mappings: %{},
params: [
:symbol
],
path: "/symbols/{symbol}/prices",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/public",
auth: false,
cost: 1,
default_params: %{
"level" => 10
},
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_l2_order_book,
param_mappings: %{},
params: [
:symbol,
:limit
],
path: "/symbols/{symbol}/depth/2/{slab}",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"end" => "<generated>",
"start" => 0
},
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_ledger,
pagination: %{
style: :dynamic
},
param_mappings: %{
"since" => "start"
},
params: [
:code,
:since,
:limit
],
path: "/api/wallet/transactions",
response_transformer: {:extract_path, ["transactions"]},
source: :intercepted
},
%{
api_section: "v1/public",
auth: false,
cost: 1,
default_params: %{
"type" => "perps"
},
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_markets,
param_mappings: %{},
params: [],
path: "/c/markets",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_my_trades,
param_mappings: %{
"symbol" => "symbols"
},
params: [
:symbol,
:since,
:limit
],
path: "/api/trades",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/public",
auth: false,
cost: 1,
default_params: %{
"endTime" => "<generated>"
},
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_ohlcv,
param_mappings: %{
"since" => "startTime",
"timeframe" => "interval"
},
params: [
:symbol,
:timeframe,
:since,
:limit
],
path: "/symbols/{symbol}/ohlc",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"statuses" => "OPEN"
},
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_open_orders,
param_mappings: %{
"symbol" => "symbols"
},
params: [
:symbol,
:since,
:limit
],
path: "/api/orders",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
default_params: %{
"idType" => "orderId"
},
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_order,
param_mappings: %{
"id" => "orderId"
},
params: [
:id,
:symbol
],
path: "/api/order/{orderId}",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/public",
auth: false,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_order_book,
param_mappings: %{
"limit" => "level"
},
params: [
:symbol,
:limit
],
path: "/symbols/{symbol}/depth/2/{slab}",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_orders,
param_mappings: %{
"symbol" => "symbols"
},
params: [
:symbol,
:since,
:limit
],
path: "/api/orders",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_position,
param_mappings: %{},
params: [
:symbol
],
path: "/api/position/active",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_positions,
param_mappings: %{},
params: [
:symbols
],
path: "/api/position/active",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/public",
auth: false,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_status,
param_mappings: %{},
params: [],
path: "/healthcheck/ping",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/public",
auth: false,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_ticker,
param_mappings: %{},
params: [
:symbol
],
path: "/symbols/{symbol}/ticker/24hr",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/public",
auth: false,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_time,
param_mappings: %{},
params: [],
path: "/healthcheck/ping",
response_transformer: {:extract_path_unwrap, ["t"]},
source: :intercepted
},
%{
api_section: "v1/public",
auth: false,
cost: 1,
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_trades,
param_mappings: %{},
params: [
:symbol,
:since,
:limit
],
path: "/symbols/{symbol}/trades",
response_transformer: {:extract_path, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
expects: :single,
market_type: :swap,
method: :post,
name: :set_leverage,
param_mappings: %{},
params: [
:leverage,
:symbol
],
path: "/api/users/metadata/leverage",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
},
%{
api_section: "v1/private",
auth: true,
cost: 1,
expects: :single,
market_type: :swap,
method: :post,
name: :withdraw,
param_mappings: %{
"code" => "asset"
},
params: [
:code,
:amount,
:address,
:tag
],
path: "/api/transfers/bridge/withdrawal",
response_transformer: {:extract_path_unwrap, ["data"]},
source: :intercepted
}
],
error_code_details: %{
404 => %{
description: "{\"errorCode\":404,\"errorMessage\":\"Not Found\"}",
type: :invalid_parameters
},
"Bad Request" => %{
description: "{\"errorMessage\":\"Bad Request\",\"data\":[{\"param\":\"symbol\",\"message\":\"\\\"symbol\\\" must be one of [ETH_USDC, BTC_USDC, BNB_USDC, SOL_USDC, DOGE_USDC, TON_USDC, AVAX_USDC, WIF_USDC, KPEPE_USDC, KSHIB_USDC, KBONK_USDC, MOODENG_USDC, POPCAT_USDC, MOTHER_USDC]\"}]}",
type: :invalid_parameters
},
"Internal server error" => %{
description: "Internal server error",
type: :exchange_error
},
"active_position_not_found" => %{
description: "{\"errorCode\":\"active_position_not_found\",\"errorMessage\":\"Active position not found\"}",
type: :invalid_order
},
"failed_index_price_up_multiplier_filter" => %{
description: "{\"errorCode\":\"failed_index_price_up_multiplier_filter\",\"errorMessage\":\"failed_index_price_up_multiplier_filter\",\"errorData\":{\"maxPrice\":\"307.81241042\"}}",
type: :invalid_order
},
"filter_lotsize_maxqty" => %{
description: "{\"errorCode\":\"filter_lotsize_maxqty\",\"errorMessage\":\"LOT_SIZE filter failed, quantity more than maxQty\",\"errorData\":{\"maxQty\":\"5000.00\"}}",
type: :invalid_order
},
"filter_notional_min" => %{
description: "{\"errorCode\":\"filter_notional_min\",\"errorMessage\":\"NOTIONAL filter failed, Notional value of quote asset less than minNotional\",\"errorData\":{\"minNotional\":\"100.00000000\"}}",
type: :invalid_order
},
"invalid_order_id" => %{
description: "{\"success\":false,\"err\":{\"msg\":\"Invalid order id\",\"code\":\"invalid_order_id\"}}",
type: :invalid_order
},
"invalid_position_id" => %{
description: "{\"errorCode\":\"invalid_position_id\",\"errorMessage\":\"Position id is invalid\"}",
type: :invalid_order
},
"leverage_higher_than_capped_leverage" => %{
description: "{\"errorCode\":\"leverage_higher_than_capped_leverage\",\"errorMessage\":\"Leverage higher than capped leverage\",\"errorData\":{\"cappedLeverage\":\"25\"}}",
type: :invalid_parameters
},
"missing_auth_signature" => %{
description: "Missing auth signature",
type: :invalid_credentials
},
"no_open_orders" => %{
description: "{\"errorMessage\":\"No open orders found\",\"errorCode\":\"no_open_orders\"}",
type: :invalid_order
},
"order_rejected" => %{
description: "{\"success\":false,\"err\":{\"msg\":\"Order has already been rejected\",\"code\":\"order_rejected\"}}",
type: :invalid_order
},
"position_inactive" => %{
description: "{\"errorCode\":\"position_inactive\",\"errorMessage\":\"Position is already inactive\"}",
type: :invalid_order
}
},
error_codes: %{
404 => :invalid_parameters,
"Bad Request" => :invalid_parameters,
"Internal server error" => :exchange_error,
"active_position_not_found" => :invalid_order,
"failed_index_price_up_multiplier_filter" => :invalid_order,
"filter_lotsize_maxqty" => :invalid_order,
"filter_notional_min" => :invalid_order,
"invalid_order_id" => :invalid_order,
"invalid_position_id" => :invalid_order,
"leverage_higher_than_capped_leverage" => :invalid_parameters,
"missing_auth_signature" => :invalid_credentials,
"no_open_orders" => :invalid_order,
"order_rejected" => :invalid_order,
"position_inactive" => :invalid_order
},
exceptions: %{
broad: %{
"Bad Request" => :bad_request
},
exact: %{
"404" => :bad_request,
"Internal server error" => :exchange_error,
"active_position_not_found" => :invalid_order,
"failed_index_price_up_multiplier_filter" => :invalid_order,
"filter_lotsize_maxqty" => :invalid_order,
"filter_notional_min" => :invalid_order,
"invalid_order_id" => :invalid_order,
"invalid_position_id" => :invalid_order,
"leverage_higher_than_capped_leverage" => :bad_request,
"missing_auth_signature" => :authentication_error,
"no_open_orders" => :invalid_order,
"order_rejected" => :invalid_order,
"position_inactive" => :invalid_order
}
},
exchange_options: %{
"defaultNetworkCodeReplacements" => %{
"BRC20" => %{
"BRC20" => "BTC"
},
"CRO" => %{
"CRC20" => "CRONOS"
},
"ETH" => %{
"ERC20" => "ETH"
},
"TRX" => %{
"TRC20" => "TRX"
}
},
"networksById" => %{},
"sandboxMode" => false
},
extended_metadata: %{
limits: %{
"amount" => %{},
"cost" => %{},
"leverage" => %{},
"price" => %{}
},
logo_url: "https://github.com/user-attachments/assets/4e92bace-d7a9-45ea-92be-122168dc87e4",
referral_url: "https://app.defx.com/join/6I2CZ7"
},
extracted_metadata: %{
ccxt_version: "4.5.42"
},
features: %{
for_derivatives: %{
create_order: %{
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: false,
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: %{
limit: 1000,
margin_mode: false,
symbol_required: false
},
fetch_ohlcv: %{
limit: 1000
},
fetch_open_orders: %{
limit: 100,
margin_mode: true,
symbol_required: false,
trailing: false,
trigger: false
},
fetch_order: %{
margin_mode: false,
symbol_required: false,
trailing: false,
trigger: false
},
fetch_orders: %{
days_back: 100000,
limit: 500,
margin_mode: false,
symbol_required: false,
trailing: false,
trigger: false,
until_days: 100000
},
sandbox: true
},
future: %{},
swap: %{
linear: %{
extends: "forDerivatives"
}
}
},
fees: %{
trading: %{
maker: 0.0002,
percentage: true,
taker: 0.0005,
tier_based: true
}
},
forward_aliases: nil,
handle_content_type_application_zip: nil,
handle_errors_source: "handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {\n if (!response) {\n return undefined; // fallback to default error handler\n }\n // {\"errorCode\":404,\"errorMessage\":\"Not Found\"}\n // {\"msg\":\"Missing auth signature\",\"code\":\"missing_auth_signature\"}\n // {\"success\":false,\"err\":{\"msg\":\"Invalid order id\",\"code\":\"invalid_order_id\"}}\n const success = this.safeBool(response, 'success');\n const err = this.safeDict(response, 'err', response);\n const errorCode = this.safeString2(err, 'errorCode', 'code');\n if (!success) {\n const feedback = this.id + ' ' + this.json(response);\n this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);\n this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);\n }\n return undefined;\n }",
has: %{
add_margin: true,
borrow_cross_margin: false,
borrow_isolated_margin: false,
borrow_margin: false,
c_o_r_s: false,
cancel_all_orders: true,
cancel_all_orders_after: false,
cancel_all_orders_ws: false,
cancel_order: true,
cancel_order_with_client_order_id: false,
cancel_order_ws: false,
cancel_orders: false,
cancel_orders_with_client_order_id: false,
cancel_orders_ws: false,
cancel_withdraw: false,
close_all_positions: true,
close_position: true,
create_convert_trade: 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: false,
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: true,
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: true,
create_take_profit_order_ws: false,
create_trailing_amount_order: false,
create_trailing_amount_order_ws: false,
create_trailing_percent_order: false,
create_trailing_percent_order_ws: false,
create_trigger_order: true,
create_trigger_order_ws: false,
deposit: false,
edit_order: true,
edit_order_with_client_order_id: false,
edit_order_ws: false,
edit_orders: false,
fetch_a_d_l_rank: 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: true,
fetch_closed_order: false,
fetch_closed_orders: true,
fetch_closed_orders_ws: false,
fetch_convert_currencies: false,
fetch_convert_quote: false,
fetch_convert_trade: false,
fetch_convert_trade_history: false,
fetch_cross_borrow_rate: false,
fetch_cross_borrow_rates: false,
fetch_currencies: false,
fetch_currencies_ws: true,
fetch_deposit: false,
fetch_deposit_address: false,
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: false,
fetch_greeks: false,
fetch_index_ohlcv: false,
fetch_isolated_borrow_rate: false,
fetch_isolated_borrow_rates: false,
fetch_isolated_positions: false,
fetch_l2_order_book: true,
fetch_l3_order_book: false,
fetch_last_prices: false,
fetch_ledger: true,
fetch_ledger_entry: false,
fetch_leverage: false,
fetch_leverage_tiers: false,
fetch_leverages: false,
fetch_liquidations: false,
fetch_long_short_ratio: false,
fetch_long_short_ratio_history: false,
fetch_margin_adjustment_history: false,
fetch_margin_mode: false,
fetch_margin_modes: false,
fetch_mark_ohlcv: false,
fetch_mark_price: false,
fetch_mark_prices: false,
fetch_market_leverage_tiers: false,
fetch_markets: true,
fetch_markets_ws: false,
fetch_my_liquidations: false,
fetch_my_settlement_history: false,
fetch_my_trades: true,
fetch_my_trades_ws: false,
fetch_ohlcv: true,
fetch_ohlcv_ws: false,
fetch_open_interest: false,
fetch_open_interest_history: false,
fetch_open_interests: false,
fetch_open_order: false,
fetch_open_orders: true,
fetch_open_orders_ws: false,
fetch_option: false,
fetch_option_chain: false,
fetch_order: true,
fetch_order_book: true,
fetch_order_book_ws: false,
fetch_order_books: false,
fetch_order_trades: false,
fetch_order_with_client_order_id: false,
fetch_order_ws: false,
fetch_orders: true,
fetch_orders_by_status: false,
fetch_orders_ws: false,
fetch_position: true,
fetch_position_a_d_l_rank: false,
fetch_position_history: false,
fetch_position_mode: false,
fetch_position_ws: false,
fetch_positions: true,
fetch_positions_a_d_l_rank: false,
fetch_positions_for_symbol: false,
fetch_positions_for_symbol_ws: false,
fetch_positions_history: false,
fetch_positions_risk: false,
fetch_positions_ws: false,
fetch_premium_index_ohlcv: false,
fetch_settlement_history: false,
fetch_status: true,
fetch_ticker: true,
fetch_ticker_ws: false,
fetch_tickers: true,
fetch_tickers_ws: false,
fetch_time: true,
fetch_trades: true,
fetch_trades_ws: false,
fetch_trading_fee: 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: false,
private_api: true,
public_api: true,
reduce_margin: false,
repay_cross_margin: false,
repay_isolated_margin: false,
sandbox: true,
set_leverage: true,
set_margin: false,
set_margin_mode: false,
set_position_mode: false,
sign_in: false,
spot: false,
swap: true,
transfer: false,
un_watch_my_trades: false,
un_watch_ohlcv: false,
un_watch_ohlcv_for_symbols: false,
un_watch_order_book: false,
un_watch_order_book_for_symbols: false,
un_watch_orders: false,
un_watch_positions: false,
un_watch_ticker: false,
un_watch_tickers: false,
un_watch_trades: false,
un_watch_trades_for_symbols: false,
watch_balance: true,
watch_bids_asks: true,
watch_liquidations: false,
watch_liquidations_for_symbols: false,
watch_my_liquidations: false,
watch_my_liquidations_for_symbols: false,
watch_my_trades: false,
watch_ohlcv: true,
watch_ohlcv_for_symbols: true,
watch_order_book: true,
watch_order_book_for_symbols: true,
watch_orders: true,
watch_orders_for_symbols: false,
watch_position: false,
watch_positions: false,
watch_status: false,
watch_ticker: true,
watch_tickers: true,
watch_trades: true,
watch_trades_for_symbols: true,
withdraw: true,
ws: false
},
http_config: nil,
id: "defx",
markets: nil,
name: "Defx X",
ohlcv_timestamp_resolution: :milliseconds,
options: %{
sandbox_mode: false
},
order_mappings: %{
side_format: :uppercase,
side_key: "side",
type_format: :uppercase,
type_key: "type"
},
param_mappings: %{
"amount" => "quantity",
"code" => "asset",
"id" => "orderId",
"limit" => "level",
"since" => "startTime",
"symbol" => "symbols",
"takeProfitPrice" => "stopPrice",
"timeframe" => "interval",
"triggerPrice" => "stopPrice"
},
parse_methods: [
%{
"comment" => nil,
"examples" => [],
"line_end" => 1249,
"line_start" => 1237,
"mappings" => [],
"name" => "parseBalance",
"signature" => "parseBalance (balances): Balances",
"source" => "parseBalance (balances): Balances {\n const result: Dict = {\n 'info': balances,\n };\n for (let i = 0; i < balances.length; i++) {\n const balance = balances[i];\n const code = this.safeCurrencyCode (this.safeString (balance, 'asset'));\n const account = this.account ();\n account['total'] = this.safeString (balance, 'balance');\n result[code] = account;\n }\n return this.safeBalance (result);\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"markPrice\": \"100.00\",\n \"indexPrice\": \"100.00\",\n \"ltp\": \"101.34\",\n \"movingFundingRate\": \"0.08\",\n \"payoutFundingRate\": \"-0.03\",\n \"nextFundingPayout\": 1711555532146\n }"
],
"line_end" => 1210,
"line_start" => 1174,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "contract"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "market['symbol']"
},
%{
"comment" => nil,
"key" => "markPrice",
"value" => "markPrice"
},
%{
"comment" => nil,
"key" => "indexPrice",
"value" => "indexPrice"
},
%{
"comment" => nil,
"key" => "interestRate",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "estimatedSettlePrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "fundingRate",
"value" => "this.parseNumber (fundingRate)"
},
%{
"comment" => nil,
"key" => "fundingTimestamp",
"value" => "fundingTime"
},
%{
"comment" => nil,
"key" => "fundingDatetime",
"value" => "this.iso8601 (fundingTime)"
},
%{
"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 // \"markPrice\": \"100.00\",\n // \"indexPrice\": \"100.00\",\n // \"ltp\": \"101.34\",\n // \"movingFundingRate\": \"0.08\",\n // \"payoutFundingRate\": \"-0.03\",\n // \"nextFundingPayout\": 1711555532146\n // }\n //\n const markPrice = this.safeNumber (contract, 'markPrice');\n const indexPrice = this.safeNumber (contract, 'indexPrice');\n const fundingRateRaw = this.safeString (contract, 'payoutFundingRate');\n const fundingRate = Precise.stringDiv (fundingRateRaw, '100');\n const fundingTime = this.safeInteger (contract, 'nextFundingPayout');\n return {\n 'info': contract,\n 'symbol': market['symbol'],\n 'markPrice': markPrice,\n 'indexPrice': indexPrice,\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'fundingRate': this.parseNumber (fundingRate),\n 'fundingTimestamp': fundingTime,\n 'fundingDatetime': this.iso8601 (fundingTime),\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 \"id\": \"01JCSZS6H5VQND3GF5P98SJ29C\",\n \"timestamp\": 1731744012054,\n \"type\": \"FundingFee\",\n \"amount\": \"0.02189287\",\n \"asset\": \"USDC\",\n \"operation\": \"CREDIT\"\n }"
],
"line_end" => 1962,
"line_start" => 1928,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "item"
},
%{
"comment" => nil,
"key" => "id",
"value" => "this.safeString (item, 'id')"
},
%{
"comment" => nil,
"key" => "direction",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "account",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "referenceAccount",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "referenceId",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "type",
"value" => "this.parseLedgerEntryType (type)"
},
%{
"comment" => nil,
"key" => "currency",
"value" => "code"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "this.parseNumber (amount)"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "timestamp"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "this.iso8601 (timestamp)"
},
%{
"comment" => nil,
"key" => "before",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "after",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "status",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "fee",
"value" => "undefined"
}
],
"name" => "parseLedgerEntry",
"signature" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry",
"source" => "parseLedgerEntry (item: Dict, currency: Currency = undefined): LedgerEntry {\n //\n // {\n // \"id\": \"01JCSZS6H5VQND3GF5P98SJ29C\",\n // \"timestamp\": 1731744012054,\n // \"type\": \"FundingFee\",\n // \"amount\": \"0.02189287\",\n // \"asset\": \"USDC\",\n // \"operation\": \"CREDIT\"\n // }\n //\n const amount = this.safeString (item, 'amount');\n const currencyId = this.safeString (item, 'asset');\n const code = this.safeCurrencyCode (currencyId, currency);\n currency = this.safeCurrency (currencyId, currency);\n const timestamp = this.safeInteger (item, 'timestamp');\n const type = this.safeString (item, 'type');\n return this.safeLedgerEntry ({\n 'info': item,\n 'id': this.safeString (item, 'id'),\n 'direction': undefined,\n 'account': undefined,\n 'referenceAccount': undefined,\n 'referenceId': undefined,\n 'type': this.parseLedgerEntryType (type),\n 'currency': code,\n 'amount': this.parseNumber (amount),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'before': undefined,\n 'after': undefined,\n 'status': undefined,\n 'fee': undefined,\n }, currency) as LedgerEntry;\n }"
},
%{
"comment" => nil,
"examples" => [],
"line_end" => 1976,
"line_start" => 1964,
"mappings" => [],
"name" => "parseLedgerEntryType",
"signature" => "parseLedgerEntryType (type)",
"source" => "parseLedgerEntryType (type) {\n const ledgerType: Dict = {\n 'FundingFee': 'fee',\n 'FeeRebate': 'fee',\n 'FeeKickback': 'fee',\n 'RealizedPnl': 'trade',\n 'LiquidationClearance': 'trade',\n 'Transfer': 'transfer',\n 'ReferralPayout': 'referral',\n 'Commission': 'commission',\n };\n return this.safeString (ledgerType, type, type);\n }"
},
%{
"comment" => nil,
"examples" => [
"\"data\": {\n \"leverage\": \"11\",\n \"symbol\": \"BTC_USDC\"\n }"
],
"line_end" => 2091,
"line_start" => 2075,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "leverage"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "this.safeSymbol (marketId, market)"
},
%{
"comment" => nil,
"key" => "marginMode",
"value" => "undefined"
},
%{
"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 //\n // \"data\": {\n // \"leverage\": \"11\",\n // \"symbol\": \"BTC_USDC\"\n // }\n //\n const marketId = this.safeString (leverage, 'symbol');\n const leverageValue = this.safeInteger (leverage, 'leverage');\n return {\n 'info': leverage,\n 'symbol': this.safeSymbol (marketId, market),\n 'marginMode': undefined,\n 'longLeverage': leverageValue,\n 'shortLeverage': leverageValue,\n } as Leverage;\n }"
},
%{
"comment" => nil,
"examples" => [],
"line_end" => 656,
"line_start" => 586,
"mappings" => [
%{
"comment" => nil,
"key" => "id",
"value" => "marketId"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "symbol"
},
%{
"comment" => nil,
"key" => "base",
"value" => "base"
},
%{
"comment" => nil,
"key" => "quote",
"value" => "quote"
},
%{
"comment" => nil,
"key" => "settle",
"value" => "quote"
},
%{
"comment" => nil,
"key" => "baseId",
"value" => "baseId"
},
%{
"comment" => nil,
"key" => "quoteId",
"value" => "quoteId"
},
%{
"comment" => nil,
"key" => "settleId",
"value" => "quoteId"
},
%{
"comment" => nil,
"key" => "type",
"value" => "'swap'"
},
%{
"comment" => nil,
"key" => "spot",
"value" => "false"
},
%{
"comment" => nil,
"key" => "margin",
"value" => "false"
},
%{
"comment" => nil,
"key" => "swap",
"value" => "true"
},
%{
"comment" => nil,
"key" => "future",
"value" => "false"
},
%{
"comment" => nil,
"key" => "option",
"value" => "false"
},
%{
"comment" => nil,
"key" => "active",
"value" => "this.safeString (market, 'status', '') === 'active'"
},
%{
"comment" => nil,
"key" => "contract",
"value" => "true"
},
%{
"comment" => nil,
"key" => "linear",
"value" => "true"
},
%{
"comment" => nil,
"key" => "inverse",
"value" => "false"
},
%{
"comment" => nil,
"key" => "taker",
"value" => "this.safeNumber (fees, 'taker')"
},
%{
"comment" => nil,
"key" => "maker",
"value" => "this.safeNumber (fees, 'maker')"
},
%{
"comment" => nil,
"key" => "contractSize",
"value" => "this.parseNumber ('1')"
},
%{
"comment" => nil,
"key" => "expiry",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "expiryDatetime",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "strike",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "optionType",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "precision",
"value" => "{\n 'amount': this.safeNumber (lotFilter, 'stepSize'),\n 'price': this.safeNumber (priceFilter, 'tickSize'),\n }"
},
%{
"comment" => nil,
"key" => "limits",
"value" => "{\n 'leverage': {\n 'min': undefined,\n 'max': this.safeNumber (market, 'cappedLeverage'),\n },\n 'amount': {\n 'min': this.safeNumber (lotFilter, 'minQty'),\n 'max': this.safeNumber (lotFilter, 'maxQty'),\n },\n 'price': {\n 'min': this.safeNumber (priceFilter, 'minPrice'),\n 'max': this.safeNumber (priceFilter, 'maxPrice'),\n },\n 'cost': {\n 'min': this.safeNumber (notionalFilter, 'minNotional'),\n 'max': undefined,\n },\n 'market': {\n 'min': this.safeNumber (marketLotFilter, 'minQty'),\n 'max': this.safeNumber (marketLotFilter, 'maxQty'),\n },\n }"
},
%{
"comment" => nil,
"key" => "created",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "info",
"value" => "market"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "this.safeNumber (lotFilter, 'stepSize')"
},
%{
"comment" => nil,
"key" => "price",
"value" => "this.safeNumber (priceFilter, 'tickSize')"
},
%{
"comment" => nil,
"key" => "leverage",
"value" => "{\n 'min': undefined,\n 'max': this.safeNumber (market, 'cappedLeverage'),\n }"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "{\n 'min': this.safeNumber (lotFilter, 'minQty'),\n 'max': this.safeNumber (lotFilter, 'maxQty'),\n }"
},
%{
"comment" => nil,
"key" => "price",
"value" => "{\n 'min': this.safeNumber (priceFilter, 'minPrice'),\n 'max': this.safeNumber (priceFilter, 'maxPrice'),\n }"
},
%{
"comment" => nil,
"key" => "cost",
"value" => "{\n 'min': this.safeNumber (notionalFilter, 'minNotional'),\n 'max': undefined,\n }"
},
%{
"comment" => nil,
"key" => "market",
"value" => "{\n 'min': this.safeNumber (marketLotFilter, 'minQty'),\n 'max': this.safeNumber (marketLotFilter, 'maxQty'),\n }"
},
%{
"comment" => nil,
"key" => "min",
"value" => "this.safeNumber (lotFilter, 'minQty')"
},
%{
"comment" => nil,
"key" => "max",
"value" => "this.safeNumber (lotFilter, 'maxQty')"
},
%{
"comment" => nil,
"key" => "min",
"value" => "this.safeNumber (priceFilter, 'minPrice')"
},
%{
"comment" => nil,
"key" => "max",
"value" => "this.safeNumber (priceFilter, 'maxPrice')"
},
%{
"comment" => nil,
"key" => "min",
"value" => "this.safeNumber (notionalFilter, 'minNotional')"
},
%{
"comment" => nil,
"key" => "max",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "min",
"value" => "this.safeNumber (marketLotFilter, 'minQty')"
},
%{
"comment" => nil,
"key" => "max",
"value" => "this.safeNumber (marketLotFilter, 'maxQty')"
}
],
"name" => "parseMarket",
"signature" => "parseMarket (market: Dict): Market",
"source" => "parseMarket (market: Dict): Market {\n const marketId = this.safeString (market, 'market');\n const parts = marketId.split ('_');\n const baseId = this.safeString (parts, 0);\n const quoteId = this.safeString (parts, 1);\n const base = this.safeCurrencyCode (baseId);\n const quote = this.safeCurrencyCode (quoteId);\n const symbol = base + '/' + quote + ':' + quote;\n const filters = this.safeList (market, 'filters', []);\n const fees = this.safeDict (market, 'fees', {});\n const filtersByType = this.indexBy (filters, 'filterType');\n const priceFilter = this.safeDict (filtersByType, 'PRICE_FILTER', {});\n const lotFilter = this.safeDict (filtersByType, 'LOT_SIZE', {});\n const marketLotFilter = this.safeDict (filtersByType, 'MARKET_LOT_SIZE', {});\n const notionalFilter = this.safeDict (filtersByType, 'NOTIONAL', {});\n return {\n 'id': marketId,\n 'symbol': symbol,\n 'base': base,\n 'quote': quote,\n 'settle': quote,\n 'baseId': baseId,\n 'quoteId': quoteId,\n 'settleId': quoteId,\n 'type': 'swap',\n 'spot': false,\n 'margin': false,\n 'swap': true,\n 'future': false,\n 'option': false,\n 'active': this.safeString (market, 'status', '') === 'active',\n 'contract': true,\n 'linear': true,\n 'inverse': false,\n 'taker': this.safeNumber (fees, 'taker'),\n 'maker': this.safeNumber (fees, 'maker'),\n 'contractSize': this.parseNumber ('1'),\n 'expiry': undefined,\n 'expiryDatetime': undefined,\n 'strike': undefined,\n 'optionType': undefined,\n 'precision': {\n 'amount': this.safeNumber (lotFilter, 'stepSize'),\n 'price': this.safeNumber (priceFilter, 'tickSize'),\n },\n 'limits': {\n 'leverage': {\n 'min': undefined,\n 'max': this.safeNumber (market, 'cappedLeverage'),\n },\n 'amount': {\n 'min': this.safeNumber (lotFilter, 'minQty'),\n 'max': this.safeNumber (lotFilter, 'maxQty'),\n },\n 'price': {\n 'min': this.safeNumber (priceFilter, 'minPrice'),\n 'max': this.safeNumber (priceFilter, 'maxPrice'),\n },\n 'cost': {\n 'min': this.safeNumber (notionalFilter, 'minNotional'),\n 'max': undefined,\n },\n 'market': {\n 'min': this.safeNumber (marketLotFilter, 'minQty'),\n 'max': this.safeNumber (marketLotFilter, 'maxQty'),\n },\n },\n 'created': undefined,\n 'info': market,\n };\n }"
},
%{
"comment" => nil,
"examples" => [],
"line_end" => 915,
"line_start" => 905,
"mappings" => [],
"name" => "parseOHLCV",
"signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV",
"source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n // example response in fetchOHLCV\n return [\n this.safeInteger (ohlcv, 'start'),\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 \"orderId\": \"746472647227344528\",\n \"createdAt\": \"2024-10-25T16:49:31.077Z\",\n \"updatedAt\": \"2024-10-25T16:49:31.378Z\",\n \"clientOrderId\": \"0192c495-49c3-71ee-b3d3-7442a2090807\",\n \"reduceOnly\": false,\n \"side\": \"SELL\",\n \"status\": \"FILLED\",\n \"symbol\": \"SOL_USDC\",\n \"timeInForce\": \"GTC\",\n \"type\": \"MARKET\",\n \"origQty\": \"0.80\",\n \"executedQty\": \"0.80\",\n \"cumulativeQuote\": \"137.87440000\",\n \"avgPrice\": \"172.34300000\",\n \"totalPnL\": \"0.00000000\",\n \"totalFee\": \"0.07583092\",\n \"workingType\": null,\n \"postOnly\": false,\n \"linkedOrderParentType\": null,\n \"isTriggered\": false,\n \"slippagePercentage\": \"5\"\n }"
],
"line_end" => 1442,
"line_start" => 1362,
"mappings" => [
%{
"comment" => nil,
"key" => "id",
"value" => "orderId"
},
%{
"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" => "lastTradeTimestamp"
},
%{
"comment" => nil,
"key" => "lastUpdateTimestamp",
"value" => "lastTradeTimestamp"
},
%{
"comment" => nil,
"key" => "status",
"value" => "this.parseOrderStatus (status)"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "symbol"
},
%{
"comment" => nil,
"key" => "type",
"value" => "orderType"
},
%{
"comment" => nil,
"key" => "timeInForce",
"value" => "timeInForce"
},
%{
"comment" => nil,
"key" => "postOnly",
"value" => "this.safeBool (order, 'postOnly')"
},
%{
"comment" => nil,
"key" => "reduceOnly",
"value" => "this.safeBool (order, 'reduceOnly')"
},
%{
"comment" => nil,
"key" => "side",
"value" => "side"
},
%{
"comment" => nil,
"key" => "price",
"value" => "price"
},
%{
"comment" => nil,
"key" => "triggerPrice",
"value" => "triggerPrice"
},
%{
"comment" => nil,
"key" => "takeProfitPrice",
"value" => "takeProfitPrice"
},
%{
"comment" => nil,
"key" => "stopLossPrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "average",
"value" => "average"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "amount"
},
%{
"comment" => nil,
"key" => "filled",
"value" => "filled"
},
%{
"comment" => nil,
"key" => "remaining",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "cost",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "trades",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "fee",
"value" => "{\n 'cost': this.safeString (order, 'totalFee'),\n 'currency': 'USDC',\n }"
},
%{
"comment" => nil,
"key" => "info",
"value" => "order"
},
%{
"comment" => nil,
"key" => "cost",
"value" => "this.safeString (order, 'totalFee')"
},
%{
"comment" => nil,
"key" => "currency",
"value" => "'USDC'"
}
],
"name" => "parseOrder",
"signature" => "parseOrder (order: Dict, market: Market = undefined): Order",
"source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // {\n // \"orderId\": \"746472647227344528\",\n // \"createdAt\": \"2024-10-25T16:49:31.077Z\",\n // \"updatedAt\": \"2024-10-25T16:49:31.378Z\",\n // \"clientOrderId\": \"0192c495-49c3-71ee-b3d3-7442a2090807\",\n // \"reduceOnly\": false,\n // \"side\": \"SELL\",\n // \"status\": \"FILLED\",\n // \"symbol\": \"SOL_USDC\",\n // \"timeInForce\": \"GTC\",\n // \"type\": \"MARKET\",\n // \"origQty\": \"0.80\",\n // \"executedQty\": \"0.80\",\n // \"cumulativeQuote\": \"137.87440000\",\n // \"avgPrice\": \"172.34300000\",\n // \"totalPnL\": \"0.00000000\",\n // \"totalFee\": \"0.07583092\",\n // \"workingType\": null,\n // \"postOnly\": false,\n // \"linkedOrderParentType\": null,\n // \"isTriggered\": false,\n // \"slippagePercentage\": \"5\"\n // }\n //\n const orderId = this.safeString (order, 'orderId');\n const clientOrderId = this.safeString (order, 'clientOrderId');\n const marketId = this.safeString (order, 'symbol');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n const price = this.safeString (order, 'price');\n const amount = this.safeString (order, 'origQty');\n const orderType = this.safeStringLower (order, 'type');\n const status = this.safeString (order, 'status');\n const side = this.safeStringLower (order, 'side');\n const filled = this.omitZero (this.safeString (order, 'executedQty'));\n const average = this.omitZero (this.safeString (order, 'avgPrice'));\n const timeInForce = this.safeStringLower (order, 'timeInForce');\n let takeProfitPrice: Str = undefined;\n let triggerPrice: Str = undefined;\n if (orderType !== undefined) {\n if (orderType.indexOf ('take_profit') >= 0) {\n takeProfitPrice = this.safeString (order, 'stopPrice');\n } else {\n triggerPrice = this.safeString (order, 'stopPrice');\n }\n }\n const timestamp = this.parse8601 (this.safeString (order, 'createdAt'));\n const lastTradeTimestamp = this.parse8601 (this.safeString (order, 'updatedAt'));\n return this.safeOrder ({\n 'id': orderId,\n 'clientOrderId': clientOrderId,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': lastTradeTimestamp,\n 'lastUpdateTimestamp': lastTradeTimestamp,\n 'status': this.parseOrderStatus (status),\n 'symbol': symbol,\n 'type': orderType,\n 'timeInForce': timeInForce,\n 'postOnly': this.safeBool (order, 'postOnly'),\n 'reduceOnly': this.safeBool (order, 'reduceOnly'),\n 'side': side,\n 'price': price,\n 'triggerPrice': triggerPrice,\n 'takeProfitPrice': takeProfitPrice,\n 'stopLossPrice': undefined,\n 'average': average,\n 'amount': amount,\n 'filled': filled,\n 'remaining': undefined,\n 'cost': undefined,\n 'trades': undefined,\n 'fee': {\n 'cost': this.safeString (order, 'totalFee'),\n 'currency': 'USDC',\n },\n 'info': order,\n }, market);\n }"
},
%{
"comment" => nil,
"examples" => [],
"line_end" => 1360,
"line_start" => 1348,
"mappings" => [],
"name" => "parseOrderStatus",
"signature" => "parseOrderStatus (status: Str)",
"source" => "parseOrderStatus (status: Str) {\n if (status !== undefined) {\n const statuses: Dict = {\n 'NEW': 'open',\n 'OPEN': 'open',\n 'CANCELLED': 'canceled',\n 'REJECTED': 'rejected',\n 'FILLED': 'closed',\n };\n return this.safeString (statuses, status, status);\n }\n return status;\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"positionId\": \"0192c495-4a68-70ee-9081-9d368bd16dfc\",\n \"symbol\": \"SOL_USDC\",\n \"positionSide\": \"SHORT\",\n \"entryPrice\": \"172.34300000\",\n \"quantity\": \"0.80\",\n \"marginAmount\": \"20.11561173\",\n \"marginAsset\": \"USDC\",\n \"pnl\": \"0.00000000\"\n }"
],
"line_end" => 1635,
"line_start" => 1585,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "position"
},
%{
"comment" => nil,
"key" => "id",
"value" => "this.safeString (position, 'positionId')"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "market['symbol']"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "lastUpdateTimestamp",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "initialMargin",
"value" => "this.parseNumber (initialMargin)"
},
%{
"comment" => nil,
"key" => "initialMarginPercentage",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "maintenanceMargin",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "maintenanceMarginPercentage",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "entryPrice",
"value" => "this.parseNumber (entryPrice)"
},
%{
"comment" => nil,
"key" => "notional",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "leverage",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "unrealizedPnl",
"value" => "this.parseNumber (unrealisedPnl)"
},
%{
"comment" => nil,
"key" => "realizedPnl",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "contracts",
"value" => "this.parseNumber (size)"
},
%{
"comment" => nil,
"key" => "contractSize",
"value" => "this.safeNumber (market, 'contractSize')"
},
%{
"comment" => nil,
"key" => "marginRatio",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "liquidationPrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "markPrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "lastPrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "collateral",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "marginMode",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "side",
"value" => "side"
},
%{
"comment" => nil,
"key" => "percentage",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "stopLossPrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "takeProfitPrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "hedged",
"value" => "undefined"
}
],
"name" => "parsePosition",
"signature" => "parsePosition (position: Dict, market: Market = undefined)",
"source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // {\n // \"positionId\": \"0192c495-4a68-70ee-9081-9d368bd16dfc\",\n // \"symbol\": \"SOL_USDC\",\n // \"positionSide\": \"SHORT\",\n // \"entryPrice\": \"172.34300000\",\n // \"quantity\": \"0.80\",\n // \"marginAmount\": \"20.11561173\",\n // \"marginAsset\": \"USDC\",\n // \"pnl\": \"0.00000000\"\n // }\n //\n const marketId = this.safeString (position, 'symbol');\n market = this.safeMarket (marketId, market);\n const size = Precise.stringAbs (this.safeString (position, 'quantity'));\n const side = this.safeStringLower (position, 'positionSide');\n const unrealisedPnl = this.omitZero (this.safeString (position, 'pnl'));\n const entryPrice = this.omitZero (this.safeString (position, 'entryPrice'));\n const initialMargin = this.safeString (position, 'marginAmount');\n return this.safePosition ({\n 'info': position,\n 'id': this.safeString (position, 'positionId'),\n 'symbol': market['symbol'],\n 'timestamp': undefined,\n 'datetime': undefined,\n 'lastUpdateTimestamp': undefined,\n 'initialMargin': this.parseNumber (initialMargin),\n 'initialMarginPercentage': undefined,\n 'maintenanceMargin': undefined,\n 'maintenanceMarginPercentage': undefined,\n 'entryPrice': this.parseNumber (entryPrice),\n 'notional': undefined,\n 'leverage': undefined,\n 'unrealizedPnl': this.parseNumber (unrealisedPnl),\n 'realizedPnl': undefined,\n 'contracts': this.parseNumber (size),\n 'contractSize': this.safeNumber (market, 'contractSize'),\n 'marginRatio': undefined,\n 'liquidationPrice': undefined,\n 'markPrice': undefined,\n 'lastPrice': undefined,\n 'collateral': undefined,\n 'marginMode': undefined,\n 'side': side,\n 'percentage': undefined,\n 'stopLossPrice': undefined,\n 'takeProfitPrice': undefined,\n 'hedged': undefined,\n });\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"symbol\": \"BTC_USDC\",\n \"priceChange\": \"0\",\n \"priceChangePercent\": \"0\",\n \"weightedAvgPrice\": \"0\",\n \"lastPrice\": \"2.00\",\n \"lastQty\": \"10.000\",\n \"bestBidPrice\": \"1646.00\",\n \"bestBidQty\": \"10.000\",\n \"bestAskPrice\": \"1646.00\",\n \"bestAskQty\": \"10.000\",\n \"openPrice\": \"0.00\",\n \"highPrice\": \"0.00\",\n \"lowPrice\": \"0.00\",\n \"volume\": \"0.000\",\n \"quoteVolume\": \"0.00\",\n \"openTime\": 1700142658697,\n \"closeTime\": 1700142658697,\n \"openInterestBase\": \"1.000\",\n \"openInterestQuote\": \"0.43112300\"\n }",
"\"ETH_USDC\": {\n \"priceChange\": \"0\",\n \"priceChangePercent\": \"0\",\n \"openPrice\": \"1646.15\",\n \"highPrice\": \"1646.15\",\n \"lowPrice\": \"1646.15\",\n \"lastPrice\": \"1646.15\",\n \"quoteVolume\": \"13.17\",\n \"volume\": \"0.008\",\n \"markPrice\": \"1645.15\"\n }",
"{\n \"markPrice\": \"100.00\",\n \"indexPrice\": \"100.00\",\n \"ltp\": \"101.34\",\n \"movingFundingRate\": \"0.08\",\n \"payoutFundingRate\": \"-0.03\",\n \"nextFundingPayout\": 1711555532146\n }"
],
"line_end" => 840,
"line_start" => 743,
"mappings" => [
%{
"comment" => nil,
"key" => "symbol",
"value" => "symbol"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "ts"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "datetime"
},
%{
"comment" => nil,
"key" => "high",
"value" => "high"
},
%{
"comment" => nil,
"key" => "low",
"value" => "low"
},
%{
"comment" => nil,
"key" => "bid",
"value" => "bid"
},
%{
"comment" => nil,
"key" => "bidVolume",
"value" => "bidVolume"
},
%{
"comment" => nil,
"key" => "ask",
"value" => "ask"
},
%{
"comment" => nil,
"key" => "askVolume",
"value" => "askVolume"
},
%{
"comment" => nil,
"key" => "vwap",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "open",
"value" => "open"
},
%{
"comment" => nil,
"key" => "close",
"value" => "close"
},
%{
"comment" => nil,
"key" => "last",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "previousClose",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "change",
"value" => "change"
},
%{
"comment" => nil,
"key" => "percentage",
"value" => "percentage"
},
%{
"comment" => nil,
"key" => "average",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "baseVolume",
"value" => "baseVolume"
},
%{
"comment" => nil,
"key" => "quoteVolume",
"value" => "quoteVolume"
},
%{
"comment" => nil,
"key" => "markPrice",
"value" => "this.safeString (ticker, 'markPrice')"
},
%{
"comment" => nil,
"key" => "indexPrice",
"value" => "this.safeString (ticker, 'indexPrice')"
},
%{
"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 // fetchTicker\n //\n // {\n // \"symbol\": \"BTC_USDC\",\n // \"priceChange\": \"0\",\n // \"priceChangePercent\": \"0\",\n // \"weightedAvgPrice\": \"0\",\n // \"lastPrice\": \"2.00\",\n // \"lastQty\": \"10.000\",\n // \"bestBidPrice\": \"1646.00\",\n // \"bestBidQty\": \"10.000\",\n // \"bestAskPrice\": \"1646.00\",\n // \"bestAskQty\": \"10.000\",\n // \"openPrice\": \"0.00\",\n // \"highPrice\": \"0.00\",\n // \"lowPrice\": \"0.00\",\n // \"volume\": \"0.000\",\n // \"quoteVolume\": \"0.00\",\n // \"openTime\": 1700142658697,\n // \"closeTime\": 1700142658697,\n // \"openInterestBase\": \"1.000\",\n // \"openInterestQuote\": \"0.43112300\"\n // }\n //\n // fetchTickers\n //\n // \"ETH_USDC\": {\n // \"priceChange\": \"0\",\n // \"priceChangePercent\": \"0\",\n // \"openPrice\": \"1646.15\",\n // \"highPrice\": \"1646.15\",\n // \"lowPrice\": \"1646.15\",\n // \"lastPrice\": \"1646.15\",\n // \"quoteVolume\": \"13.17\",\n // \"volume\": \"0.008\",\n // \"markPrice\": \"1645.15\"\n // }\n //\n // fetchMarkPrice\n //\n // {\n // \"markPrice\": \"100.00\",\n // \"indexPrice\": \"100.00\",\n // \"ltp\": \"101.34\",\n // \"movingFundingRate\": \"0.08\",\n // \"payoutFundingRate\": \"-0.03\",\n // \"nextFundingPayout\": 1711555532146\n // }\n //\n const marketId = this.safeString (ticker, 'symbol');\n if (marketId !== undefined) {\n market = this.market (marketId);\n }\n const symbol = market['symbol'];\n const open = this.safeString (ticker, 'openPrice');\n const high = this.safeString (ticker, 'highPrice');\n const low = this.safeString (ticker, 'lowPrice');\n const close = this.safeString (ticker, 'lastPrice');\n const quoteVolume = this.safeString (ticker, 'quoteVolume');\n const baseVolume = this.safeString (ticker, 'volume');\n const percentage = this.safeString (ticker, 'priceChangePercent');\n const change = this.safeString (ticker, 'priceChange');\n let ts = this.safeInteger (ticker, 'closeTime');\n if (ts === 0) {\n ts = undefined;\n }\n const datetime = this.iso8601 (ts);\n const bid = this.safeString (ticker, 'bestBidPrice');\n const bidVolume = this.safeString (ticker, 'bestBidQty');\n const ask = this.safeString (ticker, 'bestAskPrice');\n const askVolume = this.safeString (ticker, 'bestAskQty');\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': ts,\n 'datetime': datetime,\n 'high': high,\n 'low': low,\n 'bid': bid,\n 'bidVolume': bidVolume,\n 'ask': ask,\n 'askVolume': askVolume,\n 'vwap': undefined,\n 'open': open,\n 'close': close,\n 'last': undefined,\n 'previousClose': undefined,\n 'change': change,\n 'percentage': percentage,\n 'average': undefined,\n 'baseVolume': baseVolume,\n 'quoteVolume': quoteVolume,\n 'markPrice': this.safeString (ticker, 'markPrice'),\n 'indexPrice': this.safeString (ticker, 'indexPrice'),\n 'info': ticker,\n }, market);\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"buyerMaker\": \"false\",\n \"price\": \"2.0000\",\n \"qty\": \"10.0000\",\n \"symbol\": \"BTC_USDC\",\n \"timestamp\": \"1702453663894\"\n }",
"{\n \"id\": \"0192f665-c05b-7ba0-a080-8b6c99083489\",\n \"orderId\": \"757730811259651728\",\n \"time\": \"2024-11-04T08:58:36.474Z\",\n \"symbol\": \"SOL_USDC\",\n \"side\": \"SELL\",\n \"price\": \"160.43600000\",\n \"qty\": \"1.00\",\n \"fee\": \"0.08823980\",\n \"role\": \"TAKER\",\n \"pnl\": \"0.00000000\"\n }"
],
"line_end" => 1063,
"line_start" => 1001,
"mappings" => [
%{
"comment" => nil,
"key" => "id",
"value" => "id"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "timestamp"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "this.iso8601 (timestamp)"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "symbol"
},
%{
"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" => "order",
"value" => "oid"
},
%{
"comment" => nil,
"key" => "takerOrMaker",
"value" => "takerOrMaker"
},
%{
"comment" => nil,
"key" => "type",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "fee",
"value" => "{\n 'cost': this.safeString (trade, 'fee'),\n 'currency': 'USDC',\n }"
},
%{
"comment" => nil,
"key" => "info",
"value" => "trade"
}
],
"name" => "parseTrade",
"signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade",
"source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // fetchTrades\n // {\n // \"buyerMaker\": \"false\",\n // \"price\": \"2.0000\",\n // \"qty\": \"10.0000\",\n // \"symbol\": \"BTC_USDC\",\n // \"timestamp\": \"1702453663894\"\n // }\n //\n // fetchMyTrades\n // {\n // \"id\": \"0192f665-c05b-7ba0-a080-8b6c99083489\",\n // \"orderId\": \"757730811259651728\",\n // \"time\": \"2024-11-04T08:58:36.474Z\",\n // \"symbol\": \"SOL_USDC\",\n // \"side\": \"SELL\",\n // \"price\": \"160.43600000\",\n // \"qty\": \"1.00\",\n // \"fee\": \"0.08823980\",\n // \"role\": \"TAKER\",\n // \"pnl\": \"0.00000000\"\n // }\n //\n const time = this.safeString (trade, 'time');\n const timestamp = this.safeInteger (trade, 'timestamp', this.parse8601 (time));\n const marketId = this.safeString (trade, 'symbol');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n const price = this.safeString (trade, 'price');\n const amount = this.safeString (trade, 'qty');\n const id = this.safeString (trade, 'id');\n const oid = this.safeString (trade, 'orderId');\n const takerOrMaker = this.safeStringLower (trade, 'role');\n const buyerMaker = this.safeBool (trade, 'buyerMaker');\n let side = this.safeStringLower (trade, 'side');\n if (buyerMaker !== undefined) {\n if (buyerMaker) {\n side = 'sell';\n } else {\n side = 'buy';\n }\n }\n return this.safeTrade ({\n 'id': id,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': symbol,\n 'side': side,\n 'price': price,\n 'amount': amount,\n 'cost': undefined,\n 'order': oid,\n 'takerOrMaker': takerOrMaker,\n 'type': undefined,\n 'fee': {\n 'cost': this.safeString (trade, 'fee'),\n 'currency': 'USDC',\n },\n 'info': trade,\n }, market);\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"transactionId\": \"0x301e5851e5aefa733abfbc8b30817ca3b61601e0ddf1df8c59656fb888b0bc9c\"\n }"
],
"line_end" => 2039,
"line_start" => 2008,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "transaction"
},
%{
"comment" => nil,
"key" => "id",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "txid",
"value" => "txid"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "network",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "address",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "addressTo",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "addressFrom",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "tag",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "tagTo",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "tagFrom",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "type",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "currency",
"value" => "this.safeCurrencyCode (undefined, currency)"
},
%{
"comment" => nil,
"key" => "status",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "updated",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "internal",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "comment",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "fee",
"value" => "undefined"
}
],
"name" => "parseTransaction",
"signature" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction",
"source" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {\n //\n // withdraw\n //\n // {\n // \"transactionId\": \"0x301e5851e5aefa733abfbc8b30817ca3b61601e0ddf1df8c59656fb888b0bc9c\"\n // }\n //\n const txid = this.safeString (transaction, 'transactionId');\n return {\n 'info': transaction,\n 'id': undefined,\n 'txid': txid,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'network': undefined,\n 'address': undefined,\n 'addressTo': undefined,\n 'addressFrom': undefined,\n 'tag': undefined,\n 'tagTo': undefined,\n 'tagFrom': undefined,\n 'type': undefined,\n 'amount': undefined,\n 'currency': this.safeCurrencyCode (undefined, currency),\n 'status': undefined,\n 'updated': undefined,\n 'internal': undefined,\n 'comment': undefined,\n 'fee': undefined,\n };\n }"
}
],
path_prefix: "",
pro: false,
quote_json_numbers: nil,
rate_limits: %{
interval_ms: 100,
period: 1000,
requests: 10,
rolling_window_size: 60000
},
raw_endpoints: %{
private: [],
public: []
},
required_credentials: %{
api_key: true,
password: false,
secret: true,
uid: false
},
requires_eddsa: false,
response_error: %{
code_field: "error",
field: "success",
message_field: "message",
success_values: nil,
type: :success_bool
},
signing: %{
api_key_header: "X-DEFX-APIKEY",
confidence: :medium,
pattern: :hmac_sha256_headers,
signature_header: "X-DEFX-SIGNATURE",
timestamp_header: "X-DEFX-TIMESTAMP"
},
spec_format_version: 2,
status: %{
"eta" => nil,
"status" => "ok",
"updated" => nil,
"url" => nil
},
symbol_format: nil,
symbol_formats: %{
precision_mode: 4,
sample_limits: %{
"amount" => %{
"max" => 150,
"min" => 0.001
},
"cost" => %{
"min" => 10
},
"price" => %{
"max" => 10000,
"min" => 0.01
}
},
sample_precision: %{
"amount" => 0.001,
"price" => 0.01
},
swap: %{
base: "XAU",
base_id: "XAU",
case: :upper,
contract: true,
contract_size: 1,
id: "XAU_USDC",
inverse: false,
limits: %{
"amount" => %{
"max" => 150,
"min" => 0.001
},
"cost" => %{
"min" => 10
},
"leverage" => %{
"max" => 25
},
"market" => %{
"max" => 20,
"min" => 0.001
},
"price" => %{
"max" => 10000,
"min" => 0.01
}
},
linear: true,
maker: 1.0e-6,
precision: %{
"amount" => 0.001,
"price" => 0.01
},
quote: "USDC",
quote_id: "USDC",
separator: "_",
settle: "USDC",
settle_id: "USDC",
symbol: "XAU/USDC:USDC",
taker: 1.0e-6
}
},
symbol_patterns: %{
swap: %{
case: :upper,
component_order: nil,
date_format: nil,
pattern: :implicit,
prefix: nil,
separator: "_",
suffix: nil
}
},
timeframes: %{
"12h" => "12h",
"15m" => "15m",
"1M" => "1M",
"1d" => "1d",
"1h" => "1h",
"1m" => "1m",
"1w" => "1w",
"2h" => "2h",
"30m" => "30m",
"3m" => "3m",
"4h" => "4h",
"5m" => "5m"
},
url_strategy: %{
detected_from: "fallback",
pattern: :no_prefix,
prefix: nil
},
urls: %{
api: "https://api.defx.com",
api_sections: %{
"private" => "https://api.defx.com",
"public" => "https://api.defx.com"
},
doc: [
"https://docs.defx.com/docs",
"https://api-docs.defx.com/"
],
other: nil,
sandbox: %{
"private" => "https://api.testnet.defx.com",
"public" => "https://api.testnet.defx.com"
},
www: "https://defx.com/home"
},
version: "v1",
ws: %{
channel_templates: %{
watch_balance: %{
auth_required: true,
market_id_format: :native,
params: [],
pattern: :stream_based,
separator: "@"
},
watch_bids_asks: %{
market_id_format: :native,
params: [],
pattern: :stream_based,
separator: "@"
},
watch_ohlcv: %{
market_id_format: :native,
params: [
%{
"default" => nil,
"name" => "limit"
}
],
pattern: :stream_based,
separator: "@"
},
watch_ohlcv_for_symbols: %{
market_id_format: :native,
params: [
%{
"default" => nil,
"name" => "interval"
},
%{
"default" => nil,
"name" => "limit"
}
],
pattern: :stream_based,
separator: "@"
},
watch_order_book: %{
market_id_format: :native,
params: [
%{
"default" => nil,
"name" => "limit"
}
],
pattern: :stream_based,
separator: "@"
},
watch_order_book_for_symbols: %{
market_id_format: :native,
params: [
%{
"default" => nil,
"name" => "limit"
}
],
pattern: :stream_based,
separator: "@"
},
watch_orders: %{
auth_required: true,
market_id_format: :native,
params: [
%{
"default" => nil,
"name" => "limit"
}
],
pattern: :stream_based,
separator: "@"
},
watch_positions: %{
auth_required: true,
channel_name: "positions",
market_id_format: :native,
params: [
%{
"default" => nil,
"name" => "limit"
}
],
pattern: :stream_based,
separator: "@"
},
watch_public: %{
market_id_format: :native,
params: [],
pattern: :stream_based,
separator: "@"
},
watch_ticker: %{
channel_name: "symbol:",
market_id_format: :native,
params: [],
pattern: :stream_based,
separator: "@"
},
watch_tickers: %{
market_id_format: :native,
params: [],
pattern: :stream_based,
separator: "@"
},
watch_trades: %{
market_id_format: :native,
params: [
%{
"default" => nil,
"name" => "limit"
}
],
pattern: :stream_based,
separator: "@"
},
watch_trades_for_symbols: %{
market_id_format: :native,
params: [
%{
"default" => nil,
"name" => "limit"
}
],
pattern: :stream_based,
separator: "@"
}
},
has: %{
watch_balance: true,
watch_bids_asks: true,
watch_liquidations: nil,
watch_liquidations_for_symbols: nil,
watch_my_liquidations: nil,
watch_my_liquidations_for_symbols: nil,
watch_my_trades: false,
watch_ohlcv: true,
watch_ohlcv_for_symbols: true,
watch_order_book: true,
watch_order_book_for_symbols: true,
watch_orders: true,
watch_orders_for_symbols: nil,
watch_position: nil,
watch_positions: nil,
watch_status: nil,
watch_ticker: true,
watch_tickers: true,
watch_trades: true,
watch_trades_for_symbols: true
},
hostname: "defx.com",
message_patterns: [
%{
args_field: "topics",
format: :method,
keys: [
"method",
"topics"
],
kind_field: "method",
kind_value: "SUBSCRIBE",
sources: [
:send,
:watch_multiple
]
}
],
options: %{
"ws" => %{
"timeframes" => %{
"12h" => "12h",
"15m" => "15m",
"1M" => "1M",
"1d" => "1d",
"1h" => "1h",
"1m" => "1m",
"1w" => "1w",
"2h" => "2h",
"30m" => "30m",
"3m" => "3m",
"4h" => "4h",
"5m" => "5m"
}
}
},
subscription_config: %{
args_field: "params",
args_format: :string_list,
market_id_format: :native,
op_field: "method",
separator: "@"
},
subscription_pattern: :method_subscribe,
test_urls: %{
"private" => "wss://ws.testnet.defx.com/user",
"public" => "wss://stream.testnet.defx.com/pricefeed"
},
urls: %{
"private" => "wss://userfeed.api.defx.com/user",
"public" => "wss://marketfeed.api.defx.com/pricefeed"
},
watch_methods: [
"watchBalance",
"watchBidsAsks",
"watchOHLCV",
"watchOHLCVForSymbols",
"watchOrderBook",
"watchOrderBookForSymbols",
"watchOrders",
"watchPositions",
"watchPublic",
"watchTicker",
"watchTickers",
"watchTrades",
"watchTradesForSymbols"
]
}
}