Released: A Julia library for Clarus Microservices

  • A Julia library has been developed and released to support Clarus Microservices.
  • The library provides convenient access to Clarus Microservices.
  • Source code is available on GitHub.

In a previous blog, ‘Microservices: Swap Equivalents in Julia’ we showed that it was possible to call the Clarus API from Julia. We have generalised the code example in that blog and developed a dedicated library in Julia to provide slick and convenient access to our API from Julia. Its design and structure mirrors our Python library.

What is Julia?

Julia is a new computing language delivering near the performance of C whilst having the ease of development of Python or Matlab. One of the motivations to develop the language was to help avoid the dual language approach whereby developers would develop solutions initially in Python and later rewrite sections in C to eliminate performance bottlenecks. It has gained some interest in finance, see for example the New York Fed’s DSGE model implementation and an article in Wilmott concerning Automatic Differentiation in Julia.

How to install?

Let us assume you have Julia installed, and in particular the latest version, version 0.6.

Pkg.add("Clarus")

That’s it. Let’s go!

An example

In the previous blog post ‘Microservices: Swap Equivalents in Julia’ we computed the hedge equivalents of an 11y par swap. Let’s see the same example using the library.

import Clarus

myTrade = "USD 11Y 100m payer"
myPillars = "2Y,3Y,4Y,5Y,6Y,7Y,8Y,9Y,10Y,12Y,15Y,20Y,25Y,30Y"
print( Clarus.Hedge.equivalents(portfolios=myTrade, tenors=myPillars, basis="false") )

Producing the following output.

15×2 DataFrames.DataFrame
│ Row │ SwapEquivalents in USD (MM) │ USD │
├─────┼─────────────────────────────┼─────┤
│ 1   │ "2Y"                        │ 0   │
│ 2   │ "3Y"                        │ 0   │
│ 3   │ "4Y"                        │ 0   │
│ 4   │ "5Y"                        │ 0   │
│ 5   │ "6Y"                        │ 0   │
│ 6   │ "7Y"                        │ 0   │
│ 7   │ "8Y"                        │ 0   │
│ 8   │ "9Y"                        │ 0   │
│ 9   │ "10Y"                       │ 49  │
│ 10  │ "12Y"                       │ 51  │
│ 11  │ "15Y"                       │ 0   │
│ 12  │ "20Y"                       │ 0   │
│ 13  │ "25Y"                       │ 0   │
│ 14  │ "30Y"                       │ 0   │
│ 15  │ "Total"                     │ 100 │

Source Code

The source code is available on GitHub at github.com/ClarusFinancialTechnology/Clarus.jl. It is clear from the history that I did not write much of the library, the bulk of the library was written by my new colleague Liam, (thanks Liam!). It is licensed under the MIT “Expat” License.

Stay informed with our FREE newsletter, subscribe here.