serum-ts
serum-ts copied to clipboard
How can we retrieve just one specific open order?
How can we retrieve the information of just only one specific open order instead of loading all of them?
For example, we have this documentation here: https://github.com/project-serum/serum-ts/tree/master/packages/serum
But we only have an example to be retrieving the info for all open orders, so if we are working with several markets this would be very time-consuming.
Maybe we could have something like:
await market.loadOrdersForOwner({ connection: connection, onwer: owner.publicKey, clientId: clientId });
await market.loadOrdersForOwner({ connection: connection, onwer: owner.publicKey, exchangeId: exchangeId });
or
await market.loadOrdersForOwner(connection, owner.publicKey, clientId);
await market.loadOrdersForOwner(connection, owner.publicKey, undefined, exchangeId);
Maybe you can rewrite this function in OpenOrder
class to get all orders without filtering them by market. And then find your order using clientId
or orderId
. But hopefully they will provide us a way to actually filter it like you said 😄
static async findForMarketAndOwner()
p/s: For loadOrdersForOwner()
, they ensured that your orders actually get into the Orderbook
by filter orders in the OpenOrders
with those in bids
and asks
. I think you can skip those in your custom function if you just need the order info