Current section
Files
Jump to
Current section
Files
priv/specs/extracted/lighter.exs
# Lighter Exchange Specification
#
# Auto-generated by: mix ccxt.extract lighter
# 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: :pro,
comment: nil,
countries: [],
currencies: %{},
currency_aliases: %{
"BCHSV" => "BSV",
"XBT" => "BTC"
},
dex: true,
enable_rate_limit: true,
endpoint_extraction_stats: %{
"capturedMethods" => 10,
"coveragePercent" => 100,
"enabledMethods" => 32,
"excluded" => [],
"excludedMethods" => 0,
"extractableMethods" => 32,
"failures" => [
%{
"error" => "lighter cancelAllOrders() requires an apiKeyIndex parameter",
"method" => "cancelAllOrders"
},
%{
"error" => "lighter cancelOrder() requires an apiKeyIndex parameter",
"method" => "cancelOrder"
},
%{
"error" => "lighter createOrder() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "createLimitOrder"
},
%{
"error" => "lighter createOrder() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "createMarketOrder"
},
%{
"error" => "lighter createOrder() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "createOrder"
},
%{
"error" => "lighter editOrder() requires an apiKeyIndex parameter",
"method" => "editOrder"
},
%{
"error" => "lighter fetchAccounts() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "fetchAccounts"
},
%{
"error" => "lighter fetchBalance() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "fetchBalance"
},
%{
"error" => "lighter fetchClosedOrders() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "fetchClosedOrders"
},
%{
"error" => "lighter fetchDeposits() requires an address parameter",
"method" => "fetchDeposits"
},
%{
"error" => "lighter fetchMyTrades() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "fetchMyTrades"
},
%{
"error" => "lighter fetchOpenOrders() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "fetchOpenOrders"
},
%{
"error" => "lighter fetchPositions() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "fetchPosition"
},
%{
"error" => "lighter fetchPositions() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "fetchPositions"
},
%{
"error" => "lighter fetchTransfers() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "fetchTransfers"
},
%{
"error" => "lighter fetchWithdrawals() requires an accountIndex or account_index parameter or walletAddress to fetch accountIndex",
"method" => "fetchWithdrawals"
},
%{
"error" => "lighter setLeverage() requires an marginMode parameter",
"method" => "setLeverage"
},
%{
"error" => "lighter setMargin() requires an apiKeyIndex parameter",
"method" => "setMargin"
},
%{
"error" => "lighter modifyLeverageAndMarginMode() requires an apiKeyIndex parameter",
"method" => "setMarginMode"
},
%{
"error" => "lighter transfer() requires an apiKeyIndex parameter",
"method" => "transfer"
},
%{
"error" => "lighter withdraw() requires an apiKeyIndex parameter",
"method" => "withdraw"
},
%{
"error" => "lighter timeout should be between 5 minutes and 15 days.",
"method" => "cancelAllOrdersAfter"
}
]
},
endpoints: [
%{
api_section: "public",
auth: false,
cost: 1,
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_currencies,
param_mappings: %{},
params: [],
path: "/assetDetails",
response_transformer: {:extract_path, ["asset_details"]},
source: :intercepted
},
%{
api_section: "public",
auth: false,
cost: 1,
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_funding_rates,
param_mappings: %{},
params: [
:symbols
],
path: "/funding-rates",
response_transformer: {:extract_path, ["funding_rates"]},
source: :intercepted
},
%{
api_section: "public",
auth: false,
cost: 1,
default_params: %{
"limit" => 100
},
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_l2_order_book,
param_mappings: %{
"symbol" => "market_id"
},
params: [
:symbol,
:limit
],
path: "/orderBookOrders",
source: :intercepted
},
%{
api_section: "public",
auth: false,
cost: 1,
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_markets,
param_mappings: %{},
params: [],
path: "/orderBookDetails",
response_transformer: {:extract_path, ["order_book_details"]},
source: :intercepted
},
%{
api_section: "public",
auth: false,
cost: 1,
default_params: %{
"count_back" => 0,
"end_timestamp" => "<generated>"
},
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_ohlcv,
param_mappings: %{
"since" => "start_timestamp",
"symbol" => "market_id",
"timeframe" => "resolution"
},
params: [
:symbol,
:timeframe,
:since,
:limit
],
path: "/candles",
response_transformer: {:extract_path, ["c"]},
source: :intercepted
},
%{
api_section: "public",
auth: false,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_order_book,
param_mappings: %{
"symbol" => "market_id"
},
params: [
:symbol,
:limit
],
path: "/orderBookOrders",
source: :intercepted
},
%{
api_section: "root",
auth: false,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_status,
param_mappings: %{},
params: [],
path: "/",
source: :intercepted
},
%{
api_section: "public",
auth: false,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_ticker,
param_mappings: %{
"symbol" => "market_id"
},
params: [
:symbol
],
path: "/orderBookDetails",
response_transformer: {:extract_path_unwrap, ["order_book_details"]},
source: :intercepted
},
%{
api_section: "public",
auth: false,
cost: 1,
expects: :list,
market_type: :swap,
method: :get,
name: :fetch_tickers,
param_mappings: %{},
params: [
:symbols
],
path: "/orderBookDetails",
response_transformer: {:extract_path, ["order_book_details"]},
source: :intercepted
},
%{
api_section: "root",
auth: false,
cost: 1,
expects: :single,
market_type: :swap,
method: :get,
name: :fetch_time,
param_mappings: %{},
params: [],
path: "/",
source: :intercepted
}
],
error_code_details: %{
21500 => %{
description: "transaction not found",
type: :exchange_error
},
21501 => %{
description: "invalid tx info",
type: :exchange_error
},
21502 => %{
description: "marshal tx failed",
type: :exchange_error
},
21503 => %{
description: "marshal event failed",
type: :exchange_error
},
21504 => %{
description: "fail to l1 signature",
type: :exchange_error
},
21505 => %{
description: "unsupported tx type",
type: :exchange_error
},
21506 => %{
description: "too many pending txs. Please try again later",
type: :exchange_error
},
21507 => %{
description: "account is below maintenance margin, can't execute transaction",
type: :exchange_error
},
21508 => %{
description: "account is below initial margin, can't execute transaction",
type: :exchange_error
},
21511 => %{
description: "invalid tx type for account",
type: :exchange_error
},
21512 => %{
description: "invalid l1 request id",
type: :exchange_error
},
21600 => %{
description: "given order is not an active limit order",
type: :invalid_order
},
21601 => %{
description: "order book is full",
type: :invalid_order
},
21602 => %{
description: "invalid market index",
type: :invalid_order
},
21603 => %{
description: "invalid min amounts for market",
type: :invalid_order
},
21604 => %{
description: "invalid margin fractions for market",
type: :invalid_order
},
21605 => %{
description: "invalid market status",
type: :invalid_order
},
21606 => %{
description: "market already exist for given index",
type: :invalid_order
},
21607 => %{
description: "invalid market fees",
type: :invalid_order
},
21608 => %{
description: "invalid quote multiplier",
type: :invalid_order
},
21611 => %{
description: "invalid interest rate",
type: :invalid_order
},
21612 => %{
description: "invalid open interest",
type: :invalid_order
},
21613 => %{
description: "invalid margin mode",
type: :invalid_order
},
21614 => %{
description: "no position found",
type: :invalid_order
},
21700 => %{
description: "invalid order index",
type: :invalid_order
},
21701 => %{
description: "invalid base amount",
type: :invalid_order
},
21702 => %{
description: "invalid price",
type: :invalid_order
},
21703 => %{
description: "invalid isAsk",
type: :invalid_order
},
21704 => %{
description: "invalid OrderType",
type: :invalid_order
},
21705 => %{
description: "invalid OrderTimeInForce",
type: :invalid_order
},
21706 => %{
description: "invalid order base or quote amount",
type: :invalid_order
},
21707 => %{
description: "account is not owner of the order",
type: :invalid_order
},
21708 => %{
description: "order is empty",
type: :invalid_order
},
21709 => %{
description: "order is inactive",
type: :invalid_order
},
21710 => %{
description: "unsupported order type",
type: :invalid_order
},
21711 => %{
description: "invalid expiry",
type: :invalid_order
},
21712 => %{
description: "account has a queued cancel all orders request",
type: :invalid_order
},
21713 => %{
description: "invalid cancel all time in force",
type: :invalid_order
},
21714 => %{
description: "invalid cancel all time",
type: :invalid_order
},
21715 => %{
description: "given order is not an active order",
type: :invalid_order
},
21716 => %{
description: "order is not expired",
type: :invalid_order
},
21717 => %{
description: "maximum active limit order count reached",
type: :invalid_order
},
21718 => %{
description: "maximum active limit order count per market reached",
type: :invalid_order
},
21719 => %{
description: "maximum pending order count reached",
type: :invalid_order
},
21720 => %{
description: "maximum pending order count per market reached",
type: :invalid_order
},
21721 => %{
description: "maximum twap order count reached",
type: :invalid_order
},
21722 => %{
description: "maximum conditional order count reached",
type: :invalid_order
},
21723 => %{
description: "invalid account health",
type: :invalid_order
},
21724 => %{
description: "invalid liquidation size",
type: :invalid_order
},
21725 => %{
description: "invalid liquidation price",
type: :invalid_order
},
21726 => %{
description: "insurance fund cannot be partially liquidated",
type: :invalid_order
},
21727 => %{
description: "invalid client order index",
type: :invalid_order
},
21728 => %{
description: "client order index already exists",
type: :invalid_order
},
21729 => %{
description: "invalid order trigger price",
type: :invalid_order
},
21730 => %{
description: "order status is not pending",
type: :invalid_order
},
21731 => %{
description: "order can not be triggered",
type: :invalid_order
},
21732 => %{
description: "reduce only increases position",
type: :invalid_order
},
21733 => %{
description: "order price flagged as an accidental price",
type: :invalid_order
},
21734 => %{
description: "limit order price is too far from the mark price",
type: :invalid_order
},
21735 => %{
description: "SL/TP order price is too far from the trigger price",
type: :invalid_order
},
21736 => %{
description: "invalid order trigger status",
type: :invalid_order
},
21737 => %{
description: "invalid order status",
type: :invalid_order
},
21738 => %{
description: "invalid reduce only direction",
type: :invalid_order
},
21739 => %{
description: "not enough margin to create the order",
type: :invalid_order
},
21740 => %{
description: "invalid reduce only mode",
type: :invalid_order
},
21901 => %{
description: "deleverage against itself",
type: :invalid_order
},
21902 => %{
description: "deleverage does not match liquidation status",
type: :invalid_order
},
21903 => %{
description: "deleverage with open orders",
type: :invalid_order
},
21904 => %{
description: "invalid deleverage size",
type: :invalid_order
},
21905 => %{
description: "invalid deleverage price",
type: :invalid_order
},
21906 => %{
description: "invalid deleverage side",
type: :invalid_order
},
23000 => %{
description: "Too Many Requests!",
type: :rate_limited
},
23001 => %{
description: "Too Many Subscriptions!",
type: :rate_limited
},
23002 => %{
description: "Too Many Different Accounts!",
type: :rate_limited
},
23003 => %{
description: "Too Many Connections!",
type: :rate_limited
}
},
error_codes: %{
21500 => :exchange_error,
21501 => :exchange_error,
21502 => :exchange_error,
21503 => :exchange_error,
21504 => :exchange_error,
21505 => :exchange_error,
21506 => :exchange_error,
21507 => :exchange_error,
21508 => :exchange_error,
21511 => :exchange_error,
21512 => :exchange_error,
21600 => :invalid_order,
21601 => :invalid_order,
21602 => :invalid_order,
21603 => :invalid_order,
21604 => :invalid_order,
21605 => :invalid_order,
21606 => :invalid_order,
21607 => :invalid_order,
21608 => :invalid_order,
21611 => :invalid_order,
21612 => :invalid_order,
21613 => :invalid_order,
21614 => :invalid_order,
21700 => :invalid_order,
21701 => :invalid_order,
21702 => :invalid_order,
21703 => :invalid_order,
21704 => :invalid_order,
21705 => :invalid_order,
21706 => :invalid_order,
21707 => :invalid_order,
21708 => :invalid_order,
21709 => :invalid_order,
21710 => :invalid_order,
21711 => :invalid_order,
21712 => :invalid_order,
21713 => :invalid_order,
21714 => :invalid_order,
21715 => :invalid_order,
21716 => :invalid_order,
21717 => :invalid_order,
21718 => :invalid_order,
21719 => :invalid_order,
21720 => :invalid_order,
21721 => :invalid_order,
21722 => :invalid_order,
21723 => :invalid_order,
21724 => :invalid_order,
21725 => :invalid_order,
21726 => :invalid_order,
21727 => :invalid_order,
21728 => :invalid_order,
21729 => :invalid_order,
21730 => :invalid_order,
21731 => :invalid_order,
21732 => :invalid_order,
21733 => :invalid_order,
21734 => :invalid_order,
21735 => :invalid_order,
21736 => :invalid_order,
21737 => :invalid_order,
21738 => :invalid_order,
21739 => :invalid_order,
21740 => :invalid_order,
21901 => :invalid_order,
21902 => :invalid_order,
21903 => :invalid_order,
21904 => :invalid_order,
21905 => :invalid_order,
21906 => :invalid_order,
23000 => :rate_limited,
23001 => :rate_limited,
23002 => :rate_limited,
23003 => :rate_limited
},
exceptions: %{
exact: %{
"21500" => :exchange_error,
"21501" => :exchange_error,
"21502" => :exchange_error,
"21503" => :exchange_error,
"21504" => :exchange_error,
"21505" => :exchange_error,
"21506" => :exchange_error,
"21507" => :exchange_error,
"21508" => :exchange_error,
"21511" => :exchange_error,
"21512" => :exchange_error,
"21600" => :invalid_order,
"21601" => :invalid_order,
"21602" => :invalid_order,
"21603" => :invalid_order,
"21604" => :invalid_order,
"21605" => :invalid_order,
"21606" => :invalid_order,
"21607" => :invalid_order,
"21608" => :invalid_order,
"21611" => :invalid_order,
"21612" => :invalid_order,
"21613" => :invalid_order,
"21614" => :invalid_order,
"21700" => :invalid_order,
"21701" => :invalid_order,
"21702" => :invalid_order,
"21703" => :invalid_order,
"21704" => :invalid_order,
"21705" => :invalid_order,
"21706" => :invalid_order,
"21707" => :invalid_order,
"21708" => :invalid_order,
"21709" => :invalid_order,
"21710" => :invalid_order,
"21711" => :invalid_order,
"21712" => :invalid_order,
"21713" => :invalid_order,
"21714" => :invalid_order,
"21715" => :invalid_order,
"21716" => :invalid_order,
"21717" => :invalid_order,
"21718" => :invalid_order,
"21719" => :invalid_order,
"21720" => :invalid_order,
"21721" => :invalid_order,
"21722" => :invalid_order,
"21723" => :invalid_order,
"21724" => :invalid_order,
"21725" => :invalid_order,
"21726" => :invalid_order,
"21727" => :invalid_order,
"21728" => :invalid_order,
"21729" => :invalid_order,
"21730" => :invalid_order,
"21731" => :invalid_order,
"21732" => :invalid_order,
"21733" => :invalid_order,
"21734" => :invalid_order,
"21735" => :invalid_order,
"21736" => :invalid_order,
"21737" => :invalid_order,
"21738" => :invalid_order,
"21739" => :invalid_order,
"21740" => :invalid_order,
"21901" => :invalid_order,
"21902" => :invalid_order,
"21903" => :invalid_order,
"21904" => :invalid_order,
"21905" => :invalid_order,
"21906" => :invalid_order,
"23000" => :rate_limit_exceeded,
"23001" => :rate_limit_exceeded,
"23002" => :rate_limit_exceeded,
"23003" => :rate_limit_exceeded
}
},
exchange_options: %{
"accountIndex" => nil,
"apiKeyIndex" => nil,
"chainId" => 304,
"defaultNetworkCodeReplacements" => %{
"BRC20" => %{
"BRC20" => "BTC"
},
"CRO" => %{
"CRC20" => "CRONOS"
},
"ETH" => %{
"ERC20" => "ETH"
},
"TRX" => %{
"TRC20" => "TRX"
}
},
"defaultType" => "swap",
"libraryPath" => nil,
"networksById" => %{},
"wasmExecPath" => nil
},
extended_metadata: %{
fees_url: "https://docs.lighter.xyz/perpetual-futures/fees",
limits: %{
"amount" => %{},
"cost" => %{},
"leverage" => %{},
"price" => %{}
},
logo_url: "https://github.com/user-attachments/assets/ff1aaf96-bffb-4545-a750-5eba716e75d0",
referral_discount: 0.1,
referral_url: "app.lighter.xyz/?referral=715955W9"
},
extracted_metadata: %{
ccxt_version: "4.5.42"
},
features: %{
default: %{
create_order: %{
iceberg: false,
leverage: false,
market_buy_by_cost: false,
market_buy_requires_price: false,
self_trade_prevention: false,
time_in_force: %{
fok: true,
gtd: false,
ioc: true,
po: true
},
trailing: false
},
sandbox: true
}
},
fees: nil,
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 //\n // {\n // \"code\": \"200\",\n // \"message\": \"string\"\n // }\n //\n const code = this.safeString(response, 'code');\n const message = this.safeString(response, 'msg');\n if (code !== undefined && code !== '0' && code !== '200') {\n const feedback = this.id + ' ' + body;\n this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);\n this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);\n throw new errors.ExchangeError(feedback); // unknown message\n }\n return undefined;\n }",
has: %{
add_margin: true,
borrow_cross_margin: false,
borrow_isolated_margin: false,
borrow_margin: false,
c_o_r_s: false,
cancel_all_orders: true,
cancel_all_orders_after: 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_for_symbols: false,
cancel_orders_with_client_order_id: false,
cancel_orders_ws: false,
close_all_positions: false,
close_position: false,
create_deposit_address: false,
create_limit_buy_order: false,
create_limit_buy_order_ws: false,
create_limit_order: true,
create_limit_order_ws: false,
create_limit_sell_order: false,
create_limit_sell_order_ws: false,
create_market_buy_order: false,
create_market_buy_order_with_cost: 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: false,
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_a_d_l_rank: false,
fetch_accounts: true,
fetch_all_greeks: 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: false,
fetch_deposit_addresses: false,
fetch_deposit_addresses_by_network: false,
fetch_deposit_withdraw_fee: false,
fetch_deposit_withdraw_fees: false,
fetch_deposits: true,
fetch_deposits_withdrawals: false,
fetch_deposits_ws: false,
fetch_funding_history: false,
fetch_funding_interval: false,
fetch_funding_intervals: false,
fetch_funding_rate: false,
fetch_funding_rate_history: false,
fetch_funding_rates: true,
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: false,
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_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: false,
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_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: false,
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: true,
fetch_underlying_assets: false,
fetch_volatility_history: false,
fetch_withdraw_addresses: false,
fetch_withdrawal: false,
fetch_withdrawal_whitelist: false,
fetch_withdrawals: true,
fetch_withdrawals_ws: false,
future: false,
margin: false,
option: false,
private_api: true,
public_api: true,
reduce_margin: true,
repay_cross_margin: false,
repay_isolated_margin: false,
sandbox: true,
set_leverage: true,
set_margin: true,
set_margin_mode: true,
set_position_mode: false,
sign_in: false,
spot: false,
swap: true,
transfer: true,
un_watch_my_trades: false,
un_watch_ohlcv: false,
un_watch_ohlcv_for_symbols: false,
un_watch_order_book: false,
un_watch_order_book_for_symbols: false,
un_watch_orders: false,
un_watch_positions: false,
un_watch_ticker: false,
un_watch_tickers: false,
un_watch_trades: false,
un_watch_trades_for_symbols: false,
watch_balance: false,
watch_bids_asks: false,
watch_funding_rate: false,
watch_funding_rates: false,
watch_liquidations: true,
watch_liquidations_for_symbols: false,
watch_mark_price: true,
watch_mark_prices: true,
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: true,
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: true,
watch_tickers: true,
watch_trades: true,
watch_trades_for_symbols: false,
withdraw: true,
ws: false
},
http_config: nil,
id: "lighter",
markets: nil,
name: "Lighter",
ohlcv_timestamp_resolution: :milliseconds,
options: %{
"account_index" => nil,
"api_key_index" => nil,
"chain_id" => 304,
:default_account_type => "swap",
:default_type => "swap",
"library_path" => nil,
"wasm_exec_path" => nil
},
order_mappings: nil,
param_mappings: %{
"since" => "start_timestamp",
"symbol" => "market_id",
"timeframe" => "resolution"
},
parse_methods: [
%{
"comment" => nil,
"examples" => [
"{\n \"code\": \"0\",\n \"account_type\": \"0\",\n \"index\": \"1077\",\n \"l1_address\": \"0x15f43D1f2DeE81424aFd891943262aa90F22cc2A\",\n \"cancel_all_time\": \"0\",\n \"total_order_count\": \"1\",\n \"total_isolated_order_count\": \"0\",\n \"pending_order_count\": \"0\",\n \"available_balance\": \"7996.489834\",\n \"status\": \"1\",\n \"collateral\": \"9000.000000\",\n \"account_index\": \"1077\",\n \"name\": \"\",\n \"description\": \"\",\n \"can_invite\": true,\n \"referral_points_percentage\": \"\",\n \"positions\": [],\n \"assets\": [],\n \"total_asset_value\": \"9536.789088\",\n \"cross_asset_value\": \"9536.789088\",\n \"shares\": []\n }"
],
"line_end" => 1794,
"line_start" => 1761,
"mappings" => [
%{
"comment" => nil,
"key" => "id",
"value" => "this.safeString (account, 'account_index')"
},
%{
"comment" => nil,
"key" => "type",
"value" => "(accountType === '0') ? 'main' : 'subaccount'"
},
%{
"comment" => nil,
"key" => "code",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "info",
"value" => "account"
}
],
"name" => "parseAccount",
"signature" => "parseAccount (account)",
"source" => "parseAccount (account) {\n //\n // {\n // \"code\": \"0\",\n // \"account_type\": \"0\",\n // \"index\": \"1077\",\n // \"l1_address\": \"0x15f43D1f2DeE81424aFd891943262aa90F22cc2A\",\n // \"cancel_all_time\": \"0\",\n // \"total_order_count\": \"1\",\n // \"total_isolated_order_count\": \"0\",\n // \"pending_order_count\": \"0\",\n // \"available_balance\": \"7996.489834\",\n // \"status\": \"1\",\n // \"collateral\": \"9000.000000\",\n // \"account_index\": \"1077\",\n // \"name\": \"\",\n // \"description\": \"\",\n // \"can_invite\": true,\n // \"referral_points_percentage\": \"\",\n // \"positions\": [],\n // \"assets\": [],\n // \"total_asset_value\": \"9536.789088\",\n // \"cross_asset_value\": \"9536.789088\",\n // \"shares\": []\n // }\n //\n const accountType = this.safeString (account, 'account_type');\n return {\n 'id': this.safeString (account, 'account_index'),\n 'type': (accountType === '0') ? 'main' : 'subaccount',\n 'code': undefined,\n 'info': account,\n };\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"market_id\": 0,\n \"exchange\": \"lighter\",\n \"symbol\": \"ETH\",\n \"rate\": 0.00009599999999999999\n }"
],
"line_end" => 1415,
"line_start" => 1385,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "contract"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "this.safeSymbol (marketId, market)"
},
%{
"comment" => nil,
"key" => "markPrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "indexPrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "interestRate",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "estimatedSettlePrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "fundingRate",
"value" => "this.safeNumber (contract, 'rate')"
},
%{
"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 // \"market_id\": 0,\n // \"exchange\": \"lighter\",\n // \"symbol\": \"ETH\",\n // \"rate\": 0.00009599999999999999\n // }\n //\n const marketId = this.safeString (contract, 'market_id');\n return {\n 'info': contract,\n 'symbol': this.safeSymbol (marketId, market),\n 'markPrice': undefined,\n 'indexPrice': undefined,\n 'interestRate': undefined,\n 'estimatedSettlePrice': undefined,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'fundingRate': this.safeNumber (contract, 'rate'),\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" => [],
"line_end" => 2911,
"line_start" => 2897,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "data"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "this.safeString (market, 'symbol')"
},
%{
"comment" => nil,
"key" => "type",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "marginMode",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "total",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "code",
"value" => "'USDC'"
},
%{
"comment" => nil,
"key" => "status",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "timestamp"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "this.iso8601 (timestamp)"
}
],
"name" => "parseMarginModification",
"signature" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification",
"source" => "parseMarginModification (data: Dict, market: Market = undefined): MarginModification {\n const timestamp = this.safeInteger (data, 'predicted_execution_time_ms');\n return {\n 'info': data,\n 'symbol': this.safeString (market, 'symbol'),\n 'type': undefined,\n 'marginMode': undefined,\n 'amount': undefined,\n 'total': undefined,\n 'code': 'USDC',\n 'status': undefined,\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n };\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"t\": 1767700500000,\n \"o\": 3236.86,\n \"h\": 3237.78,\n \"l\": 3235.36,\n \"c\": 3235.39,\n \"v\": 55.1632,\n \"V\": 178530.793575,\n \"i\": 779870452,\n \"C\": \"string\",\n \"H\": \"string\",\n \"L\": \"string\",\n \"O\": \"string\"\n }"
],
"line_end" => 1306,
"line_start" => 1281,
"mappings" => [],
"name" => "parseOHLCV",
"signature" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV",
"source" => "parseOHLCV (ohlcv, market: Market = undefined): OHLCV {\n //\n // {\n // \"t\": 1767700500000,\n // \"o\": 3236.86,\n // \"h\": 3237.78,\n // \"l\": 3235.36,\n // \"c\": 3235.39,\n // \"v\": 55.1632,\n // \"V\": 178530.793575,\n // \"i\": 779870452,\n // \"C\": \"string\",\n // \"H\": \"string\",\n // \"L\": \"string\",\n // \"O\": \"string\"\n // }\n //\n return [\n this.safeInteger (ohlcv, 't'),\n this.safeNumber (ohlcv, 'o'),\n this.safeNumber (ohlcv, 'h'),\n this.safeNumber (ohlcv, 'l'),\n this.safeNumber (ohlcv, 'c'),\n this.safeNumber (ohlcv, 'v'),\n ];\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"order_index\": 281474977354074,\n \"client_order_index\": 0,\n \"order_id\": \"281474977354074\",\n \"client_order_id\": \"0\",\n \"market_index\": 0,\n \"owner_account_index\": 1077,\n \"initial_base_amount\": \"36.0386\",\n \"price\": \"2221.60\",\n \"nonce\": 643418,\n \"remaining_base_amount\": \"0.0000\",\n \"is_ask\": true,\n \"base_size\": 0,\n \"base_price\": 222160,\n \"filled_base_amount\": \"0.0000\",\n \"filled_quote_amount\": \"0.000000\",\n \"side\": \"\",\n \"type\": \"market\",\n \"time_in_force\": \"immediate-or-cancel\",\n \"reduce_only\": false,\n \"trigger_price\": \"0.00\",\n \"order_expiry\": 0,\n \"status\": \"canceled-margin-not-allowed\",\n \"trigger_status\": \"na\",\n \"trigger_time\": 0,\n \"parent_order_index\": 0,\n \"parent_order_id\": \"0\",\n \"to_trigger_order_id_0\": \"0\",\n \"to_trigger_order_id_1\": \"0\",\n \"to_cancel_order_id_0\": \"0\",\n \"block_height\": 102202,\n \"timestamp\": 1766387932,\n \"created_at\": 1766387932,\n \"updated_at\": 1766387932\n }"
],
"line_end" => 2041,
"line_start" => 1954,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "order"
},
%{
"comment" => nil,
"key" => "id",
"value" => "this.safeString (order, 'order_id')"
},
%{
"comment" => nil,
"key" => "clientOrderId",
"value" => "this.omitZero (this.safeString2 (order, 'client_order_id', 'client_order_index'))"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "timestamp"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "this.iso8601 (timestamp)"
},
%{
"comment" => nil,
"key" => "lastTradeTimestamp",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "lastUpdateTimestamp",
"value" => "this.safeTimestamp (order, 'updated_at')"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "market['symbol']"
},
%{
"comment" => nil,
"key" => "type",
"value" => "this.parseOrderType (type)"
},
%{
"comment" => nil,
"key" => "timeInForce",
"value" => "this.parseOrderTimeInForeces (tif)"
},
%{
"comment" => nil,
"key" => "postOnly",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "reduceOnly",
"value" => "this.safeBool (order, 'reduce_only')"
},
%{
"comment" => nil,
"key" => "side",
"value" => "side"
},
%{
"comment" => nil,
"key" => "price",
"value" => "this.safeString (order, 'price')"
},
%{
"comment" => nil,
"key" => "triggerPrice",
"value" => "triggerPrice"
},
%{
"comment" => nil,
"key" => "stopLossPrice",
"value" => "stopLossPrice"
},
%{
"comment" => nil,
"key" => "takeProfitPrice",
"value" => "takeProfitPrice"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "this.safeString (order, 'initial_base_amount')"
},
%{
"comment" => nil,
"key" => "cost",
"value" => "this.safeString (order, 'filled_quote_amount')"
},
%{
"comment" => nil,
"key" => "average",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "filled",
"value" => "this.safeString (order, 'filled_base_amount')"
},
%{
"comment" => nil,
"key" => "remaining",
"value" => "this.safeString (order, 'remaining_base_amount')"
},
%{
"comment" => nil,
"key" => "status",
"value" => "this.parseOrderStatus (status)"
},
%{
"comment" => nil,
"key" => "fee",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "trades",
"value" => "undefined"
}
],
"name" => "parseOrder",
"signature" => "parseOrder (order: Dict, market: Market = undefined): Order",
"source" => "parseOrder (order: Dict, market: Market = undefined): Order {\n //\n // {\n // \"order_index\": 281474977354074,\n // \"client_order_index\": 0,\n // \"order_id\": \"281474977354074\",\n // \"client_order_id\": \"0\",\n // \"market_index\": 0,\n // \"owner_account_index\": 1077,\n // \"initial_base_amount\": \"36.0386\",\n // \"price\": \"2221.60\",\n // \"nonce\": 643418,\n // \"remaining_base_amount\": \"0.0000\",\n // \"is_ask\": true,\n // \"base_size\": 0,\n // \"base_price\": 222160,\n // \"filled_base_amount\": \"0.0000\",\n // \"filled_quote_amount\": \"0.000000\",\n // \"side\": \"\",\n // \"type\": \"market\",\n // \"time_in_force\": \"immediate-or-cancel\",\n // \"reduce_only\": false,\n // \"trigger_price\": \"0.00\",\n // \"order_expiry\": 0,\n // \"status\": \"canceled-margin-not-allowed\",\n // \"trigger_status\": \"na\",\n // \"trigger_time\": 0,\n // \"parent_order_index\": 0,\n // \"parent_order_id\": \"0\",\n // \"to_trigger_order_id_0\": \"0\",\n // \"to_trigger_order_id_1\": \"0\",\n // \"to_cancel_order_id_0\": \"0\",\n // \"block_height\": 102202,\n // \"timestamp\": 1766387932,\n // \"created_at\": 1766387932,\n // \"updated_at\": 1766387932\n // }\n //\n const marketId = this.safeString (order, 'market_index');\n market = this.safeMarket (marketId, market);\n const timestamp = this.safeTimestamp (order, 'timestamp');\n const isAsk = this.safeBool (order, 'is_ask');\n let side = undefined;\n if (isAsk !== undefined) {\n side = isAsk ? 'sell' : 'buy';\n }\n const type = this.safeString (order, 'type');\n const triggerPrice = this.parseNumber (this.omitZero (this.safeString (order, 'trigger_price')));\n let stopLossPrice = undefined;\n let takeProfitPrice = undefined;\n if (type !== undefined) {\n if (type.indexOf ('stop-loss') >= 0) {\n stopLossPrice = triggerPrice;\n }\n if (type.indexOf ('take-profit') >= 0) {\n takeProfitPrice = triggerPrice;\n }\n }\n const tif = this.safeString (order, 'time_in_force');\n const status = this.safeString (order, 'status');\n return this.safeOrder ({\n 'info': order,\n 'id': this.safeString (order, 'order_id'),\n 'clientOrderId': this.omitZero (this.safeString2 (order, 'client_order_id', 'client_order_index')),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'lastTradeTimestamp': undefined,\n 'lastUpdateTimestamp': this.safeTimestamp (order, 'updated_at'),\n 'symbol': market['symbol'],\n 'type': this.parseOrderType (type),\n 'timeInForce': this.parseOrderTimeInForeces (tif),\n 'postOnly': undefined,\n 'reduceOnly': this.safeBool (order, 'reduce_only'),\n 'side': side,\n 'price': this.safeString (order, 'price'),\n 'triggerPrice': triggerPrice,\n 'stopLossPrice': stopLossPrice,\n 'takeProfitPrice': takeProfitPrice,\n 'amount': this.safeString (order, 'initial_base_amount'),\n 'cost': this.safeString (order, 'filled_quote_amount'),\n 'average': undefined,\n 'filled': this.safeString (order, 'filled_base_amount'),\n 'remaining': this.safeString (order, 'remaining_base_amount'),\n 'status': this.parseOrderStatus (status),\n 'fee': undefined,\n 'trades': undefined,\n }, market);\n }"
},
%{
"comment" => nil,
"examples" => [],
"line_end" => 2063,
"line_start" => 2043,
"mappings" => [],
"name" => "parseOrderStatus",
"signature" => "parseOrderStatus (status: Str)",
"source" => "parseOrderStatus (status: Str) {\n const statuses: Dict = {\n 'in-progress': 'open',\n 'pending': 'open',\n 'open': 'open',\n 'filled': 'closed',\n 'canceled': 'canceled',\n 'canceled-post-only': 'canceled',\n 'canceled-reduce-only': 'canceled',\n 'canceled-position-not-allowed': 'rejected',\n 'canceled-margin-not-allowed': 'rejected',\n 'canceled-too-much-slippage': 'canceled',\n 'canceled-not-enough-liquidity': 'canceled',\n 'canceled-self-trade': 'canceled',\n 'canceled-expired': 'expired',\n 'canceled-oco': 'canceled',\n 'canceled-child': 'canceled',\n 'canceled-liquidation': 'canceled',\n };\n return this.safeString (statuses, status, status);\n }"
},
%{
"comment" => nil,
"examples" => [],
"line_end" => 2088,
"line_start" => 2080,
"mappings" => [],
"name" => "parseOrderTimeInForeces",
"signature" => "parseOrderTimeInForeces (tif)",
"source" => "parseOrderTimeInForeces (tif) {\n const timeInForces: Dict = {\n 'good-till-time': 'GTC',\n 'immediate-or-cancel': 'IOC',\n 'post-only': 'PO',\n 'Unknown': undefined,\n };\n return this.safeString (timeInForces, tif, tif);\n }"
},
%{
"comment" => nil,
"examples" => [],
"line_end" => 2078,
"line_start" => 2065,
"mappings" => [],
"name" => "parseOrderType",
"signature" => "parseOrderType (status)",
"source" => "parseOrderType (status) {\n const statuses: Dict = {\n 'limit': 'limit',\n 'market': 'market',\n 'stop-loss': 'market',\n 'stop-loss-limit': 'limit',\n 'take-profit': 'market',\n 'take-profit-limit': 'limit',\n 'twap': 'twap',\n 'twap-sub': 'twap',\n 'liquidation': 'market',\n };\n return this.safeString (statuses, status, status);\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"market_id\": 0,\n \"symbol\": \"ETH\",\n \"initial_margin_fraction\": \"5.00\",\n \"open_order_count\": 0,\n \"pending_order_count\": 0,\n \"position_tied_order_count\": 0,\n \"sign\": 1,\n \"position\": \"18.0193\",\n \"avg_entry_price\": \"2669.84\",\n \"position_value\": \"54306.566340\",\n \"unrealized_pnl\": \"6197.829558\",\n \"realized_pnl\": \"0.000000\",\n \"liquidation_price\": \"2191.1107231380406\",\n \"margin_mode\": 0,\n \"allocated_margin\": \"0.000000\"\n }"
],
"line_end" => 1705,
"line_start" => 1640,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "position"
},
%{
"comment" => nil,
"key" => "id",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "market['symbol']"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "isolated",
"value" => "(marginMode === 'isolated')"
},
%{
"comment" => nil,
"key" => "hedged",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "side",
"value" => "side"
},
%{
"comment" => nil,
"key" => "contracts",
"value" => "this.safeNumber (position, 'position')"
},
%{
"comment" => nil,
"key" => "contractSize",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "entryPrice",
"value" => "this.safeNumber (position, 'avg_entry_price')"
},
%{
"comment" => nil,
"key" => "markPrice",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "notional",
"value" => "this.safeNumber (position, 'position_value')"
},
%{
"comment" => nil,
"key" => "leverage",
"value" => "leverage"
},
%{
"comment" => nil,
"key" => "collateral",
"value" => "this.safeNumber (position, 'allocated_margin')"
},
%{
"comment" => nil,
"key" => "initialMargin",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "maintenanceMargin",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "initialMarginPercentage",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "maintenanceMarginPercentage",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "unrealizedPnl",
"value" => "this.safeNumber (position, 'unrealized_pnl')"
},
%{
"comment" => nil,
"key" => "liquidationPrice",
"value" => "this.safeNumber (position, 'liquidation_price')"
},
%{
"comment" => nil,
"key" => "marginMode",
"value" => "marginMode"
},
%{
"comment" => nil,
"key" => "percentage",
"value" => "undefined"
}
],
"name" => "parsePosition",
"signature" => "parsePosition (position: Dict, market: Market = undefined)",
"source" => "parsePosition (position: Dict, market: Market = undefined) {\n //\n // {\n // \"market_id\": 0,\n // \"symbol\": \"ETH\",\n // \"initial_margin_fraction\": \"5.00\",\n // \"open_order_count\": 0,\n // \"pending_order_count\": 0,\n // \"position_tied_order_count\": 0,\n // \"sign\": 1,\n // \"position\": \"18.0193\",\n // \"avg_entry_price\": \"2669.84\",\n // \"position_value\": \"54306.566340\",\n // \"unrealized_pnl\": \"6197.829558\",\n // \"realized_pnl\": \"0.000000\",\n // \"liquidation_price\": \"2191.1107231380406\",\n // \"margin_mode\": 0,\n // \"allocated_margin\": \"0.000000\"\n // }\n //\n const marketId = this.safeString (position, 'market_id');\n market = this.safeMarket (marketId, market);\n const sign = this.safeInteger (position, 'sign');\n let side = undefined;\n if (sign !== undefined) {\n side = (sign === 1) ? 'long' : 'short';\n }\n const marginModeId = this.safeInteger (position, 'margin_mode');\n let marginMode = undefined;\n if (marginModeId !== undefined) {\n marginMode = (marginModeId === 0) ? 'cross' : 'isolated';\n }\n const imfStr = this.safeString (position, 'initial_margin_fraction');\n let leverage = undefined;\n if (imfStr !== undefined) {\n const imf = this.parseToInt (imfStr);\n if (imf > 0) {\n leverage = 100 / imf;\n }\n }\n return this.safePosition ({\n 'info': position,\n 'id': undefined,\n 'symbol': market['symbol'],\n 'timestamp': undefined,\n 'datetime': undefined,\n 'isolated': (marginMode === 'isolated'),\n 'hedged': undefined,\n 'side': side,\n 'contracts': this.safeNumber (position, 'position'),\n 'contractSize': undefined,\n 'entryPrice': this.safeNumber (position, 'avg_entry_price'),\n 'markPrice': undefined,\n 'notional': this.safeNumber (position, 'position_value'),\n 'leverage': leverage,\n 'collateral': this.safeNumber (position, 'allocated_margin'),\n 'initialMargin': undefined,\n 'maintenanceMargin': undefined,\n 'initialMarginPercentage': undefined,\n 'maintenanceMarginPercentage': undefined,\n 'unrealizedPnl': this.safeNumber (position, 'unrealized_pnl'),\n 'liquidationPrice': this.safeNumber (position, 'liquidation_price'),\n 'marginMode': marginMode,\n 'percentage': undefined,\n });\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"symbol\": \"ETH\",\n \"market_id\": 0,\n \"status\": \"active\",\n \"taker_fee\": \"0.0000\",\n \"maker_fee\": \"0.0000\",\n \"liquidation_fee\": \"1.0000\",\n \"min_base_amount\": \"0.0050\",\n \"min_quote_amount\": \"10.000000\",\n \"order_quote_limit\": \"\",\n \"supported_size_decimals\": 4,\n \"supported_price_decimals\": 2,\n \"supported_quote_decimals\": 6,\n \"size_decimals\": 4,\n \"price_decimals\": 2,\n \"quote_multiplier\": 1,\n \"default_initial_margin_fraction\": 500,\n \"min_initial_margin_fraction\": 200,\n \"maintenance_margin_fraction\": 120,\n \"closeout_margin_fraction\": 80,\n \"last_trade_price\": 3550.69,\n \"daily_trades_count\": 1197349,\n \"daily_base_token_volume\": 481297.3509,\n \"daily_quote_token_volume\": 1671431095.263844,\n \"daily_price_low\": 3402.41,\n \"daily_price_high\": 3571.45,\n \"daily_price_change\": 0.5294300840859545,\n \"open_interest\": 39559.3278,\n \"daily_chart\": {},\n \"market_config\": {\n \"market_margin_mode\": 0,\n \"insurance_fund_account_index\": 281474976710655,\n \"liquidation_mode\": 0,\n \"force_reduce_only\": false,\n \"trading_hours\": \"\"\n }\n }",
"{\n \"market_id\": 0,\n \"index_price\": \"3015.56\",\n \"mark_price\": \"3013.91\",\n \"open_interest\": \"122736286.659423\",\n \"open_interest_limit\": \"72057594037927936.000000\",\n \"funding_clamp_small\": \"0.0500\",\n \"funding_clamp_big\": \"4.0000\",\n \"last_trade_price\": \"3013.13\",\n \"current_funding_rate\": \"0.0012\",\n \"funding_rate\": \"0.0012\",\n \"funding_timestamp\": 1763532000004,\n \"daily_base_token_volume\": 643235.2763,\n \"daily_quote_token_volume\": 1983505435.673896,\n \"daily_price_low\": 2977.42,\n \"daily_price_high\": 3170.81,\n \"daily_price_change\": -0.3061987051035322\n }"
],
"line_end" => 1194,
"line_start" => 1098,
"mappings" => [
%{
"comment" => nil,
"key" => "symbol",
"value" => "symbol"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "high",
"value" => "high"
},
%{
"comment" => nil,
"key" => "low",
"value" => "low"
},
%{
"comment" => nil,
"key" => "bid",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "bidVolume",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "ask",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "askVolume",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "vwap",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "open",
"value" => "undefined"
},
%{
"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" => "change"
},
%{
"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, 'mark_price')"
},
%{
"comment" => nil,
"key" => "indexPrice",
"value" => "this.safeString (ticker, 'index_price')"
},
%{
"comment" => nil,
"key" => "openInterest",
"value" => "openInterest"
},
%{
"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, fetchTickers\n // {\n // \"symbol\": \"ETH\",\n // \"market_id\": 0,\n // \"status\": \"active\",\n // \"taker_fee\": \"0.0000\",\n // \"maker_fee\": \"0.0000\",\n // \"liquidation_fee\": \"1.0000\",\n // \"min_base_amount\": \"0.0050\",\n // \"min_quote_amount\": \"10.000000\",\n // \"order_quote_limit\": \"\",\n // \"supported_size_decimals\": 4,\n // \"supported_price_decimals\": 2,\n // \"supported_quote_decimals\": 6,\n // \"size_decimals\": 4,\n // \"price_decimals\": 2,\n // \"quote_multiplier\": 1,\n // \"default_initial_margin_fraction\": 500,\n // \"min_initial_margin_fraction\": 200,\n // \"maintenance_margin_fraction\": 120,\n // \"closeout_margin_fraction\": 80,\n // \"last_trade_price\": 3550.69,\n // \"daily_trades_count\": 1197349,\n // \"daily_base_token_volume\": 481297.3509,\n // \"daily_quote_token_volume\": 1671431095.263844,\n // \"daily_price_low\": 3402.41,\n // \"daily_price_high\": 3571.45,\n // \"daily_price_change\": 0.5294300840859545,\n // \"open_interest\": 39559.3278,\n // \"daily_chart\": {},\n // \"market_config\": {\n // \"market_margin_mode\": 0,\n // \"insurance_fund_account_index\": 281474976710655,\n // \"liquidation_mode\": 0,\n // \"force_reduce_only\": false,\n // \"trading_hours\": \"\"\n // }\n // }\n //\n // watchTicker, watchTickers\n // {\n // \"market_id\": 0,\n // \"index_price\": \"3015.56\",\n // \"mark_price\": \"3013.91\",\n // \"open_interest\": \"122736286.659423\",\n // \"open_interest_limit\": \"72057594037927936.000000\",\n // \"funding_clamp_small\": \"0.0500\",\n // \"funding_clamp_big\": \"4.0000\",\n // \"last_trade_price\": \"3013.13\",\n // \"current_funding_rate\": \"0.0012\",\n // \"funding_rate\": \"0.0012\",\n // \"funding_timestamp\": 1763532000004,\n // \"daily_base_token_volume\": 643235.2763,\n // \"daily_quote_token_volume\": 1983505435.673896,\n // \"daily_price_low\": 2977.42,\n // \"daily_price_high\": 3170.81,\n // \"daily_price_change\": -0.3061987051035322\n // }\n //\n const marketId = this.safeString (ticker, 'market_id');\n market = this.safeMarket (marketId, market);\n const symbol = market['symbol'];\n const last = this.safeString (ticker, 'last_trade_price');\n const high = this.safeString (ticker, 'daily_price_high');\n const low = this.safeString (ticker, 'daily_price_low');\n const baseVolume = this.safeString (ticker, 'daily_base_token_volume');\n const quoteVolume = this.safeString (ticker, 'daily_quote_token_volume');\n const change = this.safeString (ticker, 'daily_price_change');\n const openInterest = this.safeString (ticker, 'open_interest');\n return this.safeTicker ({\n 'symbol': symbol,\n 'timestamp': undefined,\n 'datetime': undefined,\n 'high': high,\n 'low': low,\n 'bid': undefined,\n 'bidVolume': undefined,\n 'ask': undefined,\n 'askVolume': undefined,\n 'vwap': undefined,\n 'open': undefined,\n 'close': last,\n 'last': last,\n 'previousClose': undefined,\n 'change': undefined,\n 'percentage': change,\n 'average': undefined,\n 'baseVolume': baseVolume,\n 'quoteVolume': quoteVolume,\n 'markPrice': this.safeString (ticker, 'mark_price'),\n 'indexPrice': this.safeString (ticker, 'index_price'),\n 'openInterest': openInterest,\n 'info': ticker,\n }, market);\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"trade_id\": 17609,\n \"tx_hash\": \"99ffeaa3899fbaa51043840ddf762fd18c182a33b5125092105bee57af11fab04edf5fd90e969abd\",\n \"type\": \"trade\",\n \"market_id\": 0,\n \"size\": \"10.2304\",\n \"price\": \"2958.75\",\n \"usd_amount\": \"30269.196000\",\n \"ask_id\": 281474977339869,\n \"bid_id\": 562949952870533,\n \"ask_client_id\": 0,\n \"bid_client_id\": 0,\n \"ask_account_id\": 20,\n \"bid_account_id\": 1077,\n \"is_maker_ask\": true,\n \"block_height\": 102070,\n \"timestamp\": 1766386112741,\n \"taker_position_size_before\": \"0.0000\",\n \"taker_entry_quote_before\": \"0.000000\",\n \"taker_position_sign_changed\": true,\n \"maker_position_size_before\": \"-1856.8547\",\n \"maker_entry_quote_before\": \"5491685.069325\",\n \"maker_initial_margin_fraction_before\": 500\n }"
],
"line_end" => 2608,
"line_start" => 2543,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "trade"
},
%{
"comment" => nil,
"key" => "id",
"value" => "this.safeString (trade, 'trade_id')"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "timestamp"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "this.iso8601 (timestamp)"
},
%{
"comment" => nil,
"key" => "symbol",
"value" => "market['symbol']"
},
%{
"comment" => nil,
"key" => "order",
"value" => "orderId"
},
%{
"comment" => nil,
"key" => "type",
"value" => "this.safeString (trade, 'type')"
},
%{
"comment" => nil,
"key" => "side",
"value" => "side"
},
%{
"comment" => nil,
"key" => "takerOrMaker",
"value" => "takerOrMaker"
},
%{
"comment" => nil,
"key" => "price",
"value" => "this.safeString (trade, 'price')"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "this.safeString (trade, 'size')"
},
%{
"comment" => nil,
"key" => "cost",
"value" => "this.safeString (trade, 'usd_amount')"
},
%{
"comment" => nil,
"key" => "fee",
"value" => "undefined"
}
],
"name" => "parseTrade",
"signature" => "parseTrade (trade: Dict, market: Market = undefined): Trade",
"source" => "parseTrade (trade: Dict, market: Market = undefined): Trade {\n //\n // {\n // \"trade_id\": 17609,\n // \"tx_hash\": \"99ffeaa3899fbaa51043840ddf762fd18c182a33b5125092105bee57af11fab04edf5fd90e969abd\",\n // \"type\": \"trade\",\n // \"market_id\": 0,\n // \"size\": \"10.2304\",\n // \"price\": \"2958.75\",\n // \"usd_amount\": \"30269.196000\",\n // \"ask_id\": 281474977339869,\n // \"bid_id\": 562949952870533,\n // \"ask_client_id\": 0,\n // \"bid_client_id\": 0,\n // \"ask_account_id\": 20,\n // \"bid_account_id\": 1077,\n // \"is_maker_ask\": true,\n // \"block_height\": 102070,\n // \"timestamp\": 1766386112741,\n // \"taker_position_size_before\": \"0.0000\",\n // \"taker_entry_quote_before\": \"0.000000\",\n // \"taker_position_sign_changed\": true,\n // \"maker_position_size_before\": \"-1856.8547\",\n // \"maker_entry_quote_before\": \"5491685.069325\",\n // \"maker_initial_margin_fraction_before\": 500\n // }\n //\n const marketId = this.safeString (trade, 'market_id');\n market = this.safeMarket (marketId, market);\n const timestamp = this.safeInteger (trade, 'timestamp');\n const accountIndex = this.safeString (trade, 'account_index');\n const askAccountId = this.safeString (trade, 'ask_account_id');\n const bidAccountId = this.safeString (trade, 'bid_account_id');\n const isMakerAsk = this.safeBool (trade, 'is_maker_ask');\n let side = undefined;\n let orderId = undefined;\n if (accountIndex !== undefined) {\n if (accountIndex === askAccountId) {\n side = 'sell';\n orderId = this.safeString (trade, 'ask_id');\n } else if (accountIndex === bidAccountId) {\n side = 'buy';\n orderId = this.safeString (trade, 'bid_id');\n }\n }\n let takerOrMaker = undefined;\n if (side !== undefined && isMakerAsk !== undefined) {\n const isMaker = (side === 'sell') ? isMakerAsk : !isMakerAsk;\n takerOrMaker = isMaker ? 'maker' : 'taker';\n }\n return this.safeTrade ({\n 'info': trade,\n 'id': this.safeString (trade, 'trade_id'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'symbol': market['symbol'],\n 'order': orderId,\n 'type': this.safeString (trade, 'type'),\n 'side': side,\n 'takerOrMaker': takerOrMaker,\n 'price': this.safeString (trade, 'price'),\n 'amount': this.safeString (trade, 'size'),\n 'cost': this.safeString (trade, 'usd_amount'),\n 'fee': undefined,\n }, market);\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"id\": \"2901843\",\n \"asset_id\": 5,\n \"amount\": \"100000.0\",\n \"timestamp\": 1766112729741,\n \"status\": \"completed\",\n \"l1_tx_hash\": \"0xa24d83d58e1fd72b2a44a12d1ec766fb061fa0b806de2fed940b5d8ecd50744d\",\n }",
"{\n \"id\": \"string\",\n \"amount\": \"0.1\",\n \"timestamp\": \"1640995200\",\n \"status\": \"failed\",\n \"type\": \"secure\",\n \"l1_tx_hash\": \"0x70997970C51812dc3A010C7d01b50e0d17dc79C8\"\n }"
],
"line_end" => 2405,
"line_start" => 2353,
"mappings" => [
%{
"comment" => nil,
"key" => "info",
"value" => "transaction"
},
%{
"comment" => nil,
"key" => "id",
"value" => "this.safeString (transaction, 'id')"
},
%{
"comment" => nil,
"key" => "txid",
"value" => "this.safeString (transaction, 'l1_tx_hash')"
},
%{
"comment" => nil,
"key" => "type",
"value" => "type"
},
%{
"comment" => nil,
"key" => "currency",
"value" => "this.safeCurrencyCode (this.safeString (transaction, 'asset_id'), currency)"
},
%{
"comment" => nil,
"key" => "network",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "this.safeNumber (transaction, 'amount')"
},
%{
"comment" => nil,
"key" => "status",
"value" => "this.parseTransactionStatus (status)"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "timestamp"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "this.iso8601 (timestamp)"
},
%{
"comment" => nil,
"key" => "address",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "addressFrom",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "addressTo",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "tag",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "tagFrom",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "tagTo",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "updated",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "comment",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "fee",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "internal",
"value" => "undefined"
}
],
"name" => "parseTransaction",
"signature" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction",
"source" => "parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {\n //\n // fetchDeposits\n // {\n // \"id\": \"2901843\",\n // \"asset_id\": 5,\n // \"amount\": \"100000.0\",\n // \"timestamp\": 1766112729741,\n // \"status\": \"completed\",\n // \"l1_tx_hash\": \"0xa24d83d58e1fd72b2a44a12d1ec766fb061fa0b806de2fed940b5d8ecd50744d\",\n // }\n //\n // fetchWithdrawals\n // {\n // \"id\": \"string\",\n // \"amount\": \"0.1\",\n // \"timestamp\": \"1640995200\",\n // \"status\": \"failed\",\n // \"type\": \"secure\",\n // \"l1_tx_hash\": \"0x70997970C51812dc3A010C7d01b50e0d17dc79C8\"\n // }\n //\n let type = this.safeString (transaction, 'type');\n if (type === undefined) {\n type = 'deposit';\n } else {\n type = 'withdrawal';\n }\n const timestamp = this.safeInteger (transaction, 'timestamp');\n const status = this.safeString (transaction, 'status');\n return {\n 'info': transaction,\n 'id': this.safeString (transaction, 'id'),\n 'txid': this.safeString (transaction, 'l1_tx_hash'),\n 'type': type,\n 'currency': this.safeCurrencyCode (this.safeString (transaction, 'asset_id'), currency),\n 'network': undefined,\n 'amount': this.safeNumber (transaction, 'amount'),\n 'status': this.parseTransactionStatus (status),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'address': undefined,\n 'addressFrom': undefined,\n 'addressTo': undefined,\n 'tag': undefined,\n 'tagFrom': undefined,\n 'tagTo': undefined,\n 'updated': undefined,\n 'comment': undefined,\n 'fee': undefined,\n 'internal': undefined,\n } as Transaction;\n }"
},
%{
"comment" => nil,
"examples" => [],
"line_end" => 2415,
"line_start" => 2407,
"mappings" => [],
"name" => "parseTransactionStatus",
"signature" => "parseTransactionStatus (status: Str)",
"source" => "parseTransactionStatus (status: Str) {\n const statuses: Dict = {\n 'failed': 'failed',\n 'pending': 'pending',\n 'completed': 'ok',\n 'claimable': 'ok',\n };\n return this.safeString (statuses, status, status);\n }"
},
%{
"comment" => nil,
"examples" => [
"{\n \"id\": \"3085014\",\n \"asset_id\": 3,\n \"amount\": \"11.000000\",\n \"fee\": \"0.000000\",\n \"timestamp\": 1766387292752,\n \"type\": \"L2TransferOutflow\",\n \"from_l1_address\": \"0x15f43D1f2DeE81424aFd891943262aa90F22cc2A\",\n \"to_l1_address\": \"0x15f43D1f2DeE81424aFd891943262aa90F22cc2A\",\n \"from_account_index\": 1077,\n \"to_account_index\": 281474976710608,\n \"from_route\": \"spot\",\n \"to_route\": \"spot\",\n \"tx_hash\": \"d8e96178273d0938f9ede556edffc0aab8def9ec70c46a65791905291a2f5792af18625406102c80\"\n }"
],
"line_end" => 2241,
"line_start" => 2207,
"mappings" => [
%{
"comment" => nil,
"key" => "id",
"value" => "this.safeString (transfer, 'id')"
},
%{
"comment" => nil,
"key" => "timestamp",
"value" => "timestamp"
},
%{
"comment" => nil,
"key" => "datetime",
"value" => "this.iso8601 (timestamp)"
},
%{
"comment" => nil,
"key" => "currency",
"value" => "code"
},
%{
"comment" => nil,
"key" => "amount",
"value" => "this.safeNumber (transfer, 'amount')"
},
%{
"comment" => nil,
"key" => "fromAccount",
"value" => "this.safeString (fromAccount, 'from_account_index')"
},
%{
"comment" => nil,
"key" => "toAccount",
"value" => "this.safeString (toAccount, 'to_account_index')"
},
%{
"comment" => nil,
"key" => "status",
"value" => "undefined"
},
%{
"comment" => nil,
"key" => "info",
"value" => "transfer"
}
],
"name" => "parseTransfer",
"signature" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry",
"source" => "parseTransfer (transfer: Dict, currency: Currency = undefined): TransferEntry {\n //\n // {\n // \"id\": \"3085014\",\n // \"asset_id\": 3,\n // \"amount\": \"11.000000\",\n // \"fee\": \"0.000000\",\n // \"timestamp\": 1766387292752,\n // \"type\": \"L2TransferOutflow\",\n // \"from_l1_address\": \"0x15f43D1f2DeE81424aFd891943262aa90F22cc2A\",\n // \"to_l1_address\": \"0x15f43D1f2DeE81424aFd891943262aa90F22cc2A\",\n // \"from_account_index\": 1077,\n // \"to_account_index\": 281474976710608,\n // \"from_route\": \"spot\",\n // \"to_route\": \"spot\",\n // \"tx_hash\": \"d8e96178273d0938f9ede556edffc0aab8def9ec70c46a65791905291a2f5792af18625406102c80\"\n // }\n //\n const currencyId = this.safeString (transfer, 'asset_id');\n const code = this.safeCurrencyCode (currencyId, currency);\n const timestamp = this.safeInteger (transfer, 'timestamp');\n const fromAccount = this.safeDict (transfer, 'from', {});\n const toAccount = this.safeDict (transfer, 'to', {});\n return {\n 'id': this.safeString (transfer, 'id'),\n 'timestamp': timestamp,\n 'datetime': this.iso8601 (timestamp),\n 'currency': code,\n 'amount': this.safeNumber (transfer, 'amount'),\n 'fromAccount': this.safeString (fromAccount, 'from_account_index'),\n 'toAccount': this.safeString (toAccount, 'to_account_index'),\n 'status': undefined,\n 'info': transfer,\n };\n }"
}
],
path_prefix: "/api/v1/",
pro: true,
quote_json_numbers: nil,
rate_limits: %{
interval_ms: 1000,
period: 1000,
requests: 1,
rolling_window_size: 60000
},
raw_endpoints: %{
private: [
%{
auth: false,
cost: 1,
method: :get,
path: "/accountActiveOrders"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/accountInactiveOrders"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/accountLimits"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/accountMetadata"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/accountTxs"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/deposit/history"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/export"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/l1Metadata"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/liquidations"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/pnl"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/positionFunding"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/publicPoolsMetadata"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/referral/points"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/trades"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/transfer/history"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/transferFeeInfo"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/withdraw/history"
},
%{
auth: false,
cost: 1,
method: :post,
path: "/changeAccountTier"
},
%{
auth: false,
cost: 1,
method: :post,
path: "/notification/ack"
}
],
public: [
%{
auth: false,
cost: 1,
method: :get,
path: "/account"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/accountsByL1Address"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/announcement"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/apikeys"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/assetDetails"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/block"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/blockTxs"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/blocks"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/candles"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/currentHeight"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/exchangeStats"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/fastbridge/info"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/funding-rates"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/fundings"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/nextNonce"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/orderBookDetails"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/orderBookOrders"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/orderBooks"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/recentTrades"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/tx"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/txFromL1TxHash"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/txs"
},
%{
auth: false,
cost: 1,
method: :get,
path: "/withdrawalDelay"
},
%{
auth: false,
cost: 1,
method: :post,
path: "/sendTx"
},
%{
auth: false,
cost: 1,
method: :post,
path: "/sendTxBatch"
}
]
},
required_credentials: %{
api_key: false,
password: false,
secret: false,
uid: false
},
requires_eddsa: false,
response_error: %{
code_field: "code",
field: "code",
message_field: "msg",
success_values: [
"0"
],
type: :success_code
},
signing: %{
confidence: :medium,
pattern: :hmac_sha256_headers
},
spec_format_version: 2,
status: %{
"eta" => nil,
"status" => "ok",
"updated" => nil,
"url" => nil
},
symbol_format: nil,
symbol_formats: %{
precision_mode: 4,
sample_limits: %{
"amount" => %{
"min" => 15
},
"cost" => %{
"min" => 10
},
"price" => %{}
},
sample_precision: %{
"amount" => 0.1,
"price" => 1.0e-5
},
swap: %{
base: "DYDX",
base_id: "DYDX",
case: :upper,
contract: true,
contract_size: 1,
id: "62",
inverse: false,
limits: %{
"amount" => %{
"min" => 15
},
"cost" => %{
"min" => 10
},
"leverage" => %{},
"price" => %{}
},
linear: true,
maker: 0,
precision: %{
"amount" => 0.1,
"price" => 1.0e-5
},
quote: "USDC",
quote_id: "USDC",
separator: "",
settle: "USDC",
settle_id: "USDC",
symbol: "DYDX/USDC:USDC",
taker: 0
}
},
symbol_patterns: %{
swap: %{
case: :upper,
component_order: nil,
date_format: nil,
pattern: :implicit,
prefix: nil,
separator: "",
suffix: nil
}
},
timeframes: %{
"12h" => "12h",
"15m" => "15m",
"1d" => "1d",
"1h" => "1h",
"1m" => "1m",
"1w" => "1w",
"30m" => "30m",
"4h" => "4h",
"5m" => "5m"
},
url_strategy: %{
detected_from: "sign_method",
pattern: :api_version_slash,
prefix: "/api/v1/"
},
urls: %{
api: "https://mainnet.zklighter.elliot.ai",
api_sections: %{
"private" => "https://mainnet.zklighter.elliot.ai",
"public" => "https://mainnet.zklighter.elliot.ai",
"root" => "https://mainnet.zklighter.elliot.ai"
},
doc: "https://apidocs.lighter.xyz/",
other: nil,
sandbox: %{
"private" => "https://testnet.zklighter.elliot.ai",
"public" => "https://testnet.zklighter.elliot.ai",
"root" => "https://testnet.zklighter.elliot.ai"
},
www: "https://lighter.xyz/"
},
version: "v1",
ws: %{
channel_templates: %{
watch_liquidations: %{
market_id_format: :native,
params: [],
pattern: :type_topic,
separator: ":"
},
watch_mark_price: %{
market_id_format: :native,
params: [],
pattern: :type_topic,
separator: ":"
},
watch_mark_prices: %{
market_id_format: :native,
params: [],
pattern: :type_topic,
separator: ":"
},
watch_order_book: %{
market_id_format: :native,
params: [
%{
"default" => nil,
"name" => "limit"
}
],
pattern: :type_topic,
separator: ":"
},
watch_ticker: %{
market_id_format: :native,
params: [],
pattern: :type_topic,
separator: ":"
},
watch_tickers: %{
market_id_format: :native,
params: [],
pattern: :type_topic,
separator: ":"
},
watch_trades: %{
market_id_format: :native,
params: [],
pattern: :type_topic,
separator: ":"
}
},
has: %{
watch_balance: false,
watch_bids_asks: false,
watch_funding_rate: false,
watch_funding_rates: false,
watch_liquidations: true,
watch_liquidations_for_symbols: false,
watch_mark_price: true,
watch_mark_prices: true,
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: true,
watch_order_book_for_symbols: false,
watch_orders: false,
watch_orders_for_symbols: nil,
watch_position: nil,
watch_positions: false,
watch_status: nil,
watch_ticker: true,
watch_tickers: true,
watch_trades: true,
watch_trades_for_symbols: false
},
hostname: "zklighter.elliot.ai",
message_patterns: [
%{
args_field: "channel",
format: :type,
keys: [
"channel",
"type"
],
kind_field: "type",
kind_value: "subscribe",
sources: [
:send,
:watch,
:watch_multiple
]
},
%{
args_field: "channel",
format: :type,
keys: [
"channel",
"type"
],
kind_field: "type",
kind_value: "unsubscribe",
sources: [
:send,
:watch
]
}
],
subscription_config: %{
args_field: "topic",
args_format: :string,
market_id_format: :native,
op_field: "type",
separator: ":"
},
subscription_pattern: :type_subscribe,
test_urls: "wss://testnet.zklighter.elliot.ai/stream",
urls: "wss://mainnet.zklighter.elliot.ai/stream",
watch_methods: [
"watchLiquidations",
"watchMarkPrice",
"watchMarkPrices",
"watchOrderBook",
"watchTicker",
"watchTickers",
"watchTrades"
]
}
}