-
Notifications
You must be signed in to change notification settings - Fork 1
Syntax
Contents
When it is useful to represent securities in simple text, the following syntax may be used. This syntax will likely be revised as more is learned.
$100 100
A stock is identified by its ticker symbol, and, if necessary for clarity, the exchange on which it is traded:
BMY NYSE:BMY
If a derivative has already been traded or offered and PitFail has assigned it a name, simply use the name:
x11p
A call option:
100*(GM - 2.3) on 12/10 if GM > 2.3
A put option:
100*(2.3 - GM) on 12/10 if GM < 2.3
A swap:
$50 on 12/10 if GM < 2.3
A bond:
$50 on 12/10
The content of a derivative is itself a security. ( ) may be used if the syntax becomes ambiguous (which should only occur if the content also contains un-named derivatives):
($50 on 12/10) on 11/15 if GM < 2.3
Nested derivatives could become confusing and it may be better for the software not to implement them.
A condition consists of:
security1 < security2 security1 > security2
where the comparison is always done on dollar values. Not all securities can be compared. See Products#Comparing Securities.
Complex securities (such as 100*(2.3 - GM) in the example above) are formed by combining the basic elements described so far.
-GM
Indicates that the trade is performed "the other way", ie the security move from the buyer to the seller.
100*GM
means "100 of the security GM", or in this case 100 shares of GM (since GM by itself is 1 share of GM).
For more complex securities the meaning is less obvious. Say ah2m
is a named
derivitave. What does:
ah2m*7
mean? Somewhat arbitrarily, we take it to mean "A derivative like ah2m
except that all the component securities are multiplied by 7". ie, the
multiplication recurses into the derivative.
It only makes sense to multiply a security by a number.
GM*2 + $5
simply combines the two into a list. Multiplication of a list:
100*(GM + $3)
simply recurses into the list and multiplies each element.
A minus may be used in an infix position:
100 * (GM - $3)