/trusted

trading system

Primary LanguageRust

tRusted

Risk and Trading Engine

Overview

This Rust project consists of two main components:

  1. quantlib - A library for quantitative finance computations. For now, only plain products can be priced. Development for pricing structured products is ongoing. see engine_example.rs for quantlib example.
  2. trading-engine - (under development) A library for simulating trading activities and order management.

Crate structure

quantlib

Module Description
data Raw market observations, which are not directly used for calculation.
Data is shared by Engine object in multi-thread environment
parameters Objects generated from data objects for actual calculation
instruments ex) Futures, FxFutures, FxForward, FxSwap, VanillaOption, IRS, CCS, Bond, KtbFutures
time Calendars, conventions, handling holiday
pricing_engines Engine, EngineGenerator, and Pricer
Struct & Enum Description
CalculationConfiguration All information for pricing: delta bump ratio, gap days for theta calculation, etc
Pricer Enum containing pricers for each Instrument
Engine An Engine takes data as Arc objects and creates parameters such as ZeroCurve, DiscreteRatioDividend, etc. The parameters, as Rc<RefCell<..>> objects, are shared only inside the Engine. Then the Engine excutes Pricers repeatedly for calculating risks, e.g., delta, gamma, theta, rho, etc
CalculationResult price, greeks, cashflows
EngineGenerator EngineGnerator groups instruments according to InstrumentCategory, then Engines are created for each group of instruments. The purpose of separation is mmainly for compuation performance. This is especially useful for Monte-Carlo simulation (not yet developed) since the most of the computation cost in MC simulation is caused by path generation.
---
title: quantlib structure
---
stateDiagram-v2
    EngineGenerator --> InstrumentCategory: instruments
    InstrumentCategory --> Engine1: inst group1
    InstrumentCategory --> Engine2: inst group2
    EngineGenerator --> Engine1: data & config
    EngineGenerator --> Engine2: data & config
    Engine1 --> CalculationResult: results
    Engine2 --> CalculationResult: results
    Engine1 --> Parameters: data for inst group 1
    Parameters --> Pricer1
    Parameters --> Pricer2
Loading