As we roll out JuliaPro v0.6.0.1 (now supporting Julia 0.6), we see it as the best time to introduce our old users and new to our product JuliaFin, and also briefly introduce the enhanced suite of Julia packages it is now shipped with.
JuliaFin is a specialized Julia Computing product used in asset management, risk management, algorithmic trading, backtesting, and many other areas of computational finance, including the modelling of financial contracts.
Miletus.jl
Miletus is one of the core components of JuliaFin. Essentially a Domain Specific Language written on top of Julia, it can be used for financial contract definition and modelling. It is also used as a valuation framework.
Financial contracts are typically modelled in a functional programming style with languages like Haskell or OCaml, and the implementation of the valuation processes is then done in a second language like C++ or Java. Miletus on the other hand, leverages on Julia’s strong type system and multiple dispatch capabilities to both express these contract primitive constructs and generate efficient valuation code, solving yet another “two language problem”.
Milteus lets you construct complex contracts with a combination of simple primitive components and operations.
Example Contract Definition and Valuation
In the example below, we define and value a contract for a European call option, defined both in terms of a set of primitive contract types, as well as convenient, high-level constructors.
The first step would be to import the Miletus library.
# Import the library
In[1]: using Miletus
import Miletus: When, Give, Receive, Buy, Both, At, Either, Zero
The type constructors provided by Miletus lets you perform a few basic operations.
# Receive an amount of 100 USD
In[2]: x=Receive(100USD)
Out[2]: Amount
└─100USD
# Pay is the opposite of Receive
In[3]: x=Pay(100USD)
Out[3]: Give
└─Amount
└─100USD
# Models are constructed and valued on a generic SingleStock type
In[4]: s=SingleStock()
Out[4]: SingleStock
This is where it really gets interesting. These basic primitives can now be combined into higher level operations.
# Acquisition of a stock by paying 100USD
In[5]: x=Both(s, Pay(100USD))
Out[5]: Both
├─SingleStock
└─Give
└─Amount
└─100USD
# Which is equivalent to buying the stock
In[6]: x=Buy(s, 100USD)
Out[6]: Both
├─SingleStock
└─Give
└─Amount
└─100USD
# The notion of optionality is expressed by a choice of two outcomes
In[7]: x=Either(s, Zero())
Out[7]: Either
├─SingleStock
└─Zero
Another important aspect of any contract is the notion of time. Below we define a temporal condition on which to receive a payment of 100USD.
In[8]: x=When(At(Date("2017-12-25")), Receive(100USD))
Out[8]: When
├─{==}
│ ├─DateObs
│ └─2017-12-25
└─Amount
└─100USD
Combining that temporal condition with optionality defines a basic European Call option.
In[9]: x=When(At(Date("2017-12-25")), Either(Buy(s, 100USD), Zero()))
Out[9]: When
├─{==}
│ ├─DateObs
│ └─2017-12-25
└─Either
├─Both
│ ├─SingleStock
│ └─Give
│ └─Amount
│ └─100USD
└─Zero
In[10]: eucall = EuropeanCall(Date("2017-12-25"), SingleStock(), 100USD)
Out[10]: When
├─{==}
│ ├─DateObs
│ └─2017-12-25
└─Either
├─Both
│ ├─SingleStock
│ └─Give
│ └─Amount
│ └─100USD
└─Zero
And that would just be the beginning of the things you can do with Miletus. Read the documentation for more, and if we really did get you started, try it out for yourself!
About Julia Computing and Julia
Julia Computing was founded in 2015 by the co-creators of the Julia language to provide support to businesses and researchers who use Julia.
Julia is the fastest modern high performance open source computing language for data and analytics. It combines the functionality and ease of use of Python, R, Matlab, SAS and Stata with the speed of Java and C++. Julia delivers dramatic improvements in simplicity, speed, scalability, capacity and productivity. Julia provides parallel computing capabilities out of the box and literally infinite scalability with minimal effort. With more than 1 million downloads and +161% annual growth, Julia adoption is growing rapidly in finance, energy, robotics, genomics and many other fields.