Code Monkey home page Code Monkey logo

mkipnis / ql_rest Goto Github PK

View Code? Open in Web Editor NEW
20.0 1.0 5.0 1.46 MB

REST API for QuantLib. This project aims to simplify the development of microservices for risk management and pricing of various financial instruments in the distributed environment using QuantLib

Home Page: https://ustreasuries.online

Makefile 7.01% Shell 66.99% M4 0.18% Python 6.44% C++ 19.38%
quantlib rest rest-api restful restful-api options quantitative-finance bonds reactjs swaps

ql_rest's Introduction

ql_rest

ql_rest is an experimental RESTful interface for QuantLib. This project aims to simplify the development of microservices for risk management and pricing various of financial instruments in the distributed environment in real-time.

ql_rest package includes conversion classes between JSON and QuantLibAddin/C++, Python classes to simplify serialization of JSON Objects to QuantLibAddin/C++, and Examples.

Python

class qlVanillaSwap(JSONEncoder):

    def __init__(self):
        
        self.ObjectId = "";
        self.PayerReceiver = "";
        self.Nominal = 0.0;
        self.FixSchedule = "";
        self.FixedRate = 0.0;
        self.FixDayCounter = "";
        self.FloatingLegSchedule = "";
        self.IborIndex = "";
        self.Spread = 0.0;
        self.FloatingLegDayCounter = "";
        self.PaymentConvention = "";
        self.Permanent = False;
        self.Trigger = False;
        self.Overwrite = False;

    def default(self, o):
        return o.__dict__

C++

std::string vanillaswap::qlVanillaSwap(ptree const& pt)
{
    return QuantLibAddinCpp::qlVanillaSwap(
              pt.get<std::string>("ObjectId"),
              pt.get<std::string>("PayerReceiver"),
              pt.get<double>("Nominal"),
              pt.get<std::string>("FixSchedule"),
              pt.get<double>("FixedRate"),
              pt.get<std::string>("FixDayCounter"),
              pt.get<std::string>("FloatingLegSchedule"),
              pt.get<std::string>("IborIndex"),
              pt.get<double>("Spread"),
              pt.get<std::string>("FloatingLegDayCounter"),
              pt.get<std::string>("PaymentConvention"),
              pt.get<bool>("Permanent"),
              pt.get<bool>("Trigger"),
              pt.get<bool>("Overwrite")
    );
}

Dependencies

Project Version
Boost/Beast 1.80
QuantLib 1.22
ObjectHandler/GenSrc/QuantLibAddinCpp 1.22

Basic Microservice

Basic Microservice is a set of helper classes designed to simplify the construction of basic micro-services. It includes a socket listener class, Quantlib pricing thread management class, and a producer-consumer queue to facilitate the communication between the socket session class and the pricing thread.

Data Flow

  • The client connects to a microservice, submits a request via HTTP post, and receives back a token from the server(microservice).
  • The server pushes request to the producer-consumer queue for the pricing thread to process.
  • After some time, client connects to the server to check the status of the request by providing a specified in step-one token.
  • If a request is still in pending, the client must repeat the step number there, until the request is processed by the pricing thread.

N|Solid

Examples

Python client posts market data and instrument term structures to two calculators. Calculators build a discount curve from the provided market data, price bonds, and make results available for client to retrieve. After 3 seconds, the client queries calculators by posting provided in step one token.

N|Solid

ReactJS client publishes market data and term structures to a calculator and display results

N|Solid

ReactJS front-end retrieves market data from the django server and posts results to a calculator through the same server that serves as a proxy.

N|Solid

ql_rest's People

Contributors

mkipnis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.