Skip to content

lighter

github-actions[bot] edited this page May 8, 2026 · 4 revisions

lighter{docsify-ignore}

Kind: global class
Extends: Exchange

preLoadLighterLibrary{docsify-ignore}

if the required credentials are available in options, it will pre-load the lighter Signer to avoid delaying sensitive calls like createOrder the first time they're executed

Kind: instance method of lighter
Returns: boolean - true if the signer was loaded, false otherwise

Param
params
lighter.preLoadLighterLibrary (params, [undefined])

createOrder{docsify-ignore}

create a trade order

Kind: instance method of lighter
Returns: object - an order structure

Param Type Required Description
symbol string Yes unified symbol of the market to create an order in
type string Yes 'market' or 'limit'
side string Yes 'buy' or 'sell'
amount float Yes how much of currency you want to trade in units of base currency
price float No the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
params object No extra parameters specific to the exchange API endpoint
params.timeInForce string No 'GTT' or 'IOC', default is 'GTT'
params.clientOrderId int No client order id, should be unique for each order, default is a random number
params.triggerPrice string No trigger price for stop loss or take profit orders, in units of the quote currency
params.reduceOnly boolean No whether the order is reduce only, default false
params.nonce int No nonce for the account
params.apiKeyIndex int No apiKeyIndex
params.accountIndex int No accountIndex
params.orderExpiry int No orderExpiry
lighter.createOrder (symbol, type, side, amount[, price, params])

editOrder{docsify-ignore}

cancels an order and places a new order

Kind: instance method of lighter
Returns: object - an order structure

Param Type Required Description
id string Yes order id
symbol string Yes unified symbol of the market to create an order in
type string Yes 'market' or 'limit'
side string Yes 'buy' or 'sell'
amount float Yes how much of the currency you want to trade in units of the base currency
price float No the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.apiKeyIndex string No api key index
lighter.editOrder (id, symbol, type, side, amount[, price, params])

fetchStatus{docsify-ignore}

the latest known information on the availability of the exchange API

Kind: instance method of lighter
Returns: object - a status structure

See: https://apidocs.lighter.xyz/reference/status

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
lighter.fetchStatus ([params])

fetchTime{docsify-ignore}

fetches the current integer timestamp in milliseconds from the exchange server

Kind: instance method of lighter
Returns: int - the current integer timestamp in milliseconds from the exchange server

See: https://apidocs.lighter.xyz/reference/status

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
lighter.fetchTime ([params])

fetchMarkets{docsify-ignore}

retrieves data on all markets for lighter

Kind: instance method of lighter
Returns: Array<object> - an array of objects representing market data

See: https://apidocs.lighter.xyz/reference/orderbookdetails

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
lighter.fetchMarkets ([params])

fetchCurrencies{docsify-ignore}

fetches all available currencies on an exchange

Kind: instance method of lighter
Returns: object - an associative dictionary of currencies

See: https://apidocs.lighter.xyz/reference/assetdetails

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
lighter.fetchCurrencies ([params])

fetchOrderBook{docsify-ignore}

fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of lighter
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://apidocs.lighter.xyz/reference/orderbookorders

Param Type Required Description
symbol string Yes unified symbol of the market to fetch the order book for
limit int No the maximum amount of order book entries to return
params object No extra parameters specific to the exchange API endpoint
lighter.fetchOrderBook (symbol[, limit, params])

fetchTicker{docsify-ignore}

fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

Kind: instance method of lighter
Returns: object - a ticker structure

See: https://apidocs.lighter.xyz/reference/orderbookdetails

Param Type Required Description
symbol string Yes unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
lighter.fetchTicker (symbol[, params])

fetchTickers{docsify-ignore}

fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

Kind: instance method of lighter
Returns: object - a dictionary of ticker structures

See: https://apidocs.lighter.xyz/reference/orderbookdetails

Param Type Required Description
symbols Array<string>, undefined Yes unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
params object No extra parameters specific to the exchange API endpoint
lighter.fetchTickers (symbols[, params])

fetchOHLCV{docsify-ignore}

fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

Kind: instance method of lighter
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume

See: https://apidocs.lighter.xyz/reference/candles

Param Type Required Description
symbol string Yes unified symbol of the market to fetch OHLCV data for
timeframe string Yes the length of time each candle represents
since int No timestamp in ms of the earliest candle to fetch
limit int No the maximum amount of candles to fetch
params object No extra parameters specific to the exchange API endpoint
params.until int No timestamp in ms of the latest candle to fetch
lighter.fetchOHLCV (symbol, timeframe[, since, limit, params])

fetchFundingRates{docsify-ignore}

fetch the current funding rate for multiple symbols

Kind: instance method of lighter
Returns: Array<object> - a list of funding rate structures

See: https://apidocs.lighter.xyz/reference/funding-rates

Param Type Required Description
symbols Array<string> No list of unified market symbols
params object No extra parameters specific to the exchange API endpoint
lighter.fetchFundingRates ([symbols, params])

fetchPosition{docsify-ignore}

fetch data on an open position

Kind: instance method of lighter
Returns: object - a position structure

See: https://apidocs.lighter.xyz/reference/account-1

Param Type Required Description
symbol string Yes unified market symbol of the market the position is held in
params object No extra parameters specific to the exchange API endpoint
params.by string No fetch balance by 'index' or 'l1_address', defaults to 'index'
params.value string No fetch balance value, account index or l1 address
lighter.fetchPosition (symbol[, params])

fetchPositions{docsify-ignore}

fetch all open positions

Kind: instance method of lighter
Returns: Array<object> - a list of position structure

See: https://apidocs.lighter.xyz/reference/account-1

Param Type Required Description
symbols Array<string> No list of unified market symbols
params object No extra parameters specific to the exchange API endpoint
params.by string No fetch balance by 'index' or 'l1_address', defaults to 'index'
params.value string No fetch balance value, account index or l1 address
lighter.fetchPositions ([symbols, params])

fetchAccounts{docsify-ignore}

fetch all the accounts associated with a profile

Kind: instance method of lighter
Returns: object - a dictionary of account structures indexed by the account type

See: https://apidocs.lighter.xyz/reference/account-1

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
params.by string No fetch balance by 'index' or 'l1_address', defaults to 'index'
params.value string No fetch balance value, account index or l1 address
lighter.fetchAccounts ([params])

fetchOpenOrders{docsify-ignore}

fetch all unfilled currently open orders

Kind: instance method of lighter
Returns: Array<Order> - a list of order structures

See: https://apidocs.lighter.xyz/reference/accountactiveorders

Param Type Required Description
symbol string Yes unified market symbol
since int No the earliest time in ms to fetch open orders for
limit int No the maximum number of open orders structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
lighter.fetchOpenOrders (symbol[, since, limit, params])

fetchClosedOrders{docsify-ignore}

fetch all unfilled currently closed orders

Kind: instance method of lighter
Returns: Array<Order> - a list of order structures

See: https://apidocs.lighter.xyz/reference/accountinactiveorders

Param Type Required Description
symbol string Yes unified market symbol
since int No the earliest time in ms to fetch open orders for
limit int No the maximum number of open orders structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
lighter.fetchClosedOrders (symbol[, since, limit, params])

transfer{docsify-ignore}

transfer currency internally between wallets on the same account

Kind: instance method of lighter
Returns: object - a transfer structure

Param Type Required Description
code string Yes unified currency code
amount float Yes amount to transfer
fromAccount string Yes account to transfer from (spot, perp)
toAccount string Yes account to transfer to (spot, perp)
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.toAccountIndex string No to account index, defaults to fromAccountIndex
params.apiKeyIndex string No api key index
params.memo string No hex encoding memo
lighter.transfer (code, amount, fromAccount, toAccount[, params])

fetchTransfers{docsify-ignore}

fetch a history of internal transfers made on an account

Kind: instance method of lighter
Returns: Array<object> - a list of transfer structures

See: https://apidocs.lighter.xyz/reference/transfer_history

Param Type Required Description
code string Yes unified currency code of the currency transferred
since int No the earliest time in ms to fetch transfers for
limit int No the maximum number of transfers structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
lighter.fetchTransfers (code[, since, limit, params])

fetchDeposits{docsify-ignore}

fetch all deposits made to an account

Kind: instance method of lighter
Returns: Array<object> - a list of transaction structures

See: https://apidocs.lighter.xyz/reference/deposit_history

Param Type Required Description
code string No unified currency code
since int No the earliest time in ms to fetch deposits for
limit int No the maximum number of deposits structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.address string No l1_address
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
lighter.fetchDeposits ([code, since, limit, params])

fetchWithdrawals{docsify-ignore}

fetch all withdrawals made from an account

Kind: instance method of lighter
Returns: Array<object> - a list of transaction structures

See: https://apidocs.lighter.xyz/reference/withdraw_history

Param Type Required Description
code string No unified currency code
since int No the earliest time in ms to fetch withdrawals for
limit int No the maximum number of withdrawals structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
lighter.fetchWithdrawals ([code, since, limit, params])

withdraw{docsify-ignore}

make a withdrawal

Kind: instance method of lighter
Returns: object - a transaction structure

Param Type Required Description
code string Yes unified currency code
amount float Yes the amount to withdraw
address string Yes the address to withdraw to
tag string No
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.apiKeyIndex string No api key index
params.routeType int No wallet type, 0: perp, 1: spot, default is 0
lighter.withdraw (code, amount, address[, tag, params])

fetchMyTrades{docsify-ignore}

fetch all trades made by the user

Kind: instance method of lighter
Returns: Array<object> - a list of trade structures

See: https://apidocs.lighter.xyz/reference/trades

Param Type Required Description
symbol string No unified market symbol
since int No the earliest time in ms to fetch trades for
limit int No the maximum number of trades structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
params.until int No timestamp in ms of the latest trade to fetch
lighter.fetchMyTrades ([symbol, since, limit, params])

setLeverage{docsify-ignore}

set the level of leverage for a market

Kind: instance method of lighter
Returns: object - response from the exchange

Param Type Required Description
leverage float Yes the rate of leverage
symbol string Yes unified market symbol
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.apiKeyIndex string No api key index
params.marginMode string No margin mode, 'cross' or 'isolated'
lighter.setLeverage (leverage, symbol[, params])

setMarginMode{docsify-ignore}

set margin mode to 'cross' or 'isolated'

Kind: instance method of lighter
Returns: object - response from the exchange

Param Type Required Description
marginMode string Yes 'cross' or 'isolated'
symbol string Yes unified market symbol
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.apiKeyIndex string No api key index
params.leverage int No required leverage
lighter.setMarginMode (marginMode, symbol[, params])

cancelOrder{docsify-ignore}

cancels an open order

Kind: instance method of lighter
Returns: object - an order structure

Param Type Required Description
id string Yes order id
symbol string Yes unified symbol of the market the order was made in
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.apiKeyIndex string No api key index
lighter.cancelOrder (id, symbol[, params])

cancelAllOrders{docsify-ignore}

cancel all open orders

Kind: instance method of lighter
Returns: Array<object> - a list of order structures

Param Type Required Description
symbol string No unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
params object No extra parameters specific to the exchange API endpoint
params.accountIndex string No account index
params.apiKeyIndex string No api key index
lighter.cancelAllOrders ([symbol, params])

cancelAllOrdersAfter{docsify-ignore}

dead man's switch, cancel all orders after the given timeout

Kind: instance method of lighter
Returns: object - the api result

Param Type Required Description
timeout number Yes time in milliseconds, 0 represents cancel the timer
params object No extra parameters specific to the exchange API endpoint
lighter.cancelAllOrdersAfter (timeout[, params])

addMargin{docsify-ignore}

add margin

Kind: instance method of lighter
Returns: object - a margin structure

Param Type Required Description
symbol string Yes unified market symbol
amount float Yes amount of margin to add
params object No extra parameters specific to the exchange API endpoint
lighter.addMargin (symbol, amount[, params])

reduceMargin{docsify-ignore}

remove margin from a position

Kind: instance method of lighter
Returns: object - a margin structure

Param Type Required Description
symbol string Yes unified market symbol
amount float Yes the amount of margin to remove
params object No extra parameters specific to the exchange API endpoint
lighter.reduceMargin (symbol, amount[, params])

setMargin{docsify-ignore}

Either adds or reduces margin in an isolated position in order to set the margin to a specific value

Kind: instance method of lighter
Returns: object - A margin structure

Param Type Required Description
symbol string Yes unified market symbol of the market to set margin in
amount float Yes the amount to set the margin to
params object No parameters specific to the bingx api endpoint
params.accountIndex string No account index
params.apiKeyIndex string No api key index
lighter.setMargin (symbol, amount[, params])

watchOrders{docsify-ignore}

watches information on multiple orders made by the user

Kind: instance property of lighter
Returns: Array<object> - a list of order structures

See: https://apidocs.lighter.xyz/docs/websocket-reference#account-all-orders

Param Type Required Description
symbol string Yes unified market symbol of the market orders were made in
since int No the earliest time in ms to fetch orders for
limit int No the maximum number of order structures to retrieve
params object No extra parameters specific to the exchange API endpoint
lighter.watchOrders (symbol[, since, limit, params])

watchOrderBook{docsify-ignore}

watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of lighter
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://apidocs.lighter.xyz/docs/websocket-reference#order-book

Param Type Required Description
symbol string Yes unified symbol of the market to fetch the order book for
limit int No the maximum amount of order book entries to return
params object No extra parameters specific to the exchange API endpoint
lighter.watchOrderBook (symbol[, limit, params])

unWatchOrderBook{docsify-ignore}

unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of lighter
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://apidocs.lighter.xyz/docs/websocket-reference#order-book

Param Type Required Description
symbol string Yes unified symbol of the market
params object No extra parameters specific to the exchange API endpoint
lighter.unWatchOrderBook (symbol[, params])

watchTicker{docsify-ignore}

watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

Kind: instance method of lighter
Returns: object - a ticker structure

See: https://apidocs.lighter.xyz/docs/websocket-reference#market-stats

Param Type Required Description
symbol string Yes unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
lighter.watchTicker (symbol[, params])

unWatchTicker{docsify-ignore}

unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list

Kind: instance method of lighter
Returns: object - a ticker structure

See: https://apidocs.lighter.xyz/docs/websocket-reference#market-stats

Param Type Required Description
symbol string Yes unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
lighter.unWatchTicker (symbol[, params])

watchTickers{docsify-ignore}

watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list

Kind: instance method of lighter
Returns: object - a ticker structure

See: https://apidocs.lighter.xyz/docs/websocket-reference#market-stats

Param Type Required Description
symbols Array<string> No unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
params.channel string No the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
lighter.watchTickers ([symbols, params])

unWatchTickers{docsify-ignore}

unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list

Kind: instance method of lighter
Returns: object - a ticker structure

See: https://apidocs.lighter.xyz/docs/websocket-reference#market-stats

Param Type Required Description
symbols Array<string> No unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
lighter.unWatchTickers ([symbols, params])

watchMarkPrice{docsify-ignore}

watches a mark price

Kind: instance method of lighter
Returns: object - a ticker structure

See: https://apidocs.lighter.xyz/docs/websocket-reference#market-stats

Param Type Required Description
symbol string Yes unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
lighter.watchMarkPrice (symbol[, params])

watchMarkPrices{docsify-ignore}

watches mark prices

Kind: instance method of lighter
Returns: object - a ticker structure

See: https://apidocs.lighter.xyz/docs/websocket-reference#market-stats

Param Type Required Description
symbols Array<string> No unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
lighter.watchMarkPrices ([symbols, params])

unWatchMarkPrice{docsify-ignore}

unWatches a mark price

Kind: instance method of lighter
Returns: object - a ticker structure

See: https://apidocs.lighter.xyz/docs/websocket-reference#market-stats

Param Type Required Description
symbol string Yes unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
lighter.unWatchMarkPrice (symbol[, params])

unWatchMarkPrices{docsify-ignore}

unWatches mark prices

Kind: instance method of lighter
Returns: object - a ticker structure

See: https://apidocs.lighter.xyz/docs/websocket-reference#market-stats

Param Type Required Description
symbols Array<string> No unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
lighter.unWatchMarkPrices ([symbols, params])

watchTrades{docsify-ignore}

get the list of most recent trades for a particular symbol

Kind: instance method of lighter
Returns: Array<object> - a list of trade structures

See: https://apidocs.lighter.xyz/docs/websocket-reference#trade

Param Type Required Description
symbol string Yes unified symbol of the market to fetch trades for
since int No timestamp in ms of the earliest trade to fetch
limit int No the maximum amount of trades to fetch
params object No extra parameters specific to the exchange API endpoint
lighter.watchTrades (symbol[, since, limit, params])

unWatchTrades{docsify-ignore}

unsubscribe from the trades channel

Kind: instance method of lighter
Returns: Array<object> - a list of trade structures

See: https://apidocs.lighter.xyz/docs/websocket-reference#trade

Param Type Required Description
symbol string Yes unified symbol of the market to fetch trades for
params object No extra parameters specific to the exchange API endpoint
lighter.unWatchTrades (symbol[, params])

watchMyTrades{docsify-ignore}

subscribe to recent trades of an account.

Kind: instance method of lighter
Returns: Array<object> - a list of trade structures

See: https://apidocs.lighter.xyz/docs/websocket-reference#account-all-trades

Param Type Required Description
symbol string No unified market symbol
since int No timestamp in ms of the earliest trade to fetch
limit int No the maximum amount of trades to fetch
params object No extra parameters specific to the exchange API endpoint
lighter.watchMyTrades ([symbol, since, limit, params])

unWatchMyTrades{docsify-ignore}

unsubscribe from the account trades channel

Kind: instance method of lighter
Returns: Array<object> - a list of trade structures

See: https://apidocs.lighter.xyz/docs/websocket-reference#account-all-trades

Param Type Required Description
symbol string No unified market symbol
params object No extra parameters specific to the exchange API endpoint
lighter.unWatchMyTrades ([symbol, params])

watchLiquidations{docsify-ignore}

watch the public liquidations of a trading pair

Kind: instance method of lighter
Returns: Array<object> - a list of trade structures

See: https://apidocs.lighter.xyz/docs/websocket-reference#trade

Param Type Required Description
symbol string Yes unified symbol of the market to fetch trades for
since int No timestamp in ms of the earliest trade to fetch
limit int No the maximum amount of trades to fetch
params object No extra parameters specific to the exchange API endpoint
lighter.watchLiquidations (symbol[, since, limit, params])

watchBalance{docsify-ignore}

watch balance and get the amount of funds available for trading or funds locked in orders

Kind: instance method of lighter
Returns: object - a balance structure

See: https://apidocs.lighter.xyz/docs/websocket-reference#account-all-assets

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
params.type string No 'spot' or 'swap', default is 'swap'
lighter.watchBalance ([params])

unWatchOrders{docsify-ignore}

unWatches information on multiple orders made by the user

Kind: instance method of lighter
Returns: Array<object> - a list of order structures

See: https://apidocs.lighter.xyz/docs/websocket-reference#account-all-orders

Param Type Required Description
symbol string Yes unified market symbol of the market orders were made in
params object No extra parameters specific to the exchange API endpoint
lighter.unWatchOrders (symbol[, params])

Clone this wiki locally