SlideShare a Scribd company logo
1 of 20
MongoDB in FS
Position & Trade Management

    27th November 2012
          Daniel Roberts
Relational Database Challenges
Data Types                   Agile Development
• Unstructured data          • Iterative
• Semi-structured            • Short development
  data                         cycles
• Polymorphic data           • New workloads




Volume of Data               New Architectures
• Petabytes of data          • Horizontal scaling
• Trillions of records       • Commodity
                               servers
• Tens of millions of
  queries per second         • Cloud computing


                         2
Why MongoDB in FS?


•   Flexible schemas
•   Scale Out
•   Aggregations
                        •   High Volume Data Feeds
•   Agile Development   •   Tick Data / Time series
                        •   Risk Analytics
                        •   Product Catalogs & Trade Capture
                        •   P&L Reporting
                        •   Reference Data Management
                        •   Portfolio Management
                        •   Quantitative Analysis
                        •   Automated Trading

                        3
Agile development

RDBMS               MongoDB

                    {
                    _id: ObjectId("4c4ba5e5e8aabf3"),

                    "NewOrder-Single" : {

                    "Header" : {

                            "BeginString" : "FIX.4.2",

                            "BodyLength" : 190,

                            "MsgType" : "D",

                            "HeaderFields" : {

                            "SenderCompID" : "Client",

                                    "TargetCompID" : "TradingGateway",

                                    "MsgSeqNum" : 4,

                                    "SendingTime" : {

                                    "UTCFormat_2051-100" :

                    "Fri Jun 01 09:36:26 BST 2012”

                    }....




                4
Scalable Out




               5
Global Replication



                     Primary
         Secondary




                               Secondary




                      6
MongoDB Solutions
Use cases


 Order Capture                       Product Catalogs



 Aggregate / calculate data          Trade History


 Globally replicated reference
                                     Time Series data
 data


 Aggregation Framework               Fast, In-Place Updates




                                 8
Product Catalogs

  Catalogs of complex financial products
  • ‘Exotics’ difficult to model in relational db.
  • ‘On-boarding’ new products in hours.
  • Representation in RDBMS may require >~50 tables.
  • What’s the impact from technology?
  • Once created how do we capture the details of a new trade?

  Why MongoDB?
  • Flexible schema means we don’t need to go back to the database
    when we have a product to sell.
  • Single collection for all products... even if they vary greatly
  • Trades potentially exist for long periods
  • Newer trade can have different data with not impact on the db.




                                  9
Order Capture

                        {
                        _id: ObjectId("4c4ba5.."),
                        "NewOrder-Single" : {
                        "Header" : {

• Capture messages              "BeginString" : "FIX.4.2",
                                "BodyLength" : 190,
                                "MsgType" : "D",
• Variable formats              "HeaderFields" : {
                                "SenderCompID" : "Client",
  – Eg Fix 4.2 or 5.0            "TargetCompID" :
                        "TradingGateway",
                                     "MsgSeqNum" : 4,
                                     "SendingTime" : {
                                     "UTCFormat_2051-100" :
                        "Fri Jun 01 09:36:26 BST 2012”
                        }....



                        10
Execution reports

  {
      "_id" : ObjectId("5051d573036441c9062d6629"),
            "ExecutionReport" : {
            "StandardMessageHeader" : {
                 "BeginString" : "FIX.4.2",
                 "BodyLength" : 265,
                 "MsgType" : "8”,
            },
            "ExecutionReportBody" : {
                 "OrderID" : "OrderID_142201",
                 "ClOrdID" : "20120909-142159-4597031",
                       "Instrument" : {"Symbol" : "MSFT” },
                 "OrderQtyData" : { "OrderQty" : 100000 },
                 "OrdTYpe" : "1",
                 "Currency" : "USD",
                 "LastShares" : 50000,
                 "LastPx" : 100.5,
                 "LeavesQty" : 50000,
                 "CumQty" : 50000,
                 "AvgPx" : 100.5,
                 "TransactTime" : {
                       "UTC" : "Sun Sep 09 14:22:01 BST 2012"
                 },
                 …..
            }
  }


                                       11
Aggregation Framework

db.ExecutionReport.aggregate(
{
  $match : {"Instrument.Symbol":"MSFT"},

 $group : {
  _id : "$ExecutionReport.ReportBody.ClOrdID",

          reportsPerOrd : { $sum : 1 },

      totalNumOrdered :   { $sum :
             "$ExecutionReport.ReportBody.OrderQtyData.OrderQty"},

               avgPrice : { $avg :
                "$ExecutionReport.ExecutionReportBody.AvgPx"
      }
  }
});


                                              12
Results
{
    "result" : [
         {
                   "_id" : "20120909-142604-3800196",
                   "reportsPerOrd" : 2,
                   "totalNumOrdered" : 200000,
                   "avgPrice" : 100.5
          },
          {
                   "_id" : "20120909-142603-7560516",
                   "reportsPerOrd" : 2,
                   "totalNumOrdered" : 200000,
                   "avgPrice" : 100.25
          }
          …
    ],
    "ok" : 1
}




                                             13
Aggregate View of Positions

 { "account" : 123000234, "instrument" : "MSFT", "quantity" : 10000, "ts" :
 ISODate("2012-12-25T00:00:00Z"), "buyPrice" : 26.67 }

 { "account" : 123000234, "instrument" : "MSFT", "quantity" : 4534, "ts" :
 ISODate("2012-12-27T00:00:00Z"), "buyPrice" : 27.39 }

 { "account" : 123000234, "instrument" : "MSFT", "quantity" : 4534, "ts" :
 ISODate("2012-12-20T00:00:00Z"), "buyPrice" : 24.39 }

 { "account" : 123000234, "instrument" : "GOOG", "quantity" : 8768, "ts" :
 ISODate("2012-12-25T00:00:00Z"), "buyPrice" : 526.67 }

 { "account" : 123000234, "instrument" : "GOOG", "quantity" : 324, "ts" :
 ISODate("2012-12-20T00:00:00Z"), "buyPrice" : 630.59 }




                                      14
Calculate P&L – aggregated positions

var currentPrice = 656.54;
db.pl.aggregate([
     {$match:{"instrument" : "GOOG"}},
     {$project : {instrument:1,
         currentValue :       { $multiply:["$quantity", currentPrice] },
         purchaseValue : { $multiply:["$quantity", "$buyPrice"]}}
     },
     {$group : {_id: "$instrument",
         currentValue :       {$sum : "$currentValue"},
         purchaseValue: {$sum : "$purchaseValue"}}
     },
     {$project: {_id: 0, instrument: "$_id",
         currentValue: 1,
         purchaseValue: 1,
         profit :             {$subtract : ["$currentValue","$purchaseValue"]}}}
]);


                                       15
Results


    {
        "result" : [
             {
                   "currentValue" :    5969261.68,
                   "purchaseValue" :   4822153.72,
                   "instrument" :      "GOOG",
                   "profit" :          1147107.96
             }
        ],
        "ok" : 1
    }




                                  16
Trade History

  • Store historical trades and deltas over time
  • Maintain all data online.. Eg. 7 years
  • Recent data maintained hot in ‘Working Set’
                         300 GB Working Set




             128 GB           128 GB          128 GB
              RAM              RAM             RAM



              1 TB             1 TB            1 TB
             Data on          Data on         Data on
              Disk             Disk            Disk




             Shard 1         Shard 2          Shard 3




                                  17
Summary


  •   Product Catalogs
  •   Trade Capture
  •    Handle changes easily over time
  •   Aggregate trades / orders / executions
  •   Calculate P&L across stored positions
  •   Store trade updates and deltas




                                18
For More Information

 Resource                     User Data Management
                              Location

 MongoDB Downloads            www.mongodb.org/download

 Free Online Training         education.10gen.com

 Webinars and Events          www.10gen.com/events

 White Papers                 www.10gen.com/white-papers

 Customer Case Studies        www.10gen.com/customers

 Presentations                www.10gen.com/presentations

 Documentation                docs.mongodb.org

 Additional Info              info@10gen.com


                         19
Webinar: Position and Trade Management with MongoDB

More Related Content

What's hot

Event-Based Subscription with MongoDB
Event-Based Subscription with MongoDBEvent-Based Subscription with MongoDB
Event-Based Subscription with MongoDB
MongoDB
 
Using NoSQL and Enterprise Shared Services (ESS) to Achieve a More Efficient ...
Using NoSQL and Enterprise Shared Services (ESS) to Achieve a More Efficient ...Using NoSQL and Enterprise Shared Services (ESS) to Achieve a More Efficient ...
Using NoSQL and Enterprise Shared Services (ESS) to Achieve a More Efficient ...
MongoDB
 
Single view with_mongo_db_(lo)
Single view with_mongo_db_(lo)Single view with_mongo_db_(lo)
Single view with_mongo_db_(lo)
MongoDB
 
Single View of the Customer
Single View of the Customer Single View of the Customer
Single View of the Customer
MongoDB
 
Calculating ROI with Innovative eCommerce Platforms
Calculating ROI with Innovative eCommerce PlatformsCalculating ROI with Innovative eCommerce Platforms
Calculating ROI with Innovative eCommerce Platforms
MongoDB
 

What's hot (20)

Webinar: Real-time Risk Management and Regulatory Reporting with MongoDB
Webinar: Real-time Risk Management and Regulatory Reporting with MongoDBWebinar: Real-time Risk Management and Regulatory Reporting with MongoDB
Webinar: Real-time Risk Management and Regulatory Reporting with MongoDB
 
Event-Based Subscription with MongoDB
Event-Based Subscription with MongoDBEvent-Based Subscription with MongoDB
Event-Based Subscription with MongoDB
 
Webinar: How Financial Firms Create a Single Customer View with MongoDB
 Webinar: How Financial Firms Create a Single Customer View with MongoDB Webinar: How Financial Firms Create a Single Customer View with MongoDB
Webinar: How Financial Firms Create a Single Customer View with MongoDB
 
Using NoSQL and Enterprise Shared Services (ESS) to Achieve a More Efficient ...
Using NoSQL and Enterprise Shared Services (ESS) to Achieve a More Efficient ...Using NoSQL and Enterprise Shared Services (ESS) to Achieve a More Efficient ...
Using NoSQL and Enterprise Shared Services (ESS) to Achieve a More Efficient ...
 
MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?
MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?
MongoDB Evenings Minneapolis: MongoDB is Cool But When Should I Use It?
 
How Insurance Companies Use MongoDB
How Insurance Companies Use MongoDB How Insurance Companies Use MongoDB
How Insurance Companies Use MongoDB
 
Webinar: Making A Single View of the Customer Real with MongoDB
Webinar: Making A Single View of the Customer Real with MongoDBWebinar: Making A Single View of the Customer Real with MongoDB
Webinar: Making A Single View of the Customer Real with MongoDB
 
Operationalizing the Value of MongoDB: The MetLife Experience
Operationalizing the Value of MongoDB: The MetLife ExperienceOperationalizing the Value of MongoDB: The MetLife Experience
Operationalizing the Value of MongoDB: The MetLife Experience
 
MongoDB Europe 2016 - Who’s Helping Themselves To Your Data? Demystifying Mon...
MongoDB Europe 2016 - Who’s Helping Themselves To Your Data? Demystifying Mon...MongoDB Europe 2016 - Who’s Helping Themselves To Your Data? Demystifying Mon...
MongoDB Europe 2016 - Who’s Helping Themselves To Your Data? Demystifying Mon...
 
MongoDB Evenings Houston: Implementing EDW Using MongoDB by Purvesh Patel, Ch...
MongoDB Evenings Houston: Implementing EDW Using MongoDB by Purvesh Patel, Ch...MongoDB Evenings Houston: Implementing EDW Using MongoDB by Purvesh Patel, Ch...
MongoDB Evenings Houston: Implementing EDW Using MongoDB by Purvesh Patel, Ch...
 
IOOF IT System Modernisation
IOOF IT System ModernisationIOOF IT System Modernisation
IOOF IT System Modernisation
 
Webinar: MongoDB and Analytics: Building Solutions with the MongoDB BI Connector
Webinar: MongoDB and Analytics: Building Solutions with the MongoDB BI ConnectorWebinar: MongoDB and Analytics: Building Solutions with the MongoDB BI Connector
Webinar: MongoDB and Analytics: Building Solutions with the MongoDB BI Connector
 
Single view with_mongo_db_(lo)
Single view with_mongo_db_(lo)Single view with_mongo_db_(lo)
Single view with_mongo_db_(lo)
 
MongoDB Evenings DC: MongoDB - The New Default Database for Giant Ideas
MongoDB Evenings DC: MongoDB - The New Default Database for Giant IdeasMongoDB Evenings DC: MongoDB - The New Default Database for Giant Ideas
MongoDB Evenings DC: MongoDB - The New Default Database for Giant Ideas
 
Webinar: How to Drive Business Value in Financial Services with MongoDB
Webinar: How to Drive Business Value in Financial Services with MongoDBWebinar: How to Drive Business Value in Financial Services with MongoDB
Webinar: How to Drive Business Value in Financial Services with MongoDB
 
Single View of the Customer
Single View of the Customer Single View of the Customer
Single View of the Customer
 
Jumpstart: Introduction to MongoDB
Jumpstart: Introduction to MongoDBJumpstart: Introduction to MongoDB
Jumpstart: Introduction to MongoDB
 
Calculating ROI with Innovative eCommerce Platforms
Calculating ROI with Innovative eCommerce PlatformsCalculating ROI with Innovative eCommerce Platforms
Calculating ROI with Innovative eCommerce Platforms
 
Webinar: How Financial Organizations use MongoDB for Real-time Risk Managemen...
Webinar: How Financial Organizations use MongoDB for Real-time Risk Managemen...Webinar: How Financial Organizations use MongoDB for Real-time Risk Managemen...
Webinar: How Financial Organizations use MongoDB for Real-time Risk Managemen...
 
MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개
 

Similar to Webinar: Position and Trade Management with MongoDB

MongoDB Tick Data Presentation
MongoDB Tick Data PresentationMongoDB Tick Data Presentation
MongoDB Tick Data Presentation
MongoDB
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
MongoDB APAC
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
MongoDB
 
Data Processing and Aggregation with MongoDB
Data Processing and Aggregation with MongoDB Data Processing and Aggregation with MongoDB
Data Processing and Aggregation with MongoDB
MongoDB
 

Similar to Webinar: Position and Trade Management with MongoDB (20)

Webinar: Managing Real Time Risk Analytics with MongoDB
Webinar: Managing Real Time Risk Analytics with MongoDB Webinar: Managing Real Time Risk Analytics with MongoDB
Webinar: Managing Real Time Risk Analytics with MongoDB
 
How Banks Manage Risk with MongoDB
How Banks Manage Risk with MongoDBHow Banks Manage Risk with MongoDB
How Banks Manage Risk with MongoDB
 
MongoDB Tick Data Presentation
MongoDB Tick Data PresentationMongoDB Tick Data Presentation
MongoDB Tick Data Presentation
 
Beyond the Basics 2: Aggregation Framework
Beyond the Basics 2: Aggregation Framework Beyond the Basics 2: Aggregation Framework
Beyond the Basics 2: Aggregation Framework
 
Webinar: How Banks Use MongoDB as a Tick Database
Webinar: How Banks Use MongoDB as a Tick DatabaseWebinar: How Banks Use MongoDB as a Tick Database
Webinar: How Banks Use MongoDB as a Tick Database
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
 
MongoDB Schema Design: Practical Applications and Implications
MongoDB Schema Design: Practical Applications and ImplicationsMongoDB Schema Design: Practical Applications and Implications
MongoDB Schema Design: Practical Applications and Implications
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
 
Mongo scaling
Mongo scalingMongo scaling
Mongo scaling
 
MongoDB Meetup
MongoDB MeetupMongoDB Meetup
MongoDB Meetup
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
 
How ShopperTrak Is Using MongoDB
How ShopperTrak Is Using MongoDBHow ShopperTrak Is Using MongoDB
How ShopperTrak Is Using MongoDB
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
 
Applied Machine learning using H2O, python and R Workshop
Applied Machine learning using H2O, python and R WorkshopApplied Machine learning using H2O, python and R Workshop
Applied Machine learning using H2O, python and R Workshop
 
Simplifying & accelerating application development with MongoDB's intelligent...
Simplifying & accelerating application development with MongoDB's intelligent...Simplifying & accelerating application development with MongoDB's intelligent...
Simplifying & accelerating application development with MongoDB's intelligent...
 
Data Processing and Aggregation with MongoDB
Data Processing and Aggregation with MongoDB Data Processing and Aggregation with MongoDB
Data Processing and Aggregation with MongoDB
 
Streaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comStreaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.com
 
CouchDB introduction
CouchDB introductionCouchDB introduction
CouchDB introduction
 
Bye Bye Legacy: Simplifying the Journey
Bye Bye Legacy: Simplifying the JourneyBye Bye Legacy: Simplifying the Journey
Bye Bye Legacy: Simplifying the Journey
 

More from MongoDB

More from MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Webinar: Position and Trade Management with MongoDB

  • 1. MongoDB in FS Position & Trade Management 27th November 2012 Daniel Roberts
  • 2. Relational Database Challenges Data Types Agile Development • Unstructured data • Iterative • Semi-structured • Short development data cycles • Polymorphic data • New workloads Volume of Data New Architectures • Petabytes of data • Horizontal scaling • Trillions of records • Commodity servers • Tens of millions of queries per second • Cloud computing 2
  • 3. Why MongoDB in FS? • Flexible schemas • Scale Out • Aggregations • High Volume Data Feeds • Agile Development • Tick Data / Time series • Risk Analytics • Product Catalogs & Trade Capture • P&L Reporting • Reference Data Management • Portfolio Management • Quantitative Analysis • Automated Trading 3
  • 4. Agile development RDBMS MongoDB { _id: ObjectId("4c4ba5e5e8aabf3"), "NewOrder-Single" : { "Header" : { "BeginString" : "FIX.4.2", "BodyLength" : 190, "MsgType" : "D", "HeaderFields" : { "SenderCompID" : "Client", "TargetCompID" : "TradingGateway", "MsgSeqNum" : 4, "SendingTime" : { "UTCFormat_2051-100" : "Fri Jun 01 09:36:26 BST 2012” }.... 4
  • 6. Global Replication Primary Secondary Secondary 6
  • 8. Use cases Order Capture Product Catalogs Aggregate / calculate data Trade History Globally replicated reference Time Series data data Aggregation Framework Fast, In-Place Updates 8
  • 9. Product Catalogs Catalogs of complex financial products • ‘Exotics’ difficult to model in relational db. • ‘On-boarding’ new products in hours. • Representation in RDBMS may require >~50 tables. • What’s the impact from technology? • Once created how do we capture the details of a new trade? Why MongoDB? • Flexible schema means we don’t need to go back to the database when we have a product to sell. • Single collection for all products... even if they vary greatly • Trades potentially exist for long periods • Newer trade can have different data with not impact on the db. 9
  • 10. Order Capture { _id: ObjectId("4c4ba5.."), "NewOrder-Single" : { "Header" : { • Capture messages "BeginString" : "FIX.4.2", "BodyLength" : 190, "MsgType" : "D", • Variable formats "HeaderFields" : { "SenderCompID" : "Client", – Eg Fix 4.2 or 5.0 "TargetCompID" : "TradingGateway", "MsgSeqNum" : 4, "SendingTime" : { "UTCFormat_2051-100" : "Fri Jun 01 09:36:26 BST 2012” }.... 10
  • 11. Execution reports { "_id" : ObjectId("5051d573036441c9062d6629"), "ExecutionReport" : { "StandardMessageHeader" : { "BeginString" : "FIX.4.2", "BodyLength" : 265, "MsgType" : "8”, }, "ExecutionReportBody" : { "OrderID" : "OrderID_142201", "ClOrdID" : "20120909-142159-4597031", "Instrument" : {"Symbol" : "MSFT” }, "OrderQtyData" : { "OrderQty" : 100000 }, "OrdTYpe" : "1", "Currency" : "USD", "LastShares" : 50000, "LastPx" : 100.5, "LeavesQty" : 50000, "CumQty" : 50000, "AvgPx" : 100.5, "TransactTime" : { "UTC" : "Sun Sep 09 14:22:01 BST 2012" }, ….. } } 11
  • 12. Aggregation Framework db.ExecutionReport.aggregate( { $match : {"Instrument.Symbol":"MSFT"}, $group : { _id : "$ExecutionReport.ReportBody.ClOrdID", reportsPerOrd : { $sum : 1 }, totalNumOrdered : { $sum : "$ExecutionReport.ReportBody.OrderQtyData.OrderQty"}, avgPrice : { $avg : "$ExecutionReport.ExecutionReportBody.AvgPx" } } }); 12
  • 13. Results { "result" : [ { "_id" : "20120909-142604-3800196", "reportsPerOrd" : 2, "totalNumOrdered" : 200000, "avgPrice" : 100.5 }, { "_id" : "20120909-142603-7560516", "reportsPerOrd" : 2, "totalNumOrdered" : 200000, "avgPrice" : 100.25 } … ], "ok" : 1 } 13
  • 14. Aggregate View of Positions { "account" : 123000234, "instrument" : "MSFT", "quantity" : 10000, "ts" : ISODate("2012-12-25T00:00:00Z"), "buyPrice" : 26.67 } { "account" : 123000234, "instrument" : "MSFT", "quantity" : 4534, "ts" : ISODate("2012-12-27T00:00:00Z"), "buyPrice" : 27.39 } { "account" : 123000234, "instrument" : "MSFT", "quantity" : 4534, "ts" : ISODate("2012-12-20T00:00:00Z"), "buyPrice" : 24.39 } { "account" : 123000234, "instrument" : "GOOG", "quantity" : 8768, "ts" : ISODate("2012-12-25T00:00:00Z"), "buyPrice" : 526.67 } { "account" : 123000234, "instrument" : "GOOG", "quantity" : 324, "ts" : ISODate("2012-12-20T00:00:00Z"), "buyPrice" : 630.59 } 14
  • 15. Calculate P&L – aggregated positions var currentPrice = 656.54; db.pl.aggregate([ {$match:{"instrument" : "GOOG"}}, {$project : {instrument:1, currentValue : { $multiply:["$quantity", currentPrice] }, purchaseValue : { $multiply:["$quantity", "$buyPrice"]}} }, {$group : {_id: "$instrument", currentValue : {$sum : "$currentValue"}, purchaseValue: {$sum : "$purchaseValue"}} }, {$project: {_id: 0, instrument: "$_id", currentValue: 1, purchaseValue: 1, profit : {$subtract : ["$currentValue","$purchaseValue"]}}} ]); 15
  • 16. Results { "result" : [ { "currentValue" : 5969261.68, "purchaseValue" : 4822153.72, "instrument" : "GOOG", "profit" : 1147107.96 } ], "ok" : 1 } 16
  • 17. Trade History • Store historical trades and deltas over time • Maintain all data online.. Eg. 7 years • Recent data maintained hot in ‘Working Set’ 300 GB Working Set 128 GB 128 GB 128 GB RAM RAM RAM 1 TB 1 TB 1 TB Data on Data on Data on Disk Disk Disk Shard 1 Shard 2 Shard 3 17
  • 18. Summary • Product Catalogs • Trade Capture • Handle changes easily over time • Aggregate trades / orders / executions • Calculate P&L across stored positions • Store trade updates and deltas 18
  • 19. For More Information Resource User Data Management Location MongoDB Downloads www.mongodb.org/download Free Online Training education.10gen.com Webinars and Events www.10gen.com/events White Papers www.10gen.com/white-papers Customer Case Studies www.10gen.com/customers Presentations www.10gen.com/presentations Documentation docs.mongodb.org Additional Info info@10gen.com 19