Online and Offline Selling in Limit Order Markets

61
Online and Offline Selling in Limit Order Markets Aaron Johnson Yale University Kevin Chang Yahoo! Inc. Workshop on Internet and Network Economics December, 17 th 2008 1

description

Online and Offline Selling in Limit Order Markets. Aaron Johnson Yale University Kevin Chang Yahoo! Inc. Workshop on Internet and Network Economics December, 17 th 2008. Limit Order Markets. Match buyers with sellers Electronic Communication Networks (ECNs) NASDAQ Instinet - PowerPoint PPT Presentation

Transcript of Online and Offline Selling in Limit Order Markets

Page 1: Online and Offline Selling in Limit Order Markets

1

Online and Offline Selling in Limit Order Markets

Aaron JohnsonYale University

Kevin ChangYahoo! Inc.

Workshop on Internet and Network EconomicsDecember, 17th 2008

Page 2: Online and Offline Selling in Limit Order Markets

2

Limit Order Markets

• Match buyers with sellers• Electronic Communication Networks (ECNs)– NASDAQ– Instinet– NYSE-Euronext

• Prediction Markets– Intrade– Iowa Electronic Markets

• Market makers• Market orders, fill or kill, cancellation

Page 3: Online and Offline Selling in Limit Order Markets

3

Results

• Reservation price algorithm for online selling has competitive ratio e log(R), R = pmax/pmin.(improves O(logR logN) of [KKMO04])

• Optimal selling offline is NP-Hard.• PTAS for offline selling when number of prices

is constant.• Extend PTAS to offline buying

Page 4: Online and Offline Selling in Limit Order Markets

4

Related Work

• [EKKM06] Even-Dar, Kakade, Kearns, and Mansour. (In)Stability properties of limit order dynamics. ACM EC 2006.

• [KKMO04] Kakade, Kearns, Mansour, and Ortiz. Competitive algorithms for VWAP and limit order trading. ACM EC 2004.

• [LPS07] Lorenz, Panagiotou, and Steger. Optimal algorithms for k-search with applications in option pricing. ESA 2007.

Page 5: Online and Offline Selling in Limit Order Markets

5

Limit Order Markets• Trading one commodity

Page 6: Online and Offline Selling in Limit Order Markets

6

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

BUY 1 $3

Page 7: Online and Offline Selling in Limit Order Markets

7

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 1 $5

SELL 3 $7

SELL 10 $10

Page 8: Online and Offline Selling in Limit Order Markets

8

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 1 $5

SELL 3 $7

SELL 10 $10

Page 9: Online and Offline Selling in Limit Order Markets

9

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 1 $5

SELL 3 $7

SELL 10 $10

BUY 2 $6

Page 10: Online and Offline Selling in Limit Order Markets

10

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 1 $5

SELL 3 $7

SELL 10 $10

BUY 2 $6

Page 11: Online and Offline Selling in Limit Order Markets

11

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 0 $5

SELL 3 $7

SELL 10 $10

BUY 1 $6

1

$5

Page 12: Online and Offline Selling in Limit Order Markets

12

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 3 $7

SELL 10 $10

BUY 1 $6

Page 13: Online and Offline Selling in Limit Order Markets

13

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 3 $7

SELL 10 $10

BUY 1 $6

Page 14: Online and Offline Selling in Limit Order Markets

14

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 3 $7

SELL 10 $10

BUY 1 $6

Page 15: Online and Offline Selling in Limit Order Markets

15

Limit Order Problems

• Sequence of orders• Volume to trade• Insert orders to maximize value at given volume

General Problem

OptionsOnline / Offline / Probabilistic

Buy / Sell / BothExact volume / Volume constraint

Page 16: Online and Offline Selling in Limit Order Markets

16

Limit Order Problems

• Sequence of orders• Volume to trade• Insert orders to maximize value at given volume

General Problem

OptionsOnline / Offline / Probabilistic

Buy / Sell / BothExact volume / Volume constraint

Page 17: Online and Offline Selling in Limit Order Markets

17

Limit Order Problems

• Sequence of orders: (σ1,…, σn) : σi = <B/S,vi,pi>• Volume to sell : N• Insert sell orders to maximize revenue.– Output (σ1,τ1,σ2,τ2,…, σn,τn), τi = <S,vτ

i,p τi>.

– Σi vτi ≤N

– Maximize revenue earned from τi sales.

Offline Selling

Page 18: Online and Offline Selling in Limit Order Markets

18

Limit Order Problems

Results1. Problem is NP-Hard, even when there are only

three prices in sequence.2. Problem with two prices is linear-time solvable.3. Exists a Polynomial-Time Approximation Scheme

when number of prices is constant.

Offline Selling

Page 19: Online and Offline Selling in Limit Order Markets

19

Limit Order Problems

Results1. Problem is NP-Hard, even when there are only

three prices in sequence.2. Problem with two prices is linear-time solvable.3. Exists a Polynomial-Time Approximation Scheme

when number of prices is constant.

Offline Selling

Page 20: Online and Offline Selling in Limit Order Markets

20

Offline Selling

1. Give a canonical form for optimal solutions to case when input sequence has only three prices.

2. Form leads to algorithm for two-price case.3. Reduce KNAPSACK to three-price instance.

1. Easy to see that solutions to KNAPSACK instance give solutions to three-price instance.

2. Canonical form guarantees that a solution to three-price selling gives a solution to KNAPSACK.

Proving Hardness

Page 21: Online and Offline Selling in Limit Order Markets

21

Optimal Offline SellingLemma 1: We can assume that all sales at the

highest price i) are made by the algorithm and ii) have sell orders that are placed at the beginning.

Lemma 2: We can assume that all sell orders at the lowest price that are inserted by the algorithm are placed immediately after the last sale made by the algorithm at a higher price.

Page 22: Online and Offline Selling in Limit Order Markets

22

Two-Price Offline Algorithm• With only two prices for orders (high and low),

use this algorithm:

At the beginning, place a sell order for volume N at the high price.

If volume sold is N, return this.Else,

After each high-price sale, calculate value of inserting sell order for remaining volume at low price.Return the maximum sequence.

Page 23: Online and Offline Selling in Limit Order Markets

23

Three-Price Offline Selling• Three prices for orders (high: ph, medium: pm,

and low: pl).Lemma 3: We can assume that the algorithm

inserts any medium-price orders i) immediately after high-price sales and ii) such that they are tight, i.e., increasing the volume would reduce the volume of high-price sales.

Theorem 1: Three-price offline selling is NP-Hard.

Page 24: Online and Offline Selling in Limit Order Markets

24

Reducing KNAPSACK to 3-Price Selling

KNAPSACK– n items (wi, vi)– Capacity C– Value V– Find subset S [n] such that

iS wi ≤ C and iS vi ≥ V

Page 25: Online and Offline Selling in Limit Order Markets

25

Reducing KNAPSACK to 3-Price SellingLet σi be the sequence

1. <B, pm, ai+wi>2. <S, pl, wi>3. <B, pl, wi>4. <S, pm, ai>5. <B, ph, ai+bi>.Let α = (σ1, σ2, …, σn).

Page 26: Online and Offline Selling in Limit Order Markets

26

Reducing KNAPSACK to 3-Price SellingLet σi be the sequence

1. <B, pm, ai+wi>2. <S, pl, wi>3. <B, pl, wi>4. <S, pm, ai>5. <B, ph, ai+bi>.Let α = (σ1, σ2, …, σn).

Step

High priceMed. price

Canonical Optimum

Alg. OrderVol.

Alg. Sale Vol.

Page 27: Online and Offline Selling in Limit Order Markets

27

Reducing KNAPSACK to 3-Price SellingLet σi be the sequence

1. <B, pm, ai+wi>2. <S, pl, wi>3. <B, pl, wi>4. <S, pm, ai>5. <B, ph, ai+bi>.Let α = (σ1, σ2, …, σn).

Step

Alg. OrderVol.

High priceMed. price

• At start place high sell.Canonical Optimum

Alg. Sale Vol.

Page 28: Online and Offline Selling in Limit Order Markets

28

Reducing KNAPSACK to 3-Price SellingLet σi be the sequence

1. <B, pm, ai+wi>2. <S, pl, wi>3. <B, pl, wi>4. <S, pm, ai>5. <B, ph, ai+bi>.Let α = (σ1, σ2, …, σn).

StepAlg. Sale

Vol.

Alg. OrderVol.

High priceMed. price

• At start place high sell.• After high sales, medium

sell volumes 0 and ai+wi are tight. More is not optimal.

Canonical Optimum

Page 29: Online and Offline Selling in Limit Order Markets

29

Reducing KNAPSACK to 3-Price SellingLet ω be the sequence

• With initial high sale, books at start of ω just have low buys. This is maintained.

Canonical Optimum1. <S, pl, iwi -C>2. <B,pm, pm(iwi )>.

Let σ = (α, ω).Let i(l) be revenue after σi with l fewer initial low buys.

n(l)= pm2(iwi )+pl(C-l) : l≤C

pm2(iwi )-pm(l-C) : l≥C

n

lC

Page 30: Online and Offline Selling in Limit Order Markets

30

Reducing KNAPSACK to 3-Price Selling

StepAlg. Sale

Vol.

Alg. OrderVol.

High priceMed. price

i

C

σi

Page 31: Online and Offline Selling in Limit Order Markets

31

Reducing KNAPSACK to 3-Price Selling

StepAlg. Sale

Vol.

Alg. OrderVol.

High priceMed. price

i-1

C

• Inserting a medium sell decreases later low buys by wi and increases revenue by (k) vi.

• iS if medium after σi .

i

wi

(k)vi

σi

Page 32: Online and Offline Selling in Limit Order Markets

32

Reducing KNAPSACK to 3-Price Selling• At beginning of σ0, l=0.• Can set pm, pl to ensure that should not shift

by more than C.• Can set ai, bi to ensure that medium insertion

of ai+wi provides (k) vi revenue but more is not profitable.

• KNAPSACK solution leads to stated 3-price solution.

• Canonical form guarantees optimal solution in form that can be converted to a KNAPSACK solution.

Page 33: Online and Offline Selling in Limit Order Markets

33

Conclusions• Prove optimal competitive ratio for reservation price

algorithm for online selling of e log(R), R = pmax/pmin.• Optimal selling offline is NP-Hard.• PTAS for offline selling when number of prices is

constant.• Limit order markets are a basic market mechanism

with many open problems.

Online / Offline / ProbabilisticBuy / Sell / Both

Exact volume / Volume constraint

Page 34: Online and Offline Selling in Limit Order Markets

34

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 3 $7

SELL 10 $10

BUY 1 $6

SELL 1 $7

Page 35: Online and Offline Selling in Limit Order Markets

35

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 3 $7

SELL 10 $10

BUY 1 $6

SELL 1 $7

Page 36: Online and Offline Selling in Limit Order Markets

36

Limit Order Markets• Trading one commodity• Order

1. BUY/SELL2. Volume3. Priceo Lowest (SELL)o Highest (BUY)

• Buy book / Sell book• Matching algorithm

1. Match new orderwith existing orders.

2. Remaining volumegoes on a book.

BUY 5 $1

BUY 2 $2

BUY 1 $3

SELL 1 $7

SELL 10 $10

BUY 1 $6

SELL 3 $7

Page 37: Online and Offline Selling in Limit Order Markets

37

Offline Selling

1. Inserting sell orders affects the possible revenue gained later in the sequence. In fact, it can only lower it.

2. Inserting a sell order of volume V can cause at most volume V change in the books later in the sequence. Thus, the sales change by at most volume V.

Main Observations

Page 38: Online and Offline Selling in Limit Order Markets

38

Selling in Limit Order Markets

Price

Volume

1 2 3 4 51

-1

Page 39: Online and Offline Selling in Limit Order Markets

39

Selling in Limit Order Markets

1. <B, 2, $1>

Price

Volume

1 2 3 4 51

-1

Page 40: Online and Offline Selling in Limit Order Markets

40

Selling in Limit Order Markets

1. <B, 2, $1>

Price1 2 3 4 51

-1

Volume

Page 41: Online and Offline Selling in Limit Order Markets

41

Selling in Limit Order Markets

1. <B, 2, $1>2. <S, 1, $3>

Price1 2 3 4 51

-1

Volume

Page 42: Online and Offline Selling in Limit Order Markets

42

Selling in Limit Order Markets

1. <B, 2, $1>2. <S, 1, $3>

Price1 2 3 4 51

-1

Volume

Page 43: Online and Offline Selling in Limit Order Markets

43

Selling in Limit Order Markets

1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4>

Price1 2 3 4 51

-1

Volume

Page 44: Online and Offline Selling in Limit Order Markets

44

Selling in Limit Order Markets

1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4>

Price1 2 3 4 51

-1

Volume

Page 45: Online and Offline Selling in Limit Order Markets

45

Selling in Limit Order Markets

1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4> SALE: $3

Price1 2 3 4 51

-1

Volume

Page 46: Online and Offline Selling in Limit Order Markets

46

Selling in Limit Order Markets

1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4> SALE: $34. <S, 2, $5>

Price1 2 3 4 51

-1

Volume

Page 47: Online and Offline Selling in Limit Order Markets

47

Selling in Limit Order Markets

1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4> SALE: $34. <S, 2, $5>5. <B, 1, $5>

Price1 2 3 4 51

-1

Volume

Page 48: Online and Offline Selling in Limit Order Markets

48

Selling in Limit Order Markets

Price

Volume

1 2 3 4 5

1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4> SALE: $34. <S, 2, $5>5. <B, 1, $5> SALE: $51

-1

Page 49: Online and Offline Selling in Limit Order Markets

49

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4>4. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1>3. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4>6. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 50: Online and Offline Selling in Limit Order Markets

50

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4>4. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1>3. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4>6. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 51: Online and Offline Selling in Limit Order Markets

51

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4>4. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1>3. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4>6. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 52: Online and Offline Selling in Limit Order Markets

52

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4>4. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1> SALE: $13. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4>6. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 53: Online and Offline Selling in Limit Order Markets

53

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4>4. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1> SALE: $13. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4>6. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 54: Online and Offline Selling in Limit Order Markets

54

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4>4. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1> SALE: $13. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4>6. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 55: Online and Offline Selling in Limit Order Markets

55

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4>4. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1> SALE: $13. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4>6. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 56: Online and Offline Selling in Limit Order Markets

56

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4> SALE: $34. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1> SALE: $13. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4> SALE: $36. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 57: Online and Offline Selling in Limit Order Markets

57

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4> SALE: $34. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1> SALE: $13. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4> SALE: $36. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 58: Online and Offline Selling in Limit Order Markets

58

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4> SALE: $34. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1> SALE: $13. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4> SALE: $36. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 59: Online and Offline Selling in Limit Order Markets

59

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4> SALE: $34. <S, 2, $5>5. <B, 1, $5>Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1> SALE: $13. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4> SALE: $36. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5>

Price

Volume

1 2 3 4 51

-1

Page 60: Online and Offline Selling in Limit Order Markets

60

Selling in Limit Order Markets1. <B, 2, $1>2. <S, 1, $3>3. <B, 1, $4> SALE: $34. <S, 2, $5>5. <B, 1, $5> SALE: $5Price

Volume

1 2 3 4 51

-1

1. <S, 2, $1>2. <B, 2, $1> SALE: $13. <S, 1, $3>4. <S, 1, $3>5. <B, 1, $4> SALE: $36. <S, 1, $5>7. <S, 2, $5>8. <B, 1, $5> SALE $3

Price

Volume

1 2 3 4 51

-1

Page 61: Online and Offline Selling in Limit Order Markets

61

Selling in Limit Order Markets

Lemma 0 ([KKMO04]): Inserting a unit-volume sell order results in at most one less sale from the original sell orders.