Test Author: Kevin
If it breaks: Kevin 

When the prorata order is placed, it acts as a slightly more complex hedging algorithm than Cover.
It will:
  - Classify each fill as a normal fill or an 'overfill' according to "Fill Limit" parameters
  - Standard fills are hedged with the "Hedge" child order
  - Over fills are hedge with the "Overfill Hedge" child order

The prorata order works the child until the Fill Limit is breached.  
Once the fill limit is breached, the algo will begin the 'get out process'
Unless:
  - If "Stay In" is checked, AND
     a) The opposite inside market (at inception) doesn't move against us AND
	 b) The same side quantity remains ABOVE the "Stay in Threshold"
If "Stay In" is not checked, 'get out process' begins right away

"Get Out Process" means
	1) Cancel the child order
	2) Scratch the overfill hedges if and only if the "Scratch on Overfill" is checked
	  -Scratches are done "Chase Ticks" through the original opposite market
	

0. This needs sim market data **not** to be merged with replay (or
cert), so we can create our own markets. Use the following key to set
market data up:

ExchangeSim {
  value {
    merge_with_md: false 
  }
}

1. Bring up a ladder, lets say in SIM:ESU9  (does not matter which security)

2. Create the ask side of the market by sending 50 lot sell limit orders at 2833.25 through 2832.25
(if there are no markets use the M View and the ticket to enter, if you already had left over
orders cancel them)

2. Create the bid side of the market by sending 50 lot buy limit orders at 2830.75 through 2831.25.  
You should have no orders at 2831.50, 2831.75 and 2832.

Basics:
3. Enter a 20 lot buy prorata order at 2831.50 with the following parameters
 
 Hedge Ticks = 1
 Chase Ticks = 1
 Fill Limit = Absolute:5
 Stay in Threshold = Absolute:21
 Scratch on Overfill = true
 Stay In = true

Verify that the Prorata order along with the Child order shows up.  

Next put a 50 lot buy limit order on top of your prorata at 2831.50


4) Using 1 lot limit sells, fill 5 of your prorata order.  Verify that you see covers going in 1 tick better

5) Cancel the 50 lot limit at 2831.50.  Nothing should happen.  Put the 50 lot back.

6) Fill one more 1 lot.  

7) Again cancel the 50 lot limit at 2831.50.  You should see:
  - The remainder of the 20 lot limit order child should cancel (the remainder will be 14, with 6 already filled)
  - 1 lot of your hedges should scratch to sell at 2831.25
  - The parent algo order should stay in (the badge will still be there)
  - You should still be working 5 sales for hedges
  
8) Fill the 5 sells, it should cancel the parent.

9) Repeat 3-8, but this time set Scratch on Overfill = false, Stay In = true 
   - You should see the same results in 7, except the 1 lot scratch won't happen so you'll still have 6 working hedges 
      
9) Repeat 3-6, but this time set Scratch on Overfill = false, Stay In = false
   - After filling your last lot in 1 you should see your working order cancel, with 6 hedges working
   - The ladder may deceive you here, check the OB
   - Cancel your hedges, this should cancel the whole chain
   
9) Repeat 3-6, but this time set Scratch on Overfill = true, Stay In = false
   - After filling your last lot in 1 you should see your working order cancel, one hedge scratch (at 2831.50), and 5 hedges working
   - The ladder may deceive you here, check the OB
   - Cancel your hedges, this should cancel the whole chain
   
10) Repeat all of this on the sell side


