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
f75aa9ff
Commit
f75aa9ff
authored
Oct 24, 2018
by
Amelin Konstantin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change Main. Add dynamically formed output file name.
parent
26fae532
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
src/main/scala/Main.scala
+3
-2
src/main/scala/templates/TradeTemplate.scala
+5
-5
No files found.
src/main/scala/Main.scala
View file @
f75aa9ff
...
@@ -16,8 +16,9 @@ object Main extends App {
...
@@ -16,8 +16,9 @@ object Main extends App {
}
}
}
}
val
sourceName
=
"Repo NSD bond"
val
p
=
new
PrettyPrinter
(
140
,
2
)
val
p
=
new
PrettyPrinter
(
140
,
2
)
val
sourceXml
=
XML
.
loadFile
(
"src/main/resources/nsd/
Repo Client equity
.xml"
)
val
sourceXml
=
XML
.
loadFile
(
"src/main/resources/nsd/
"
+
sourceName
+
"
.xml"
)
val
template
=
Template
(
sourceXml
)
val
template
=
Template
(
sourceXml
)
val
outputXml
=
XML
.
loadString
(
p
.
format
(
template
.
render
))
val
outputXml
=
XML
.
loadString
(
p
.
format
(
template
.
render
))
//val outputXml = template.template
//val outputXml = template.template
...
@@ -38,6 +39,6 @@ object Main extends App {
...
@@ -38,6 +39,6 @@ object Main extends App {
case
Failure
(
ex
)
=>
println
(
s
"Output xml isn`t wellformed or invalid: ${ex.getMessage}"
)
case
Failure
(
ex
)
=>
println
(
s
"Output xml isn`t wellformed or invalid: ${ex.getMessage}"
)
}
}
XML
.
save
(
"output/
Output repo
RTS.xml"
,
outputXml
,
xmlDecl
=
true
)
XML
.
save
(
"output/
"
+
sourceName
+
"_
RTS.xml"
,
outputXml
,
xmlDecl
=
true
)
}
}
src/main/scala/templates/TradeTemplate.scala
View file @
f75aa9ff
...
@@ -44,7 +44,7 @@ abstract class TradeTemplate(source: Node) extends Template(source) {
...
@@ -44,7 +44,7 @@ abstract class TradeTemplate(source: Node) extends Template(source) {
<fpml:executionDateTime>
{
get
(
source
\
"
trade
"
\
"
tradeHeader
"
\
"
tradeDate
"
)
+
"
T00:
00
:
00"
}
</fpml:executionDateTime>
<fpml:executionDateTime>
{
get
(
source
\
"
trade
"
\
"
tradeHeader
"
\
"
tradeDate
"
)
+
"
T00:
00
:
00"
}
</fpml:executionDateTime>
<fpml:reportingRegime>
<fpml:reportingRegime>
<fpml:name>
{
get
(
source
\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeInformation
"
\
"
reportingRegime
"
\
"
name
"
)
}
</fpml:name>
<fpml:name>
{
get
(
source
\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeInformation
"
\
"
reportingRegime
"
\
"
name
"
)
}
</fpml:name>
<fpml:mandatorilyClearable>
{
if
(
get
(
source
\
"
trade
"
\
"
nsdSpecificTradeFields
"
\
"
cleared
"
)
.mkString.contains
(
"
Y
"
))
"
true
"
else
""
}
</fpml:mandatorilyClearable>
<fpml:mandatorilyClearable>
{
if
(
get
(
source
\
"
trade
"
\
"
nsdSpecificTradeFields
"
\
"
cleared
"
)
.mkString.contains
(
"
Y
"
))
"
true
"
else
msgNotFound
}
</fpml:mandatorilyClearable>
</fpml:reportingRegime>
</fpml:reportingRegime>
</fpml:partyTradeInformation>
</fpml:partyTradeInformation>
{
for
(
s
<-
source
\
"
trade
"
\
"
nsdSpecificTradeFields
"
\
"
clientDetails
"
)
yield
{
{
for
(
s
<-
source
\
"
trade
"
\
"
nsdSpecificTradeFields
"
\
"
clientDetails
"
)
yield
{
...
@@ -80,10 +80,10 @@ abstract class TradeTemplate(source: Node) extends Template(source) {
...
@@ -80,10 +80,10 @@ abstract class TradeTemplate(source: Node) extends Template(source) {
</fpml:timestamps>
</fpml:timestamps>
<fpml:collateralizationType>
{
<fpml:collateralizationType>
{
get
(
source
\
"
trade
"
\
"
collateral
"
\
"
marginType
"
)
.mkString
match
{
get
(
source
\
"
trade
"
\
"
collateral
"
\
"
marginType
"
)
.mkString
match
{
case
v
if
v
==
"
FC
"
=>
"Fully"
case
"
FC
"
=>
"
Fully
"
case
v
if
v
==
"PC"
=>
"Partially"
case
"
PC
"
=>
"
Partially
"
case
v
if
v
==
"OC"
=>
"OneWay"
case
"
OC
"
=>
"OneWay"
case
v
if
v
==
"U"
=>
"Uncollateralized"
case
"U"
=>
"Uncollateralized"
case
_
=>
msgNotFound
case
_
=>
msgNotFound
}
}
}</
fpml
:
collateralizationType>
}</
fpml
:
collateralizationType>
...
...
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