Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SPB_Exchange_Repo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Amelin Konstantin
SPB_Exchange_Repo
Commits
b2abb7d4
Commit
b2abb7d4
authored
Oct 29, 2018
by
Amelin Konstantin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CommodityOptionTemplate.
parent
d2118f9d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
1 deletions
+79
-1
src/main/scala/Main.scala
+2
-1
src/main/scala/templates/CommodityOptionTemplate.scala
+77
-0
src/main/scala/templates/TradeTemplate.scala
+0
-0
No files found.
src/main/scala/Main.scala
View file @
b2abb7d4
...
...
@@ -25,7 +25,8 @@ object Main {
case
v
if
v
==
"bondOption"
=>
throw
new
Exception
(
"Undefined trade type"
)
case
v
if
v
==
"equityOption"
=>
if
(
debugMode
)
new
EquityOptionTemplate
(
source
)
with
Logger
else
new
EquityOptionTemplate
(
source
)
case
v
if
v
==
"commodityOption"
=>
throw
new
Exception
(
"Undefined trade type"
)
case
v
if
v
==
"commodityOption"
=>
if
(
debugMode
)
new
CommodityOptionTemplate
(
source
)
with
Logger
else
new
CommodityOptionTemplate
(
source
)
case
v
=>
throw
new
Exception
(
"Undefined trade type"
)
}
}
...
...
src/main/scala/templates/CommodityOptionTemplate.scala
0 → 100644
View file @
b2abb7d4
package
templates
import
scala.xml.Node
class
CommodityOptionTemplate
(
source
:
Node
)
extends
TradeTemplate
(
source
)
{
protected
[
this
]
def
templateTradeBody
:
Node
=
{
<
fpml
:
commodityOption>
<fpml:productType>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
productType
"
)
}
</fpml:productType>
<fpml:productId
productIdScheme
={
get
(
source
\
"trade"
\
"commodityOption"
\
"productId"
,
"productIdScheme"
)
}>{
get
(
source
\
"trade"
\
"commodityOption"
\
"productId"
)
}</
fpml
:
productId>
<fpml:buyerPartyReference
href
={
get
(
source
\
"trade"
\
"commodityOption"
\
"buyerPartyReference"
,
"href"
)
}/>
<
fpml
:
sellerPartyReference
href
={
get
(
source
\
"trade"
\
"commodityOption"
\
"sellerPartyReference"
,
"href"
)
}/>
<
fpml
:
optionType>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
optionType
"
)
}
</fpml:optionType>
<fpml:commodity
id
={
get
(
source
\
"trade"
\
"commodityOption"
\
"commodity"
,
"id"
)
}>
<
fpml
:
instrumentId
instrumentIdScheme
={
get
(
source
\
"trade"
\
"commodityOption"
\
"commodity"
\
"instrumentId"
,
"instrumentIdScheme"
)
}>{
get
(
source
\
"trade"
\
"commodityOption"
\
"commodity"
\
"instrumentId"
)
}</
fpml
:
instrumentId>
<fpml:unit>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
commodity
"
\
"
unit
"
)
}
</fpml:unit>
<fpml:currency>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
commodity
"
\
"
currency
"
)
}
</fpml:currency>
</fpml:commodity>
<fpml:totalNotionalQuantity>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
totalNotionalQuantity
"
)
}
</fpml:totalNotionalQuantity>
<fpml:exercise>
<fpml:americanExercise>
<fpml:exercisePeriod>
<fpml:commencementDate>
<fpml:adjustableDate>
<fpml:unadjustedDate>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\\
"
americanExercise
"
\\
"
commencementDate
"
\\
"
unadjustedDate
"
)
}
</fpml:unadjustedDate>
</fpml:adjustableDate>
</fpml:commencementDate>
<fpml:expirationDate>
<fpml:adjustableDate>
<fpml:unadjustedDate>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\\
"
americanExercise
"
\\
"
expirationDate
"
\\
"
unadjustedDate
"
)
}
</fpml:unadjustedDate>
</fpml:adjustableDate>
</fpml:expirationDate>
</fpml:exercisePeriod>
</fpml:americanExercise>
<fpml:europeanExercise>
<fpml:expirationDate>
<fpml:adjustableDate>
<fpml:unadjustedDate>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\\
"
europeanExercise
"
\\
"
unadjustedDate
"
)
}
</fpml:unadjustedDate>
</fpml:adjustableDate>
</fpml:expirationDate>
</fpml:europeanExercise>
<fpml:settlementCurrency>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
exercise
"
\
"
settlementCurrency
"
)
}
</fpml:settlementCurrency>
<fpml:paymentDates>
<fpml:adjustableDates>
<fpml:unadjustedDate>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
exercise
"
\
"
paymentDates
"
\\
"
unadjustedDate
"
)
}
</fpml:unadjustedDate>
</fpml:adjustableDates>
</fpml:paymentDates>
</fpml:exercise>
<fpml:strikePricePerUnit>
<fpml:currency>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
strikePricePerUnit
"
\
"
currency
"
)
}
</fpml:currency>
<fpml:amount>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
strikePricePerUnit
"
\
"
amount
"
)
}
</fpml:amount>
</fpml:strikePricePerUnit>
<fpml:floatingStrikePricePerUnit>
<fpml:pricingDates>
<fpml:pricingDates>
<fpml:unadjustedDate>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
floatingStrikePricePerUnit
"
\
"
pricingDates
"
\\
"
unadjustedDate
"
)
}
</fpml:unadjustedDate>
</fpml:pricingDates>
</fpml:pricingDates>
<fpml:spread>
<fpml:currency>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
floatingStrikePricePerUnit
"
\\
"
currency
"
)
}
</fpml:currency>
<fpml:amount>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
floatingStrikePricePerUnit
"
\\
"
amount
"
)
}
</fpml:amount>
<fpml:spreadUnit>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
floatingStrikePricePerUnit
"
\\
"
spreadUnit
"
)
}
</fpml:spreadUnit>
</fpml:spread>
<fpml:spreadPercentage>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
floatingStrikePricePerUnit
"
\
"
spreadPercentage
"
)
}
</fpml:spreadPercentage>
</fpml:floatingStrikePricePerUnit>
<fpml:premium>
<fpml:payerPartyReference
href
={
get
(
source
\
"trade"
\
"commodityOption"
\
"premium"
\
"payerPartyReference"
,
"href"
)
}/>
<
fpml
:
receiverPartyReference
href
={
get
(
source
\
"trade"
\
"commodityOption"
\
"premium"
\
"receiverPartyReference"
,
"href"
)
}/>
<
fpml
:
paymentAmount>
<fpml:currency>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
premium
"
\\
"
currency
"
)
}
</fpml:currency>
<fpml:amount>
{
get
(
source
\
"
trade
"
\
"
commodityOption
"
\
"
premium
"
\\
"
amount
"
)
}
</fpml:amount>
</fpml:paymentAmount>
</fpml:premium>
</fpml:commodityOption>
}
def
isStraight
=
true
}
src/main/scala/templates/TradeTemplate.scala
View file @
b2abb7d4
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment