Last executed prices to include Back & Lay

Hi there,

For my application, I need to know the last executed price for BOTH back & lay of contracts. Initially I went to the endpoint /last_executed_prices for a set of markets which returns, as you’d expect, the last matched price for each contract with those markets. However, this endpoint doesn’t specify whether this was a lay or back price. Would it be possible to incorporate this?

I have looked at the /quotes endpoint as well & while that offers multiple prices on either side (bids (lays), offers (backs)), there is no timestamp to say when that price was matched so I cannot know the last matched price for each side. I’ve found that with that call however, that the 1st item in the array but I am unsure on relying on that. Is it certain that the last executed price is always the 1st element in the array?

At the moment, a response I am getting from /last_executed_prices is:

{
    "last_executed_prices": {
        "9189716": [
            {
                "contract_id": "32065103",
                "last_executed_price": "30.3",
                "timestamp": "2019-11-20T22:08:52.165553Z"
            },
            {
                "contract_id": "32065102",
                "last_executed_price": "24.39",
                "timestamp": "2019-11-20T22:00:19.267288Z"
            },
            {
                "contract_id": "32065101",
                "last_executed_price": "45.05",
                "timestamp": "2019-11-20T22:01:54.864781Z"
            }
        ]
    }
}

And the /quotes response matching that was:

{
    "32065101": {
        "bids": [
            {
                "price": 4386,
                "quantity": 1594043
            },
            {
                "price": 4274,
                "quantity": 2924700
            },
            {
                "price": 4237,
                "quantity": 1850424
            },
            {
                "price": 4065,
                "quantity": 1928720
            }
        ],
        "offers": [
            {
                "price": 4630,
                "quantity": 3813394
            },
            {
                "price": 4854,
                "quantity": 3126461
            },
            {
                "price": 5000,
                "quantity": 500000
            },
            {
                "price": 5051,
                "quantity": 3250913
            },
            {
                "price": 9999,
                "quantity": 494949
            }
        ]
    },
    "32065102": {
        "bids": [
            {
                "price": 2439,
                "quantity": 9655564
            },
            {
                "price": 2381,
                "quantity": 9890769
            },
            {
                "price": 2326,
                "quantity": 8073244
            },
            {
                "price": 2273,
                "quantity": 5499300
            }
        ],
        "offers": [
            {
                "price": 2532,
                "quantity": 8877537
            },
            {
                "price": 2667,
                "quantity": 7396170
            },
            {
                "price": 2857,
                "quantity": 7592904
            },
            {
                "price": 2899,
                "quantity": 862366
            }
        ]
    },
    "32065103": {
        "bids": [
            {
                "price": 3030,
                "quantity": 7397733
            },
            {
                "price": 2941,
                "quantity": 21958257
            },
            {
                "price": 2899,
                "quantity": 18230553
            }
        ],
        "offers": [
            {
                "price": 3077,
                "quantity": 21985002
            },
            {
                "price": 3125,
                "quantity": 800000
            },
            {
                "price": 3279,
                "quantity": 1859800
            },
            {
                "price": 3333,
                "quantity": 22829184
            },
            {
                "price": 3448,
                "quantity": 21655677
            }
        ]
    }
}

What I am primarily asking for is to add the side (back/lay or bid/offer) to the /last_executed_prices. If that’s not possible, is it possible to add a timestamp to each price in /quotes?

Also, sorry if there is another way to do this & I have just not found it yet.

Cheers,
Will

Hey Will. If a trade has been executed by definition there has been both a back and a lay so I’m not entirely sure what it is you’re looking for at the moment. If you could give a bit more information on what exactly you’re trying to do or see we’ll do our best to help out.

Sorry for the late reply here. If you look at the examples I have given, looking at contract “32065103” I can see that the last price on that contract was 30.30%. I can map this if I look at the same contract within the /quotes response & within bids array, the 1st element within that array has a price of 30.30%. Therefore, I can clearly see that the last executed price on this contract was a bid but what about the last price for an offer? If I look at the same contract with /quotes, I can see that the last offer was for a price of 30.77%. As well as incorporating the last price regardless of side into /last_executed_price, is it also possible to make this specific to side? An example response of what I’m referring to is:

{
    "last_executed_prices": {
        "9189716": [
            {
                "contract_id": "32065103",
                "bid": {
                    "last_executed_price": "30.3"
                    "timestamp": "2019-11-20T22:00:19.267288Z"
                },
                "offer": {
                    "last_executed_price": "30.7",
                    "timestamp": "2019-11-20T22:00:20.267288Z"
                }
            }
        ]
    }
}

The timestamp on the offer is just arbitrary so pay no attention. This example response is so I would know the last price on both sides.

Would this be possible to do? If not, is it possible to add a timestamp property to all the quotes in the /quotes response so I can be assured that I am getting the last executed price

Thank you