Apama 10.3 | Apama Capital Markets Foundation Documentation | Capital Markets Foundation | Analytics | Using the position service framework | Overview of using the position service framework
 
Overview of using the position service framework
To use the position service framework:
*Add the correct bundle(s) to your application.
*Create position trackers.
*Subscribe to position trackers
Adding bundles
You must add the Position Management Service bundle to your application in order to use the position service framework. You also need to add the Position Trackers bundle to your application. This bundle contains implementations for the default open, pending, reserved and realized P&L position trackers. If you implement your own position trackers and use them in place of the default implementations then you do not need the Position Trackers bundle.
Creating position trackers
With the correct bundles in your application, set up one or more position trackers in the context that is receiving the orders that you want to track the position for.
To Set Up This Tracker Type
Call This Event's create() Action
Open position tracker
com.apama.position.tracker.OpenPositionTrackerFactory
Pending position tracker
com.apama.position.tracker.PendingPositionTrackerFactory
Reserved position tracker
com.apama.position.tracker.ReservedPositionTrackerFactory
Realized P&L tracker
com.apama.position.tracker.RealizedPnLTrackerFactory
When you call the create() action you specify a reference to the main context, which contains the position service manager. You also specify a user-defined tracker name that is unique in your application, and the user-defined action to call when the tracker has been set up. For examples, see Creating and subscribing to the open position tracker.
Subscribing to position trackers
In each context in which you want to monitor position updates from the position trackers you created, perform the following steps. While it is permissible to create the position tracker and perform the following steps all in the same context, using the same context is not required. That is, you can create the position tracker in one context and perform the following steps in as many other contexts as you need.
1. Instantiate a position service configuration object (com.apama.position.PositionConfigParams), which you specify in the next step. This configuration object is for future use; it contains no information in this release.
2. Create a position service interface, which your application will use to manage subscriptions to position trackers from the current context. You can have any number of instances of the position service interface in any number of contexts. To create a position service interface, call the create() action defined in the com.apama.position.PSFactory event. The create() action parameters specify a reference to the main context, a position service configuration object, and the user-defined action to execute upon creation of the interface object. An instance of com.apama.position.PSInterface is returned in the callback. See Creating and using position service interfaces.
3. Subscribe to a position tracker that you previously created by executing the subscribe() or subscribeAndMonitor() action defined in the com.apama.position.PSInterface interface object. When you subscribe you specify:
*The unique name of the position tracker that you want to subscribe to. This is the same name you provided when you created the position tracker.
*A position service configuration object, which lets you provide details for the particular position you want to track. See Defining slices that identify positions to be tracked.
*A user-defined action to execute in response to subscribing.
4. Define callback actions that will be executed in response to successful subscriptions. For examples, see 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.