Код:
Код: Выделить всё
from pyserum.connection import conn
from pyserum.market import Market
from solders.pubkey import Pubkey
# Replace with your Serum market address and program ID
market_address = '4k3Dyjzvzp8eTxPZsHNT4X14X5R3FLeGkwWxNGj39fub' # Example for SOL/USDC
serum_program_id = '9xQeWvG8169dZ2ib6KMvZr9VvJHZo2R5mPbiJQF1XhCk' # Standard Serum program ID for mainnet
# Connect to the Solana mainnet-beta cluster
client = conn('')
# Load the market instance using the client, market address, and program ID
market = Market.load(client, Pubkey(market_address), Pubkey(serum_program_id))
# Retrieve the order book data for bids and asks
bids = market.load_bids()
asks = market.load_asks()
# Print order book details
print("Bids:")
for bid in bids:
print(f"Price: {bid.price}, Size: {bid.size}")
print("\nAsks:")
for ask in asks:
print(f"Price: {ask.price}, Size: {ask.size}")
ModuleNotFoundError: нет модуля с именем «solana.publickey».
К вашему сведению, я установил Solana библиотека
Подробнее здесь: https://stackoverflow.com/questions/792 ... using-pyth