Order flow

This section covers the order flow and settlement between client and server, including the order of incoming and outgoing shout notifications and cash and depot positions.

Settings

Assume the market is empty and has two participants.

Orders

  1. Participant 1: Buy 300 at 8 EUR
  2. Participant 1: Buy 150 at 9 EUR
  3. Participant 1: Buy 50 at 9 EUR
  4. Participant 1: Buy 100 at 10 EUR
  5. Participant 2: Sell 350 at 7 EUR

Orders in detail

1. Participant 1: Buy 300 at 8 EUR

ReceiverAction in AgentStrategyServiceContents
Participant 1onOrderStatusUpdateReceivedBuy 300 at 8EUR, ModeReasonCode:INSERT(1); shoutId: 1, transactionId: 1
EverybodyonQuoteUpdateReceivedBid: 8, BidSize: 300, ask: null, askSize: 0, transactionId: 1
EverybodyonOrderbookUpdateReceivedbid1: 8 EUR, bidSize1: 300 transactionId: 1. - all other askN and bidN==null, all other bidSizeN and askSizeN=0

2. Participant 1: Buy 150 at 9 EUR

ReceiverAction in AgentStrategyServiceContents
Participant 1onOrderStatusUpdateReceivedBuy 150 at 9EUR, ModeReasonCode:INSERT(1); shoutId: 2, transactionId: 2
EverybodyonQuoteUpdateReceivedBid: 9, BidSize: 150, ask: null, askSize: 0, transactionId: 2
EverybodyonOrderbookUpdateReceivedbid1: 9 EUR, bidSize1: 150, bid2: 8 EUR, bidSize2: 300, transactionId: 2. - all other askN and bidN==null, all other bidSizeN and askSizeN=0

3. Participant 1: Buy 50 at 9 EUR

ReceiverAction in AgentStrategyServiceContents
Participant 1onOrderStatusUpdateReceivedBuy 50 at 9EUR, ModeReasonCode:INSERT(1); shoutId: 3, transactionId: 3
EverybodyonQuoteUpdateReceivedBid: 9, BidSize: 200, ask: null, askSize: 0, transactionId: 3
EverybodyonOrderbookUpdateReceivedbid1: 9 EUR, bidSize1: 200, bid2: 8 EUR, bidSize2: 300, transactionId: 3. all other askN and bidN==null, all other bidSizeN and askSizeN=0

4. Participant 1: Buy 100 at 10 EUR

ReceiverAction in AgentStrategyServiceContents
Participant 1onOrderStatusUpdateReceivedBuy 100 at 10EUR, ModeReasonCode:INSERT(1); shoutId: 4, transactionId: 4
EverybodyonQuoteUpdateReceivedBid: 10, BidSize: 100, ask: null, askSize: 0, transactionId: 4
EverybodyonOrderbookUpdateReceivedbid1: 10 EUR, bidSize1: 100, bid2: 9 EUR, bidSize2: 200, bid3: 8, bidSize3: 300 transactionId: 4 - all other askN and bidN==null, all other bidSizeN and askSizeN=0

5. Participant 2: Sell 350 at 7 EUR

ReceiverAction in AgentStrategyServiceContents
Participant 2onOrderStatusUpdateReceivedSell 350 at 7EUR; ModeReasonCode:INSERT(1); shoutId: 5, transactionId: 5

5.1 Partial Execution 1

ReceiverAction in AgentStrategyServiceContents
Participant 2onOrderStatusUpdateReceivedSell 100 at 10; ModReasonCode: PARTIALEXECUTION(5); shoutId: 5, transactionId: 5
Participant 2onCashUpdateReceivedchange: 1000, balance: 1000, transactionId: 5
Participant 2onDepotUpdateReceivedchange: -100, balance: -100, transactionId: 5
Participant 1onOrderStatusUpdateReceivedBuy 100 at 10EUR, ModeReasonCode: EXECUTION(4); shoutId: 4, transactionId: 5
Participant 1onCashUpdateReceivedchange: -1000, balance: -1000, transactionId: 5
Participant 1onDepotUpdateReceivedchange: 100, balance: 100, transactionId: 5
EverybodyonTradeUpdateReceivedPrice: 10, Volume 100 transactionId: 5

Note: A trade does not trigger an orderbook update.

5.2 Partial Execution 2

ReceiverAction in AgentStrategyServiceContents
Participant 2onOrderStatusUpdateReceivedSell 150 at 9; ModReasonCode: PARTIALEXECUTION(5); shoutId: 5, transactionId: 5
Participant 2onCashUpdateReceivedchange: 1350, balance: 2350, transactionId: 5
Participant 2onDepotUpdateReceivedchange: -150, balance: -250, transactionId: 5
Participant 1onOrderStatusUpdateReceivedBuy 150 at 9EUR, ModeReasonCode:EXECUTION(4); shoutId: 2, transactionId: 5
Participant 1onCashUpdateReceivedchange: -1350, balance: -2350, transactionId: 5
Participant 1onDepotUpdateReceivedchange: 150, balance: 250, transactionId: 5
EverybodyonTradeUpdateReceivedPrice: 9, Volume 150 transactionId: 5

Note: A trade does not trigger an orderbook update.

5.3 Partial Execution 3

ReceiverAction in AgentStrategyServiceContents
Participant 2onOrderStatusUpdateReceivedSell 50 at 9; ModReasonCode: PARTIALEXECUTION(5); shoutId: 5, transactionId: 5
Participant 2onCashUpdateReceivedchange: 450, balance: 2800, transactionId: 5
Participant 2onDepotUpdateReceivedchange: -50, balance: -300, transactionId: 5
Participant 1onOrderStatusUpdateReceivedBUY 50 at 9; ModReasonCode: EXECUTION(4); shoutId: 3, transactionId: 5
Participant 1onCashUpdateReceivedchange: -450, balance: -2800, transactionId: 5
Participant 1onDepotUpdateReceivedchange: 50, balance: 300, transactionId: 5
EverybodyonTradeUpdateReceivedPrice: 9, Volume 50 transactionId: 5

Note: A trade does not trigger an orderbook update.

5.4 Partial Execution 4

ReceiverAction in AgentStrategyServiceContents
Participant 2onOrderStatusUpdateReceivedSell 50 at 8; ModReasonCode: EXECUTION(4); shoutId: 5, transactionId: 5
Participant 2onCashUpdateReceivedchange: 400, balance: 3200, transactionId: 5
Participant 2onDepotUpdateReceivedchange: -50, balance: -350, transactionId: 5
Participant 1onOrderStatusUpdateReceivedBuy 50 at 8EUR, ModeReasonCode:PARTIALEXECUTION(5); shoutId: 1,
Participant 1onCashUpdateReceivedchange: -400, balance: -3200, transactionId: 5
Participant 1onDepotUpdateReceivedchange: 50, balance: 350, transactionId: 5
EverybodyonTradeUpdateReceivedPrice: 8, Volume 50 transactionId: 5
EverybodyonQuoteUpdateReceivedBid: 8, BidSize: 250, ask: null, askSize: 0, transactionId: 5
EverybodyonOrderbookUpdateReceivedtransactionId: 5, bid1: 8 EUR, bidSize1: 250 - all other askN and bidN==null, all other bidSizeN and askSizeN=0

Note: Only after the last partial execution a new quote and a new orderbook is generated and sent out to all participants.