

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object TradingStrategies.TradingStrategy
A trading strategy investing in only one asset. Provides methods to compute the following statistics associated with the trading strategy:
conveniently assembled into a random vector for easy analyisis of the mean, the variance and the empirical distribution (histogram). All quantities except the number of trades are discounted amounts computed at the time horizon T.
It is assumed that the entire strategy is financed through borrowings at the riskfree rate. Thus current (disounted) borrowings are equal to the (discounted) amount invested at all times.
Transaction costs are allowed and have a fixed and a proportional component. The proportional transaction costs come from bidask spread etc., 0.1 is a very conservative number. Transaction costs are assumed to grow at the riskfree rate (to remain constant in todays dollars).Note that the computation of the portfolio weight (the number of shares of the asset held at any given time) might involve conditional expectations which necessitate branch simulations of the price path of the asset.
Each branch simulation destroys an existing price path of the asset from the time of branching forward. Consequently we cannot simply compute a full path of the asset and then move the trading strategy along this path. Instead we evolve the path simultaneous with the trading strategy in single time steps.
These time steps are driven by new Zincrements (see the class
Market.Asset
) and consequently produce independent asset price
paths (rather than independent groups of dependent paths).
Constructor Summary  
TradingStrategy(double fixed_trc,
double prop_trc,
Asset asset,
Trigger tradeTrigger)
Constructor, full initialization. 

TradingStrategy(double fixed_trc,
double prop_trc,
Asset asset,
Trigger tradeTrigger,
int currentWeightNotInitialized)
Constructor, initializes all fields except currentWeight 
Method Summary  
RandomVector 
discountedGainsAndNumberOfTrades()
The newDiscountedGainsAndNumberOfTrades() as a random
vector. 
RandomVariable 
discountedGainsFromTrading()
The terminal discounted gains from trading as a random variable. 
Asset 
get_asset()
The asset invested in. 
double[] 
get_B()
Price path of riskfree bond. 
double 
get_currentWeight()
Current number of shares of the asset held. 
double 
get_dt()
Size of time step. 
double 
get_fixed_trc()
Fixed transaction cost per trade. 
int 
get_nTrades()
Current number of trades. 
double 
get_prop_trc()
Proportional transaction cost per trade. 
double[] 
get_S()
Discounted asset price path. 
int 
get_T()
Number of time steps to horizon. 
Trigger 
get_tradeTrigger()
Trigger triggering the trades. 
double 
initialInvestment()
Amount invested at time t=0. 
double[] 
newDiscountedGainsAndNumberOfTrades()
The discounted gains from trading (return_value[0]) and number of trades (return_value[1]) at the time horizon T computed from a new and independent asset price path. 
double 
newDiscountedGainsFromTrading()
The discounted gains from trading at the time horizon T computed from a new and independent asset price path. 
double 
newReturnFromTrading()
The return from trading at the time horizon T computed from a new and independent asset price path. 
double[] 
newTradeStatistics()
Computes a vector x of statistics associated with the trading strategy: 
abstract double 
newWeight(int t)
The new weight of the asset given that a trade takes place at time t (ie. 
RandomVariable 
returnsFromTrading()
The terminal returns from trading as a random variable. 
RandomVector 
tradeStatistics()
The newTradeStatistics() as a random vector X: 
Methods inherited from class java.lang.Object 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Constructor Detail 
public TradingStrategy(double fixed_trc, double prop_trc, Asset asset, Trigger tradeTrigger)
Constructor, full initialization.
fixed_trc
 fixed transaction costs.prop_trc
 proportional transaction costs.asset
 the asset invested in.tradeTrigger
 triggers the trades.public TradingStrategy(double fixed_trc, double prop_trc, Asset asset, Trigger tradeTrigger, int currentWeightNotInitialized)
Constructor, initializes all fields except
currentWeight
Needed because the call currentWeight=newWeight(0);
might make use of fields of a subclass which are not initialized
yet. In this case this call is then made in the subclass constructor
after the needed fields have been initialized. The variable
currentWeightNotInitialized
is a dummy parameter used
only to differentiate the parameter signatures of the two constructors,
assign any value.
fixed_trc
 fixed transaction costs.prop_trc
 proportional transaction costs.asset
 the asset invested in.tradeTrigger
 triggers the trades.currentWeightNotInitialized
 dummy parameter, assign any value.Method Detail 
public int get_T()
public double get_dt()
public double[] get_S()
public double[] get_B()
public double get_fixed_trc()
public double get_prop_trc()
public Asset get_asset()
public Trigger get_tradeTrigger()
public double get_currentWeight()
public int get_nTrades()
public abstract double newWeight(int t)
The new weight of the asset given that a trade takes place at time t (ie. the portfolio is rebalanced at time t).
If no trade takes place at time t the weight of the asset is in the member variable currentWeight. This variable is kept up to date to allow reference to the last weight in the computation of the next weight newWeight(t) at time t (eg "doubling up", "selling half" etc.).
t
 current time.public double initialInvestment()
public double newDiscountedGainsFromTrading()
The discounted gains from trading at the time horizon T computed from a new and independent asset price path.
The variable currentWeight
is updated without being used
explicitly. This is done to allow the definition of strategies where the
next weight is defined with reference to the last weight.
public RandomVariable discountedGainsFromTrading()
The terminal discounted gains from trading as a random variable.
Warning: The time parameter t is ignored, that is, there is no possibility to condition on information available at time t. Useful only for computations at time t=0.It is slightly more complicated to implement this ability since the computation of the portfolio weights destroys an existing path so that the current path would have to be saved up to time t. We don't need the ability to condition and so it is not implemented.
public double[] newDiscountedGainsAndNumberOfTrades()
The discounted gains from trading (return_value[0]) and number of trades (return_value[1]) at the time horizon T computed from a new and independent asset price path.
The variable currentWeight
is updated without being used
explicitly. This is done to allow the definition of strategies where the
next weight is defined with reference to the last weight.
public RandomVector discountedGainsAndNumberOfTrades()
The newDiscountedGainsAndNumberOfTrades()
as a random
vector.
It is slightly more complicated to implement this ability since the computation of the portfolio weights destroys an existing path so that the current path would have to be saved up to time t. We don't need the ability to condition and so it is not implemented.
public double newReturnFromTrading()
The return from trading at the time horizon T computed from a new and independent asset price path.
Return: The return of a trading stratregy is computed as a return on the maximum invested during the life of the strategy: the gains from trading are viewed as interest on the maximum amount sunk into the strategy during its lifetime.
The variable currentWeight
is updated without being used
explicitly. This is done to allow the definition of strategies where the
next weight is defined with reference to the last weight.
public RandomVariable returnsFromTrading()
The terminal returns from trading as a random variable. See information.
public double[] newTradeStatistics()
Computes a vector x of statistics associated with the trading strategy:
during the life of the strategy. All quantities are discounted and derived from a new and independent path of the asset computed in this method.
Note: the variable currentWeight
must be kept up to date
at all times since the method newWeight(int t)
might make
use of it.
public RandomVector tradeStatistics()
The newTradeStatistics()
as a random vector X:
during the life of the strategy. Note that the time parameter t is ignored, that is, no ability to condition on information available at time t is implemented. Useful only for computations at time t=0.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 