drift-labs/protocol-v2

PlaceAndTakePerpOrder transactions succeed but no trade is actually executed.

Opened this issue · 3 comments

Gsuz commented

When using placeAndTakePerpOrder I'm seeing that only a very small % of transactions actually result in a sucessfull trade. Transactions are run and they are sucessfully run but it does not result in a trade. I'm not sure why this is. Is this normal and by design? Compared to when I use placeAndMakeOrder they always result in a trade when the transaction succeeds.

I've been comparing the sdk code for these functions an I can see that PlaceAndTakePerpOrder actually passes in null instead of an orderId here ->
https://github.com/drift-labs/protocol-v2/blob/6314d47775dc7c126ab9096b750bfc21ec1c80b9/sdk/src/driftClient.ts#L4825C4-L4825C9

Compared to PlaceAndMakePerpOrder which acutally passes in the orderId as you can see here ->

return await this.program.instruction.placeAndMakePerpOrder(

Is this a bug?

This is intended since it allows you to place an order and have it stay open at the end of the tx.

We could potentially introduce a fill or kill flag and make use of the unused maker order id field

Gsuz commented

Could you explain the different scenarios on why no trade is happening, does the order we are trying to take not exist anymore, is the price wrong? what is going on. We really need some documentation on this function