Viewing Positions & Orders

Viewing Open Orders and Positions

An array (for each outcome in the market) of current exposures (in units of payout) are maintained in the UserMarketAccount. These exposures are represented as having a 'free' and 'locked' components, where the locked component is held to back an open order, and the locked balance is the maximum which might be called up in the event that an order is struck.
Open order references are also stored within the UserMarket account, indexed by outcome_id and the order_id. The maximum payout units for the order (max_base_qty) is also retained here.
All other information related to the order can obtained by loading the full order node from the orderbook for this outcome_id and finding the node at order_id
uma = await refresh_user_market(client, uma)
# Print all open orders for this market
for order in uma.user_market_state.orders:
print(f'{ order.outcome_id } {order.order_id } {order.base_qty }')
# Print existing positions / exposures resulting from matched bets
for outcome_position in uma.user_market_state.outcome_positions:
print(f'{ } { outcome_position.locked }')
await uma.refresh()
// Print all open orders for this market => console.log(`${o.outcomeId} ${o.orderId} ${o.baseQty}`))
// Print existing positions / exposures resulting from matched bets => console.log(`${} ${order.locked}}`))

Refreshing Information

Of course, you will want to see the latest information reflective of your current positions and orders - consistent with the state represented on-chain.
Please see the Refreshing Information section which discusses the most efficient/optimized way to refresh information and synchronize your client-side state with on-chain state.