Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Finance Smart Blocks for Developing Scenarios : CMF financial analytic smart blocks : Position Calculator v3.0
Position Calculator v3.0
This block calculates real-time position data for multiple instruments, given a feed of trades affecting the position. The output from this block—a sequence of position updates, possibly for different instruments—can be fed into the P&L Calculator block.
Description
The Position Calculator block has one input feed, trades, which has five fields. All fields should be wired to the fields of the same names in the Order Manager’s order status or order execution output feed. Note that Position Calculator stores the average priced executed and quantity executed for every order, until the clear operation is called. This means that the memory used by the Position Calculator block will increase by a small amount for every order placed — until the clear operation is called.
To make this block available to your scenario, you must add the Analytic APIs bundle to your project.
Parameters
Parameters
Description
Counterparty flow
If true, we are seeing the trade flow from the counterparty’s point of view; that is, a BUY means that we have sold. If false, we are seeing the flow from our point of view
Operations
Operation
Description
start
Starts the calculation of positions. Must be called before the calculator will generate any position data. Sends initial data to the position output feed with 0 as the value of numeric fields and an empty string as the value of text fields.
stop
Stops the calculation of further positions. Any subsequent input feeds are ignored.
clear
Clears the block’s state and accumulated values.
Input feeds
The trades feed represents the stream of incoming trades.
Feed
Fields
Description
trades
order identifier
The unique identifier for the order.
symbol
The symbol of the ordered instrument.
side
The side of the order (BUY or SELL).
quantity executed
The total amount executed for the order.
average price executed
The volume-weighted average price for all fills for the order.
Output feeds
The position feed represents the stream of position updates for the different instruments being monitored.
Feed
Fields
Description
position
symbol
The symbol of the position being reported.
money balance
The net currency made on this instrument; increases when we sell, decreases when we buy.
position
The position in this currency; positive if we are long.
average price
The average price at which we have traded this instrument; (BUYs and SELLs) = total money executed / total quantity executed.
total quantity executed
The total quantity of this instrument traded; always positive.
total money executed
The total money exchanged for this instrument; always positive.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback