Market Price orders - effectiveness of execution (observation) - update 30.09

Stacks address:
{STZCFP3486BF968TPQ3H6DBRK70YKKSAW39CVBTT} testnet

Description:
I continue to see problems with the execution of ‘Market Price’ orders (tests on STX/xUSD pair):face_with_monocle:
Although today is slightly better than the past two days :chart_with_upwards_trend:

Previously, out of 10 orders of this type placed, 5 were rejected (1st screenshot).
Today it was 2 out of 10 :chart_with_upwards_trend: (2nd screenshot).
So, we have an 80% efficiency, compared to 50% previously.

Although I can see that this second order marked in the red box has been partially completed (2nd screenshot).
It was completed at 37%
But still something went wrong :thinking:

Browser:
Google Chrome (version): 105.0.5195.127

Screenshots:

Discord ID:
mike_bear_1.btc#8434

Telegram ID:
@mike_bear_1

2 Likes

A few dozen minutes ago I entered 34 Market Price orders:
12 buy orders Alex (2 rejected) - efficiency 84% :white_check_mark:
11 buy orders STX (1 rejected) - efficiency 91% :white_check_mark:
11 sell orders STX (1 rejected) - efficiency 91% :white_check_mark:

Let’s keep it up and get to 100% :+1:

Screenshots:

Thank you :slightly_smiling_face:

Thanks again Mike for your continued dedication!

I see the same thing today I had no fails on market orders in the BTC pair but several on the other two pairs about 6 “cancelled transactions” out of 45 send. (6 out of 65 or 90% efficient if you include the transactions in the BTC pairs)

ST2PBEZB3ZPHJE1XJHFQKGF6E08SV29K96WCRJA13

1 Like

Thanks to Werner.btc for writing and testing this as well :+1:
I think the best expected result is 100% efficiency
The question is, what are the reasons for rejection / or cancellation of Market Price type orders? :thinking:
If one day we add a stop loss option in Orderbook then the effectiveness of the Market Price option will then be crucial, or even critical. Here’s what I think :slightly_smiling_face:

I totally agree, @Cryptonian is already looking into this. Oscar can you perhaps share what you think is causing these, they look like cancelled transactions, but the users didn’t cancel them… the protocol somehow did.

That’s right :+1:
If there is a cancellation, it happens right after it is approved.
We actually find out about the cancellation after the fact, in the ‘Matched Orders’ tab.

In the past hour, I entered 60 Market Price orders in Alex Orderbook.
20 for each pair of cryptocurrencies, including 10 buy and 10 sell orders.
Here are the results:
xBTC/xUSD: all 20 orders completed successfully = 100% effectiveness
ALEX/xUSD: 3 buy orders and 3 sell orders canceled shortly after the order was placed = 70% effectiveness
STX/xUSD: 4 buy orders and 4 sell orders canceled shortly after the order was placed = 60% efficiency

got it. effectiveness issue.

2 Likes

Exactly, yes, in fact:+1: :slightly_smiling_face:

1 Like

First of all, thank you @mike_bear_1 @werner.btc for the detailed analysis!
When calculating effectiveness, how do we handle partially filled orders?
Market order is implemented as “IOC”, i.e. whatever can be filled is filled immediately with the balance (unfilled portion) cancelled.
If a market order is entered but then immediately cancelled (either partially or fully), that means the OME could not fill the order based on the prevailing depth of the order book.
We have been improving the execution logic of the market order, so, in absence of lack of market depth, the effectiveness should be 100% (if not, this is a bug, that needs to be investigated).
In terms of the market depth, we have also been improving our market making bot to automatically rebalance its book using AMM liquidity, which should help as and when the upgraded version is deployed to public testnet (currently we are testing this on our private mocknet). At the moment, the market making bot cannot rebalance its book, with the resulting impact primarily felt on STX-xUSD and ALEX-xUSD (because the bot starts with a smaller amount of STX and ALEX, vs. xBTC). So if we see 100% effectiveness on xBTC-xUSD, but a lower number on STX-/ALEX-xUSD, this may have been caused by this inefficiency (in bot design).

2 Likes

Interesting background Chan!
As for the transactions I made, which automatically failed I doubt there was in issue with orderbook depth because I made market orders with very low values compared to available assets. Here is one from today it had a market order for 12 STX fail while the following ones 13, 14, 14 STX etc. are executed without issue. See screenshot.

Does that mean there could still be a bug causing this.

What does “OME” stand for?

1 Like

Would you be able to send the order hash? You can hover over the relevant order (see example below), we can then take a look.
OME stands for Order Matching Engine. As the name implies, it is the core trading engine that matches open orders.

1 Like

Hi, great analysis, thank You :slightly_smiling_face:
And valuable learning material on how it works :+1: