There has been talk for many years about replacing the continuous double auction of the stock market with frequent batch auctions; orders to buy or sell would be accumulated over the course of five minutes, a price set to clear the market, the executable trades at that price executing against each other. The New York Stock Exchange does this twice a day — at the beginning and end of the trading day — and I have in the recesses of my head the notion that there was an ECN 15–20 years ago that in fact did frequent auctions of the sort I'm going to build to, and maybe they used some of the math I've redeveloped to do it. Perhaps they did so without glossing over a problem I'm going to gloss over: I'm going to assume that shares and money are arbitrarily divisible, so that if you ask to buy 100 shares for no more than $5,000, I'm allowed to have you buy 33.2 shares for $1,565.1934 (because that's less than $50 per share times 33.2 shares).

So here's a mathematical way of representing the problem: let x be the number of shares of the stock I want to sell, and y the number of dollars I want for those shares; if I'm trying to buy, these numbers are negative. I'm going to represent the order as a (straight) line segment connecting the origin to this point (x,y). If I take all of the orders, I can construct the Minkowski sum of the corresponding line segments, which is the set of points in the x-y plane that can be achieved by taking one point on each line segment and adding them together. (For example, if I have two line segments that are not parallel, the result will be a parallelogram.) For any point in the Minkowski sum, then, I have an x-coordinate and a y-coordinate, and they correspond to some[1] set of executions[2] of the various trades, with the x-coordinate corresponding to the total (net) number of shares sold, and the y-coordinate to the minimum number of dollars demanded in exchange for that number of shares. In particular, points in the Minkowski sum of the orders — we'll call this set M — for which the x-coordinate is 0 represent combinations of executions that clear the market — the same number of shares are bought as sold — and points in M for which x is 0 and y is negative represent such combinations that clear the market and allow at least some of the market participants to get a better price than they had insisted on.[3] We are especially interested in the point in M with x=0 and the smallest possible value of y; we are also interested in the slope of the boundary of M there.[4] It turns out that this slope is the "correct" price to use; anyone who wants to buy at a higher price or sell at a lower price can trade the full amount of their order at that price, while those orders with that exact per-share price may be filled, not filled, or partially filled in order to make sure that the net number of shares traded is 0.

Now, the slightly more interesting thing I might want to do — and, again, I think there was an ECN doing this at the turn of the millennium — is say "I'd like to buy 100 shares of ABC minus 50 shares of XYZ for up to $2,000, but am only willing to trade insofar as I get them in that 2:-1 ratio."[5] Now we have two kinds of shares, and we have line segments in a three-dimensional space: one dimension for each kind of stock (x

_{1}and x

_{2}, say), and one for money (still y). Minkowski sums can be constructed as well in three dimensions as in two, and now we're looking for the smallest y such that x

_{1}=x

_{2}=0 and the "slope" there is now two slopes,[6] and we thus get prices for both stocks, but with orders of this sort in the mix, they aren't independent of each other; they have to be calculated jointly.[7]

Well, here's an idea I've had that I don't think was in that ECN, possibly for good reason. One problem with

*infrequent*batch auctions would be how brokers and shareholders would handle margin calls; if the value of my portfolio drops enough in an auction to trigger a margin call, such that I'm compelled to sell stock, which stock I sell may depend on the stocks' price. To the extent that the previous auction's results are likely to be similar to the next one's, there may be a clear choice, but it struck me as interesting and perhaps possible to allow trades of the form, "sell whichever of (list of five baskets of stocks) has the highest price"; in fact, I can include a limit price, such that I don't sell any of them if the price is below a certain level.[8] The order is no longer a line segment; it is now a simplex[9] with six vertices, one at the origin and one at (basket,limit price) for each basket. The rest, perhaps surprisingly, goes through as before; the slope of the boundary of the Minkowski sum at the point at which the markets clear most profitably will set the prices of the stocks and (therefore) of the baskets.[10]

[1] not necessarily unique

[2] Or partial executions, or non-executions; some fraction between 0 and 1 of the trade has executed.

[3] Note that the origin is in each line segment, and thus is also in the Minkowski sum; we can always choose not to execute any orders, and thus no shares will be bought and no shares sold.

[4] It will always be possible to draw a line that intersects M at this point in such a way that no point in M lies below the line. If M has a vertex at that point, then there may be several such lines, in which case you're welcome, as far as I currently care, to pick any of them, and suppose that the slope to which I refer is the slope of that line.

[5] A possibly interesting special case would have a limit price of 0; "I'll swap my 50 shares of XYZ for 100 shares of ABC (but am unwilling to put in dollars to do it)."

[6] With, perhaps, a whole suite of planes such that M dips below none of them, but intersect all of them at (0,0,y); again, there is at least one such plane, and if there are more, any is suitable, and has a slope in the x

_{1}direction as well as in the x

_{2}direction.

[7] For example, if the price of ABC is low enough that my order fully executes, then I'm selling XYZ shares, perhaps pushing down their price; on the other hand, if a bunch of orders to buy ABC come in and push the price high enough that my order

*doesn't*execute, that may then require a higher price for XYZ in order for

*that*market to clear.

[8] This "limit" order may be less motivated by the notion of a margin call than other kinds of liquidity shocks; perhaps I have some valuable use for $5000, and would like to get it from whichever of these combinations of stocks allows it, but if the prices of the stocks are sufficiently low I'd rather just hang onto them.

[9] For what I'm writing here, I suppose that the five baskets are "linearly independent"; I can't think of a reason this limitation would chafe anyone.

[10] If the highest-value basket has a value exactly equal to the limit price, you might get a partial fill, and if two or more of the proffered baskets have the same value (higher than the others and the limit price), then you may end up executing a convex combination of those baskets.