Apama 10.3 | Apama Capital Markets Foundation Documentation | Capital Markets Foundation | Analytics | Using the position service framework | Using default position trackers | Creating and subscribing to the reserved position tracker
 
Creating and subscribing to the reserved position tracker
The default implementation of the reserved position tracker tracks the cumulative quantity and cash position for reserved orders for a particular slice. A reserved order lets an application request the right to take a position up to a specified quantity. Reservations are designed but not limited to be used with the CMF's risk firewall. Reservations limit the total order exposure while still allowing an application's strategy the freedom to trade with fewer concerns about reaching risk limits. The reserved position tracker does not grant or enforce reservations. It only lets applications monitor changes to the reserved position for a particular slice. You should use reserved position trackers with the Reservation Enforcer Risk Firewall rule.
The behavior of the reserved position tracker is the same as the behavior of the pending position tracker except that the reserved position tracker tracks only orders of the type RESERVATION. Reserved orders represent how much the cumulative quantity and cash position of your open position for the same slice could change.
To use the reserved position tracker, you create an instance of it and then you subscribe to it.
To create an instance of a reserved position tracker, execute the com.apama.position.tracker.ReservedPositionTrackerFactory.create() action. For a description of the parameters you specify, see Creating and subscribing to the pending position tracker.
After a reserved position tracker is set up, subscribe to it by executing com.apama.position.PSInterface.subscribeAndMonitor(). This action subscribes to the specified tracker and registers an update callback each time there is an update to the position being tracked. A tracker can accept any number of subscriptions.
When an order is placed against a reservation, the order quantity is subtracted from the reserved position and added to the pending position. If the order subsequently fills, the filled quantity moves from the pending position to the open position. If the order is canceled, or amended downwards, the quantity is moved from the pending position back to the reserved position. For example, if a trader has unfilled buy orders with a type of RESERVATION in the market with a total quantity of 1000, then there will be a reserved maxQtyPosition of 1000. This is the maximum that the trader's position can change if all reserved buy orders were filled. Conversely, if a trader has unfilled sell orders with a type of RESERVATION in the market with a total quantity of 1000, then there will be a reserved minQtyPosition of -1000.
Code for creating a reserved position tracker and then subscribing to it is almost the same as the code for creating and subscribing to an open position tracker. The differences are that you use the ReservedPositionTrackerFactory.create() action and when subscribing you use the TRACKER_TYPE string defined in the com.apama.position.tracker.ReservedPositionTrackerConstants event. See the sample code in Creating and subscribing to the open position tracker.

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.