47 lines
2.1 KiB
Plaintext
47 lines
2.1 KiB
Plaintext
This test makes sure the basic spreader functionality works for 4 legged synthetic spreads
|
|
with 1 quoting leg.
|
|
|
|
0. Run this test in sim, with no external markets. We will control the markets with limit orders.
|
|
|
|
1. Create a 4 legged synthetic spread with legs SIF9, SIH9, SIK9, SIN9, with leg quantities and
|
|
price multipliers of 1,1,1 and -1 respectively. Leg SIN9 is the only quoting leg.
|
|
Disable all Quote, Pre-Hedge and Post-Hedge parameters (leg contracts are arbitrary, so if you
|
|
don't have those contracts, choose any set of 4 contracts).
|
|
|
|
2. Enter a synthetic buy order of 10 lots at 40.00. The ladders will most likely be empty, so
|
|
use the market view to enter orders.
|
|
|
|
3. You will see no quoting orders since all the 3 hedging legs have no markets.
|
|
Now enter:
|
|
SIH9 10 lot sell @ 19.950
|
|
SIK9 10 lot sell @ 20.200
|
|
|
|
There should still be no quoting order for SIN9 since the SIF9 hedge leg still doesn't have a market.
|
|
Now Enter:
|
|
SIF9 1 lot sell @ 20.000
|
|
|
|
This will result in the spreader sending the following quoting order:
|
|
SIN9 1 lot sell @ 20.150
|
|
|
|
fyi, the arithmetic is as follows:
|
|
synth_price = (hedge_leg1 + hedge_leg2 + hedge_leg3) - quote_leg
|
|
40 = (19.950 + 20.200 + 20.000) - x
|
|
40 = (60.150) - x
|
|
x = (60.150) - 40
|
|
x = 20.150
|
|
|
|
4. Now cancel the SIK9 order. This should result in the quoting order getting cancelled as well.
|
|
Re-enter the SIK9 order, 10 lot sell @ 20.200, and the quoting order should appear as well.
|
|
|
|
5. Now lift the quoting leg ask with a 1 lot buy order at the same price. Make sure hedges are sent (and filled)
|
|
for all the 3 hedging legs. SIF9 should have no market now and hence we should have no quoting order.
|
|
|
|
6. Enter a 10 lot sell order at 20.000 for SIF9. This should result in a 9 lot quoting order.
|
|
|
|
7. Now randomly move the hedge orders as well as the spreader order a few times, and make sure the
|
|
quoting order follows it and is correct
|
|
quoting_order_price = (SIF9's ask + SIH9's ask + SIK9's ask - spreader_price)
|
|
rounded up to the tick.
|
|
|
|
8. Now lift the complete quoter offer by crossing it with a 9 lot bid. Make sure all the hedges
|
|
are sent and the spreader order reached a Completed state in the orderbook. |