docs: 更新 lighter-python-main 文档,添加示例代码和 API 说明,重构部分内容以提高可读性

This commit is contained in:
discountry
2025-09-30 18:35:14 +08:00
parent d6533733c9
commit e83bdfccf9
337 changed files with 50410 additions and 0 deletions
@@ -0,0 +1,24 @@
import json
import logging
import asyncio
import lighter
logging.basicConfig(level=logging.INFO)
def on_order_book_update(market_id, order_book):
logging.info(f"Order book {market_id}:\n{json.dumps(order_book, indent=2)}")
def on_account_update(account_id, account):
logging.info(f"Account {account_id}:\n{json.dumps(account, indent=2)}")
client = lighter.WsClient(
order_book_ids=[0, 1],
account_ids=[1, 2],
on_order_book_update=on_order_book_update,
on_account_update=on_account_update,
)
asyncio.run(client.run_async())