Apama 10.3 | Apama Capital Markets Foundation Documentation | Capital Markets Foundation | Market Data Management | Synthetic datasources | Forward to Spot Convertor | Calculations
 
Calculations
This section describes the calculations that the FTSC uses to convert from forwards to spots, and vice versa. Before the conversion, if the value of the pipSize parameter is greater than 0.0, the value of the epsSize parameter is added (for bids) or subtracted (for asks) from the forward price. For example:
*To calculate the bid price on the buy side:
forward price = forward price + eps size
*To calculate the ask price on the sell side:
forward price = forward price - eps size
Converting forwards to spots
When the prices are direct, spot price and quantity are calculated as follows:
spot price (unrounded) = mathUtil.add(forward price/multiplier,
forward points)
spot quantity = quantity * contract size
When the prices are indirect, bid price is used to calculate the ask price and quantity and vice-versa. The formulas used are:
spot price (unrounded) = mathUtil.add(multiplier/forward price,
forward points)
spot quantity =(((quantity.toFloat()*contractSize.toFloat()*
(forward price / multiplier)) * 10000.0).round()/10000.0 ).floor()
To round the calculated spot bid price, the spotPricePrecision parameter is used in the following way:
spot price(rounded) = spotprice(unrounded)*
spotPricePrecision.floor().toFloat()/spotPricePrecision
To round the calculated spot ask price, the spotPricePrecision parameter is used in the following way:
spot price(rounded) = spotprice(unrounded)*
spotPricePrecision.ceil().toFloat()/spotPricePrecision
Converting spots to forwards
When the prices are direct, forward price and quantity are calculated as follows:
forward price(unrounded) =
mathUtil.subtract(spot price , forward points)*multiplier
forward quantity = spot quantity / contract size
*forward points = forwardPointsBid or forwardPointsAsk depending on the side.
*forward points = mathUtil.add(forwardPointsBid , forwardPointsAsk) /2 in case of trade price conversions.
When the prices are indirect, bid price is used to calculate the ask price and quantity and vice-versa. The formula used is:
If the side is bid:
forward price(unrounded) = multiplier /mathUtil.subtract(spot price,
forward pointsAsk)
If the side is ask:
forward price(unrounded) = multiplier /mathUtil.subtract(spot price,
forward pointsBid)
Quantity for bid and ask:
forward quantity = ((spot quantity/contract size.toFloat())/
(spot price/multiplier)).round()
To round the calculated forward price, pipSize and epsSize parameters are used in the following way:
For buy side, floor function is used:
forward price(rounded) =(mathUtil.add( forward price (unrounded), eps size)
/ pip size).floor().toFloat()* pip size
For sell side, ceiling function is used:
forward price(rounded) =(mathUtil.subtract( forward price (unrounded),
eps size) / pip size).ceil().toFloat()* pip size

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.