Online and Offline Selling in Limit Order Markets Aaron Johnson Yale University Kevin Chang Yahoo!...

Post on 28-Mar-2015

215 views 0 download

Tags:

Transcript of Online and Offline Selling in Limit Order Markets Aaron Johnson Yale University Kevin Chang Yahoo!...

1

Online and Offline Selling in Limit Order Markets

Aaron JohnsonYale University

Kevin ChangYahoo! Inc.

Workshop on Internet and Network EconomicsDecember, 17th 2008

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

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

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.

5

Limit Order Markets• Trading one commodity

6

Limit Order Markets• Trading one commodity• Order

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

BUY 1 $3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

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.

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.

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

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).

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.

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.

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

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

30

Reducing KNAPSACK to 3-Price Selling

StepAlg. Sale

Vol.

Alg. OrderVol.

High priceMed. price

i

C

σi

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

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.

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 / Probabilistic

Buy / Sell / BothExact volume / Volume constraint

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

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

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

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

38

Selling in Limit Order Markets

Price

Volume

1 2 3 4 51

-1

39

Selling in Limit Order Markets

1. <B, 2, $1>

Price

Volume

1 2 3 4 51

-1

40

Selling in Limit Order Markets

1. <B, 2, $1>

Price1 2 3 4 51

-1

Volume

41

Selling in Limit Order Markets

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

Price1 2 3 4 51

-1

Volume

42

Selling in Limit Order Markets

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

Price1 2 3 4 51

-1

Volume

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.