The key to executing a successful programmatic trading strategy is ensuring that you are working with the most up-to-date information.
The information required to assess the market, orderbooks, your current positions, open orders and balances could involve reading data from anything between 10-50+ Solana accounts (depending on the number of outcomes in a market).
Most traders are likely interacting with and trading on a large number of markets in parallel.
Loading and refreshing markets in a maximally efficient manner is key to enabling an experience on-par with trading on a web2 exchange. For that reason, the SDK includes a number of helper tools to optimize the process for refreshing AverMarket and UserMarket objects in-memory with as few batched requests as possible.
The method used here will first check whether a UMA already exists for this wallet and market, and if so, load that. Otherwise, if not, it will handle the process to create one.
If you are intending on developing your own interface with the Solana blockchain and Aver protocol, we suggest you take the time to understand the finer points of Solana RPC Node interactions, rate limits and approaches to optimizing requests for information from them to synchronize clientside state.
from pyaver.refresh import refresh_user_market
uma = await refresh_user_market(client, uma)
market = uma.market
There are a number of other, similar helper refresh functions:
- Refresh_market() - For refreshing an AverMarket object
- Refresh_multiple_user_markets() - For many UserMarket objects
- Refresh_multiple_markets() - For many AverMarket objects