Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Analytics : Using the position service framework : Creating and using position service interfaces : Managing position trackers : Updating positions being tracked
Updating positions being tracked
In your application, you can change an existing position that is being tracked by a particular subscription. You can set the position to any of the following:
*A value that you specify, including zero
*A value relative to a position you provide
The following code extract provides examples of changing the value of a position. It is assumed that the position service interface object was already created.
action modifyPositionInformation( ) {
 
// After a subscription has been made, adjust the existing position.
// First create a new Position object that will be used to
// change the existing position.
com.apama.position.Position newPosition := new com.apama.position.Position;
 
// To set a single "net" position such as what the open position tracker
// provides, execute the following action:
newPosition.setPosition( 10, 1.354 );
 
// Or, to set separate min and max values such as what the pending position
// tracker provides, execute the following action:
newPosition.setFullPosition( -10, -1.354, 20, 2.641 );
 
// Or, to set just the min or max values separately:
newPosition.setMinPosition( 10, 1.354 );
newPosition.setMaxPosition( 20, 2.641 );
 
// Use the Position object to set a subscription's
// position to an absolute new position:
psIface.setPosition( subscriptionId, newPosition, cbPositionAdjusted );
 
// Or, adjust the subscription's existing position relative to
// the position provided:
psIface.adjustRelativePosition(
subscriptionId, newPosition, cbPositionAdjusted );
 
// Or, set the subscription's existing position to zero:
psIface.resetPosition( subscriptionId, cbPositionAdjusted );
 
// For custom position trackers, or more advanced position changes,
// you may want to provide to the position tracker more information about
// the change. For example, why the modification has been made. You
// can use the following actions to do this:
com.apama.position.PositionConfigParams config :=
new com.apama.position.PositionConfigParams;
// Add any extra configuration specific to the position tracker:
psIface.setPositionWithConfig( subscriptionId, newPosition,
config, cbPositionAdjusted );
psIface.adjustRelativePositionWithConfig( subscriptionId, newPosition,
config, cbPositionAdjusted );
}
 
action cbPositionAdjusted( integer subscriptionId,
com.apama.position.Position newPosition, boolean success, string msg ) {
// Check whether the modification was made successfully or not.
// You are provided with the new updated position.
...
}
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback