Python SDK for Lighter
Python 3.8+
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/elliottech/lighter-python.gitThen import the package:
import lighterExecute pytest to run the tests.
Please follow the installation procedure and then run the following:
import lighter
import asyncio
async def main():
client = lighter.ApiClient()
account_api = lighter.AccountApi(client)
account = await account_api.get_account(by="index", value="1")
print(account)
if __name__ == "__main__":
asyncio.run(main())python examples/get_info.pypython examples/ws.pypython examples/create_cancel_order.pyAll URIs are relative to https://mainnet.zklighter.elliot.ai
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AccountApi | account | GET /api/v1/account | account |
| AccountApi | accounts_by_l1_address | GET /api/v1/accountsByL1Address | accountsByL1Address |
| AccountApi | apikeys | GET /api/v1/apikeys | apikeys |
| AccountApi | pnl | GET /api/v1/pnl | pnl |
| AccountApi | public_pools | GET /api/v1/publicPools | publicPools |
| BlockApi | block | GET /api/v1/block | block |
| BlockApi | blocks | GET /api/v1/blocks | blocks |
| BlockApi | current_height | GET /api/v1/currentHeight | currentHeight |
| CandlestickApi | candlesticks | GET /api/v1/candlesticks | candlesticks |
| CandlestickApi | fundings | GET /api/v1/fundings | fundings |
| OrderApi | account_inactive_orders | GET /api/v1/accountInactiveOrders | accountInactiveOrders |
| OrderApi | exchange_stats | GET /api/v1/exchangeStats | exchangeStats |
| OrderApi | order_book_details | GET /api/v1/orderBookDetails | orderBookDetails |
| OrderApi | order_book_orders | GET /api/v1/orderBookOrders | orderBookOrders |
| OrderApi | order_books | GET /api/v1/orderBooks | orderBooks |
| OrderApi | recent_trades | GET /api/v1/recentTrades | recentTrades |
| OrderApi | trades | GET /api/v1/trades | trades |
| RootApi | info | GET /info | info |
| RootApi | status | GET / | status |
| TransactionApi | account_txs | GET /api/v1/accountTxs | accountTxs |
| TransactionApi | block_txs | GET /api/v1/blockTxs | blockTxs |
| TransactionApi | deposit_history | GET /api/v1/deposit/history | deposit_history |
| TransactionApi | next_nonce | GET /api/v1/nextNonce | nextNonce |
| TransactionApi | send_tx | POST /api/v1/sendTx | sendTx |
| TransactionApi | send_tx_batch | POST /api/v1/sendTxBatch | sendTxBatch |
| TransactionApi | tx | GET /api/v1/tx | tx |
| TransactionApi | tx_from_l1_tx_hash | GET /api/v1/txFromL1TxHash | txFromL1TxHash |
| TransactionApi | txs | GET /api/v1/txs | txs |
| TransactionApi | withdraw_history | GET /api/v1/withdraw/history | withdraw_history |
- Account
- AccountApiKeys
- AccountMarketStats
- AccountMetadata
- AccountPnL
- AccountPosition
- AccountStats
- ApiKey
- Block
- Blocks
- BridgeSupportedNetwork
- Candlestick
- Candlesticks
- ContractAddress
- CurrentHeight
- Cursor
- DepositHistory
- DepositHistoryItem
- DetailedAccount
- DetailedAccounts
- DetailedCandlestick
- EnrichedTx
- ExchangeStats
- Funding
- Fundings
- L1ProviderInfo
- Liquidation
- MarketInfo
- NextNonce
- Order
- OrderBook
- OrderBookDepth
- OrderBookDetail
- OrderBookDetails
- OrderBookOrders
- OrderBookStats
- OrderBooks
- Orders
- PnLEntry
- PositionFunding
- PriceLevel
- PublicPool
- PublicPoolInfo
- PublicPoolShare
- PublicPools
- ReqGetAccount
- ReqGetAccountApiKeys
- ReqGetAccountByL1Address
- ReqGetAccountInactiveOrders
- ReqGetAccountPnL
- ReqGetAccountTxs
- ReqGetBlock
- ReqGetBlockTxs
- ReqGetByAccount
- ReqGetCandlesticks
- ReqGetDepositHistory
- ReqGetFundings
- ReqGetL1Tx
- ReqGetLatestDeposit
- ReqGetNextNonce
- ReqGetOrderBookDetails
- ReqGetOrderBookOrders
- ReqGetOrderBooks
- ReqGetPublicPools
- ReqGetRangeWithCursor
- ReqGetRangeWithIndex
- ReqGetRangeWithIndexSortable
- ReqGetRecentTrades
- ReqGetTrades
- ReqGetTx
- ReqGetWithdrawHistory
- ResultCode
- SimpleOrder
- Status
- SubAccounts
- Ticker
- Trade
- Trades
- Tx
- TxHash
- TxHashes
- Txs
- ValidatorInfo
- WithdrawHistory
- WithdrawHistoryItem
- ZkLighterInfo