Example: Simulating Long and Short Positions on a Security

The Positions.gsm example model can be found in the can be found in the Financial Examples folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).  It demonstrates how different positions in a single stock might be modeled.  This relatively complex model uses Fund, Investment and Option elements.

A History Generator is used to simulate movement in the stock price, while four Containers simulate the current value and profits from Long, Short, Put and Call positions.

Long Position

In this model a long position is simulated using an Investment element and a Reservoir:

The Investment element simulates the value of the stock as it changes over time, while the Reservoir element has the cost of the stock subtracted from it at the start of the simulation, and the value of the position added to it when it is closed.   In this model, the Close_Long Discrete Change is triggered when the long position’s value is $2000 greater than its starting value or at the end of the simulation, but any valid triggering condition could be used.

Short Position:

A short position is somewhat more complex to simulate as profits or losses need to be accrued and are not applied until the position is closed.  In this example, a conditional Container is used.  Elements inside the conditional Container track the difference between the current value of the investment and the proceeds of the short (which are arbitrarily invested in an interest bearing security modeled by a Fund element):

When the conditional Container is activated at the start of the simulation, it immediately triggers a Discrete Change element representing the short sale and the proceeds are placed into the Short_Position fund where they accrue interest.  

They are also placed into an Investment element that tracks the value of a long position in the stock.  The Short_Position less the Shorted_Stock_Market_Value is equal to the current value of the short.  Once the conditional Container is deactivated (in this model, deactivation is triggered when profits are greater than $1000, losses are greater than $500, or the end of the simulation is reached) the Current_Short_Value is frozen and can then be used to calculate profits.

Put and Call Positions:

In this model, the Put and Call conditional Containers are identical except for the option type.  The Put model is as follows:

The initial value of the Profit Reservoir is set to a negative value equal to the cost of the puts.  The Option element is set up to acquire the option at the start of the simulation and its main output provides the current value of the options.   When the option is exercised (either because it is worth $1000 or more, or because it has a positive value at the end of the option’s term) the holding’s current value is added to the Profit reservoir by the Exercise Discrete Change output of the Option element.

Related Topics…

Learn more about: