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
8dbcd1c2
Commit
8dbcd1c2
authored
Dec 04, 2018
by
Amelin Konstantin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add parties dictionary. Complete ForwardBondTemplate.
parent
d7b8e607
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
69 additions
and
24 deletions
+69
-24
input/Forward Bond Client 1.xml
+1
-1
src/main/scala/templates/BondForwardTemplate.scala
+3
-2
src/main/scala/templates/ExecutionStatusReportTemplate.scala
+1
-1
src/main/scala/templates/FairValueReportTemplate.scala
+1
-1
src/main/scala/templates/Logger.scala
+1
-1
src/main/scala/templates/PartyTemplate.scala
+34
-0
src/main/scala/templates/RegiAmendTermMasterAgreementTemplate.scala
+1
-1
src/main/scala/templates/RegiAmendTradeTemplate.scala
+9
-6
src/main/scala/templates/Template.scala
+1
-1
src/main/scala/templates/TradeTemplate.scala
+17
-10
No files found.
input/Forward Bond Client 1.xml
View file @
8dbcd1c2
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
<nsdext:clientDetails>
<nsdext:clientDetails>
<nsdext:servicingParty
href=
"Party1"
/>
<nsdext:servicingParty
href=
"Party1"
/>
<nsdext:type>
P
</nsdext:type>
<nsdext:type>
P
</nsdext:type>
<nsdext:id>
PASS_04
_
55582007
</nsdext:id>
<nsdext:id>
PASS_04
55582007
</nsdext:id>
<nsdext:name>
</nsdext:name>
<nsdext:name>
</nsdext:name>
<nsdext:country
countryScheme=
"http://www.fpml.org/ext/iso3166"
>
RU
</nsdext:country>
<nsdext:country
countryScheme=
"http://www.fpml.org/ext/iso3166"
>
RU
</nsdext:country>
</nsdext:clientDetails>
</nsdext:clientDetails>
...
...
src/main/scala/templates/BondForwardTemplate.scala
View file @
8dbcd1c2
...
@@ -7,8 +7,9 @@ class BondForwardTemplate(source: Node) extends TradeTemplate(source) {
...
@@ -7,8 +7,9 @@ class BondForwardTemplate(source: Node) extends TradeTemplate(source) {
<
rtsrep
:
bondForward>
<
rtsrep
:
bondForward>
<fpml:productType>
{
get
(
source
\\
"
trade
"
\
"
bondForward
"
\
"
productType
"
)
}
</fpml:productType>
<fpml:productType>
{
get
(
source
\\
"
trade
"
\
"
bondForward
"
\
"
productType
"
)
}
</fpml:productType>
<fpml:productId
productIdScheme
={
get
(
source
\\
"trade"
\
"bondForward"
\
"productId"
,
"productIdScheme"
)
}>{
get
(
source
\\
"trade"
\
"bondForward"
\
"productId"
)
}</
fpml
:
productId>
<fpml:productId
productIdScheme
={
get
(
source
\\
"trade"
\
"bondForward"
\
"productId"
,
"productIdScheme"
)
}>{
get
(
source
\\
"trade"
\
"bondForward"
\
"productId"
)
}</
fpml
:
productId>
<fpml:buyerPartyReference
href
={
get
(
source
\\
"trade"
\
"bondForward"
\
"buyerPartyReference"
,
"href"
)
}/>
{
/*
Uses
dictionary
from
PartyTemplate
for
identifier
*/
}
<
fpml
:
sellerPartyReference
href
={
get
(
source
\\
"trade"
\
"bondForward"
\
"sellerPartyReference"
,
"href"
)
}/>
<fpml:buyerPartyReference
href
={
parties
(
get
(
source
\\
"trade"
\
"bondForward"
\
"buyerPartyReference"
,
"href"
).
mkString
).
_1
}/>
<
fpml
:
sellerPartyReference
href
={
parties
(
get
(
source
\\
"trade"
\
"bondForward"
\
"sellerPartyReference"
,
"href"
).
mkString
).
_1
}/>
<
rtsrep
:
underlyer>
<
rtsrep
:
underlyer>
<fpml:singleUnderlyer>
<fpml:singleUnderlyer>
<fpml:equity
id
={
get
(
source
\\
"trade"
\
"bondForward"
\
"underlyer"
\
"singleUnderlyer"
\
"equity"
,
"id"
)
}>
<fpml:equity
id
={
get
(
source
\\
"trade"
\
"bondForward"
\
"underlyer"
\
"singleUnderlyer"
\
"equity"
,
"id"
)
}>
...
...
src/main/scala/templates/ExecutionStatusReportTemplate.scala
View file @
8dbcd1c2
...
@@ -2,7 +2,7 @@ package templates
...
@@ -2,7 +2,7 @@ package templates
import
scala.xml.Node
import
scala.xml.Node
class
ExecutionStatusReportTemplate
(
source
:
Node
)
extends
Template
(
source
)
{
class
ExecutionStatusReportTemplate
(
source
:
Node
)
extends
Party
Template
(
source
)
{
def
template
:
Node
=
{
def
template
:
Node
=
{
<
rtsrep
:
executionStatusReportRegistration
xmlns:fpml
=
"http://www.fpml.org/FpML-5/recordkeeping"
<
rtsrep
:
executionStatusReportRegistration
xmlns:fpml
=
"http://www.fpml.org/FpML-5/recordkeeping"
...
...
src/main/scala/templates/FairValueReportTemplate.scala
View file @
8dbcd1c2
...
@@ -2,7 +2,7 @@ package templates
...
@@ -2,7 +2,7 @@ package templates
import
scala.xml.Node
import
scala.xml.Node
class
FairValueReportTemplate
(
source
:
Node
)
extends
Template
(
source
)
{
class
FairValueReportTemplate
(
source
:
Node
)
extends
Party
Template
(
source
)
{
def
template
:
Node
=
{
def
template
:
Node
=
{
<
rtsrep
:
fairValueReportRegistration
xmlns:fpml
=
"http://www.fpml.org/FpML-5/recordkeeping"
<
rtsrep
:
fairValueReportRegistration
xmlns:fpml
=
"http://www.fpml.org/FpML-5/recordkeeping"
...
...
src/main/scala/templates/Logger.scala
View file @
8dbcd1c2
...
@@ -7,7 +7,7 @@ import scala.xml.{NodeSeq, Text}
...
@@ -7,7 +7,7 @@ import scala.xml.{NodeSeq, Text}
trait
Logger
{
trait
Logger
{
this:
Template
=>
this:
Template
=>
private
[
this
]
val
data
=
{
private
[
this
]
lazy
val
data
=
{
val
m
:
mutable.LinkedHashMap
[
Int
,
mutable.Queue
[(
String
,
String
,
mutable.LinkedHashMap
[
Int
,
(
String
,
String
)])]]
=
val
m
:
mutable.LinkedHashMap
[
Int
,
mutable.Queue
[(
String
,
String
,
mutable.LinkedHashMap
[
Int
,
(
String
,
String
)])]]
=
mutable
.
LinkedHashMap
()
mutable
.
LinkedHashMap
()
val
items
=
source
\\
"_"
val
items
=
source
\\
"_"
...
...
src/main/scala/templates/PartyTemplate.scala
0 → 100644
View file @
8dbcd1c2
package
templates
import
scala.xml.Node
abstract
class
PartyTemplate
(
source
:
Node
)
extends
Template
(
source
)
{
protected
[
this
]
val
parties
=
{
val
p1
=
for
{
s
<-
source
\
"party"
id
=
get
(
s
,
"id"
).
mkString
if
id
!=
"Sender"
&&
id
!=
"UTIGeneratingParty"
}
yield
{
val
partyId0
=
get
(
s
\
"partyId"
).
mkString
.
filterNot
(
_
.
isWhitespace
)
if
(
partyId0
!=
"NONREF"
)
id
->
(
partyId0
,
msgNotFound
)
else
{
val
partyId1
=
get
(
s
\
"partyId"
,
null
,
1
).
mkString
.
filterNot
(
_
.
isWhitespace
)
id
->
(
partyId1
,
partyId1
.
split
(
'_')
.
head
)
}
}
val
p2
=
for
{
s
<-
source
\\
"trade"
\
"nsdSpecificTradeFields"
\
"clientDetails"
id
=
get
(
s
\
"id"
).
mkString
if
id
!=
msgNotFound
}
yield
{
val
partyId
=
id
.
filterNot
(
_
.
isWhitespace
)
id
->
(
partyId
,
partyId
.
split
(
'_')
.
head
)
}
(
p1
++
p2
).
toMap
}
println
(
parties
)
}
src/main/scala/templates/RegiAmendTermMasterAgreementTemplate.scala
View file @
8dbcd1c2
...
@@ -2,7 +2,7 @@ package templates
...
@@ -2,7 +2,7 @@ package templates
import
scala.xml.
{
Node
,
NodeSeq
}
import
scala.xml.
{
Node
,
NodeSeq
}
abstract
class
RegiAmendTermMasterAgreementTemplate
(
source
:
Node
)
extends
Template
(
source
)
{
abstract
class
RegiAmendTermMasterAgreementTemplate
(
source
:
Node
)
extends
Party
Template
(
source
)
{
protected
[
this
]
def
templateMATerms
:
NodeSeq
protected
[
this
]
def
templateMATerms
:
NodeSeq
def
template
:
Node
=
{
def
template
:
Node
=
{
...
...
src/main/scala/templates/RegiAmendTradeTemplate.scala
View file @
8dbcd1c2
...
@@ -2,7 +2,7 @@ package templates
...
@@ -2,7 +2,7 @@ package templates
import
scala.xml.Node
import
scala.xml.Node
abstract
class
RegiAmendTradeTemplate
(
source
:
Node
)
extends
Template
(
source
)
{
abstract
class
RegiAmendTradeTemplate
(
source
:
Node
)
extends
Party
Template
(
source
)
{
protected
[
this
]
def
templateTrade
:
Node
protected
[
this
]
def
templateTrade
:
Node
def
template
:
Node
=
{
def
template
:
Node
=
{
...
@@ -28,20 +28,23 @@ abstract class RegiAmendTradeTemplate(source: Node) extends Template(source) {
...
@@ -28,20 +28,23 @@ abstract class RegiAmendTradeTemplate(source: Node) extends Template(source) {
<fpml:effectiveDate>
{
get
(
source
\
"
amendment
"
\
"
effectiveDate
"
)
}
</fpml:effectiveDate>
<fpml:effectiveDate>
{
get
(
source
\
"
amendment
"
\
"
effectiveDate
"
)
}
</fpml:effectiveDate>
</fpml:amendment>
</fpml:amendment>
}
}
{
/* Uses dictionary from PartyTemplate for identifier */
}
{
for
{
s
<-
source
\
"party"
{
for
{
s
<-
source
\
"party"
id
=
get
(
s
,
"id"
).
mkString
id
=
get
(
s
,
"id"
).
mkString
if
id
!=
"Sender"
&&
id
!=
"UTIGeneratingParty"
}
yield
{
if
id
!=
"Sender"
&&
id
!=
"UTIGeneratingParty"
}
yield
{
<
fpml
:
party
id
={
id
}>
<
fpml
:
party
id
={
parties
(
id
).
_1
}>
<
fpml
:
partyId
partyIdScheme
={
get
(
s
\
"partyId"
,
"partyIdScheme"
)
}>{
get
(
s
\
"partyId"
)
}</
fpml
:
partyId>
<
fpml
:
partyId
partyIdScheme
={
parties
(
id
).
_2
}>{
parties
(
id
).
_1
}</
fpml
:
partyId>
<fpml:partyName>
{
get
(
s
\
"
partyName
"
)
}
</fpml:partyName>
<fpml:partyName>
{
get
(
s
\
"
partyName
"
)
}
</fpml:partyName>
<fpml:country>
{
get
(
s
\
"
country
"
)
}
</fpml:country>
<fpml:country>
{
get
(
s
\
"
country
"
)
}
</fpml:country>
<fpml:organizationType>
{
get
(
s
\
"
classification
"
)
}
</fpml:organizationType>
<fpml:organizationType>
{
get
(
s
\
"
classification
"
)
}
</fpml:organizationType>
</fpml:party>
</fpml:party>
}
}
}
}
{
for
(
s
<-
source
\\
"trade"
\
"nsdSpecificTradeFields"
\
"clientDetails"
)
yield
{
{
for
{
s
<-
source
\\
"trade"
\
"nsdSpecificTradeFields"
\
"clientDetails"
<
fpml
:
party
id
={
get
(
s
\
"id"
)
}>
id
=
get
(
s
\
"id"
).
mkString
<
fpml
:
partyId>
{
get
(
s
\
"
id
"
)
}
</fpml:partyId>
if
id
!=
msgNotFound
}
yield
{
<
fpml
:
party
id
={
parties
(
id
).
_1
}>
<
fpml
:
partyId
partyIdScheme
={
parties
(
id
).
_2
}>{
parties
(
id
).
_1
}</
fpml
:
partyId>
<fpml:partyName>
{
get
(
s
\
"
name
"
)
}
</fpml:partyName>
<fpml:partyName>
{
get
(
s
\
"
name
"
)
}
</fpml:partyName>
<fpml:country>
{
get
(
s
\
"
country
"
)
}
</fpml:country>
<fpml:country>
{
get
(
s
\
"
country
"
)
}
</fpml:country>
<fpml:organizationType>
{
get
(
s
\
"
classification
"
)
}
</fpml:organizationType>
<fpml:organizationType>
{
get
(
s
\
"
classification
"
)
}
</fpml:organizationType>
...
...
src/main/scala/templates/Template.scala
View file @
8dbcd1c2
...
@@ -52,7 +52,7 @@ abstract class Template(protected[this] val source: Node) {
...
@@ -52,7 +52,7 @@ abstract class Template(protected[this] val source: Node) {
}
}
def
info
(
msg
:
String
)
:
String
=
msg
def
info
(
msg
:
String
)
:
String
=
msg
}
}
object
Template
{
object
Template
{
def
apply
(
source
:
Node
)(
implicit
templateFactory
:
Node
=>
Template
)
:
Template
=
templateFactory
(
source
)
def
apply
(
source
:
Node
)(
implicit
templateFactory
:
Node
=>
Template
)
:
Template
=
templateFactory
(
source
)
...
...
src/main/scala/templates/TradeTemplate.scala
View file @
8dbcd1c2
...
@@ -8,19 +8,20 @@ abstract class TradeTemplate(source: Node) extends RegiAmendTradeTemplate(source
...
@@ -8,19 +8,20 @@ abstract class TradeTemplate(source: Node) extends RegiAmendTradeTemplate(source
protected
[
this
]
def
templateTrade
:
Node
=
{
protected
[
this
]
def
templateTrade
:
Node
=
{
<
fpml
:
trade>
<
fpml
:
trade>
<fpml:tradeHeader>
<fpml:tradeHeader>
{
/*
Uses
dictionary
from
PartyTemplate
for
identifier
*/
}
{
for
{
s
<-
source
\\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeIdentifier
"
{
for
{
s
<-
source
\\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeIdentifier
"
id
=
get
(
s
\
"
partyReference
"
,
"
href
"
)
.mkString
id
=
get
(
s
\
"
partyReference
"
,
"
href
"
)
.mkString
if
id
!=
"Sender"
&&
id
!=
"UTIGeneratingParty"
}
yield
{
if
id
!=
"Sender"
&&
id
!=
"UTIGeneratingParty"
}
yield
{
<
fpml
:
partyTradeIdentifier>
<
fpml
:
partyTradeIdentifier>
<fpml:partyReference
href
={
id
}/>
<fpml:partyReference
href
={
parties
(
id
).
_1
}/>
<
fpml
:
tradeId
tradeIdScheme
={
get
(
s
\
"tradeId"
,
"tradeIdScheme"
)
}>{
get
(
s
\
"tradeId"
)
}</
fpml
:
tradeId>
<
fpml
:
tradeId
tradeIdScheme
={
get
(
s
\
"tradeId"
,
"tradeIdScheme"
)
}>{
get
(
s
\
"tradeId"
)
}</
fpml
:
tradeId>
</fpml:partyTradeIdentifier>
</fpml:partyTradeIdentifier>
}
}
}
}
<
fpml
:
partyTradeInformation>
<
fpml
:
partyTradeInformation>
<fpml:partyReference
href
={
get
(
source
\\
"trade"
\
"tradeHeader"
\
"partyTradeInformation"
\
"partyReference"
,
"href"
)
}/>
<fpml:partyReference
href
={
parties
(
get
(
source
\\
"trade"
\
"tradeHeader"
\
"partyTradeInformation"
\
"partyReference"
,
"href"
).
mkString
).
_1
}/>
<
fpml
:
relatedParty>
<
fpml
:
relatedParty>
<fpml:partyReference
href
={
get
(
source
\\
"trade"
\
"tradeHeader"
\
"partyTradeInformation"
\
"partyReference"
,
"href"
)
}
/>
<fpml:partyReference
href
={
parties
(
get
(
source
\\
"trade"
\
"tradeHeader"
\
"partyTradeInformation"
\
"partyReference"
,
"href"
).
mkString
).
_1
}
/>
<
fpml
:
role>ClearingOrganization</fpml:role>
<
fpml
:
role>ClearingOrganization</fpml:role>
</fpml:relatedParty>
</fpml:relatedParty>
<fpml:category
categoryScheme
=
"http://www.fpml.ru/repository/trade-settlement-type"
>{
get
(
source
\\
"trade"
\
"nsdSpecificTradeFields"
\
"clearSettlementType"
)
}</
fpml
:
category>
<fpml:category
categoryScheme
=
"http://www.fpml.ru/repository/trade-settlement-type"
>{
get
(
source
\\
"trade"
\
"nsdSpecificTradeFields"
\
"clearSettlementType"
)
}</
fpml
:
category>
...
@@ -34,12 +35,15 @@ abstract class TradeTemplate(source: Node) extends RegiAmendTradeTemplate(source
...
@@ -34,12 +35,15 @@ abstract class TradeTemplate(source: Node) extends RegiAmendTradeTemplate(source
</fpml:partyTradeInformation>
</fpml:partyTradeInformation>
{
for
(
s
<-
source
\\
"
trade
"
\
"
nsdSpecificTradeFields
"
\
"
clientDetails
"
)
yield
{
{
for
(
s
<-
source
\\
"
trade
"
\
"
nsdSpecificTradeFields
"
\
"
clientDetails
"
)
yield
{
<fpml:partyTradeInformation>
<fpml:partyTradeInformation>
<fpml:partyReference
href
={
get
(
s
\
"
servicingParty
"
,
"
href
"
)
}
/>
<fpml:partyReference
href
={
parties
(
get
(
s
\
"
servicingParty
"
,
"
href
"
)
.mkString
)
.
_
1
}
/>
<fpml:relatedParty>
{
val
id
=
get
(
s
\
"
id
"
)
.mkString
<fpml:partyReference
href
={
get
(
s
\
"id"
)
}
/>
if
(
id
!=
msgNotFound
)
<
fpml
:
role>
{
if
(
get
(
s
\
"
id
"
)
.mkString
!=
msgNotFound
)
"
Client
"
else
msgNotFound
}
</fpml:role>
<
fpml
:
relatedParty>
<fpml:
type
>
{
get
(
s
\
"
type
"
)
}
</fpml:
type
>
<fpml:partyReference
href
={
parties
(
id
).
_1
}
/>
</fpml:relatedParty>
<
fpml
:
role>
{
"
Client
"
}
</fpml:role>
<fpml:
type
>
{
get
(
s
\
"
type
"
)
}
</fpml:
type
>
</fpml:relatedParty>
}
<
fpml
:
timestamps>
<
fpml
:
timestamps>
<fpml:timestamp>
<fpml:timestamp>
<fpml:
type
>
{
if
(
get
(
source
\\
"
trade
"
\
"
nsdSpecificTradeFields
"
\
"
clearedDate
"
)
.mkString
!=
msgNotFound
)
"
InClearingPool
"
else
msgNotFound
}
</fpml:
type
>
<fpml:
type
>
{
if
(
get
(
source
\\
"
trade
"
\
"
nsdSpecificTradeFields
"
\
"
clearedDate
"
)
.mkString
!=
msgNotFound
)
"
InClearingPool
"
else
msgNotFound
}
</fpml:
type
>
...
@@ -83,7 +87,10 @@ abstract class TradeTemplate(source: Node) extends RegiAmendTradeTemplate(source
...
@@ -83,7 +87,10 @@ abstract class TradeTemplate(source: Node) extends RegiAmendTradeTemplate(source
{
templateTradeBody
}
{
templateTradeBody
}
<fpml:documentation>
<fpml:documentation>
<fpml:masterAgreement>
<fpml:masterAgreement>
<fpml:masterAgreementId>
{
get
(
source
\\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeIdentifier
"
\
"
linkId
"
)
}
</fpml:masterAgreementId>
<fpml:masterAgreementId>
{
val
id
=
get
(
source
\\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeIdentifier
"
\
"
linkId
"
)
.mkString
if
(
id
!=
msgNotFound
)
id
else
"NONREF"
}</
fpml
:
masterAgreementId>
</fpml:masterAgreement>
</fpml:masterAgreement>
</fpml:documentation>
</fpml:documentation>
</fpml:trade>
</fpml:trade>
...
...
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