avhz / rustquant Goto Github PK
View Code? Open in Web Editor NEWRust library for quantitative finance.
Home Page: https://docs.rs/RustQuant
License: Apache License 2.0
Rust library for quantitative finance.
Home Page: https://docs.rs/RustQuant
License: Apache License 2.0
Caps/floors are a series of caplets/floorlets (basically call/put options) on something like an interest rate or inflation rate.
Pricing is discussed in detail in Interest Rate Models by Brigo and Mercurio.
The diagonal matrix W
becomes singular (non-invertible) since the entries converge to zero.
All pricing models should be able to be calibrated to market prices.
A nice Crate called argmin
available here looks like it can achieve this, using Brent method or something similar.
Can also perform calibration using RustQuant::autodiff
possibly ?
This requires the ability to read in price data from .csv or .json, for example. See related issue #23
See here: plotters-rs/plotters#453
Compile time increased quite substantially after adding Polars as a dependency.
Should look into reducing the compile time a bit if possible.
In autodiff::Variable
, creating Python bindings is currently not possible due to #[pyclass]
not being compatible on structs that have lifetime annotations, since Rust can no longer keep track of the references.
What I have:
/// Struct to contain the initial variables.
#[derive(Clone, Copy, Debug)]
pub struct Variable<'v> {
/// Pointer to the tape.
pub tape: &'v Tape,
/// Index to the node.
pub index: usize,
/// Value associated to the node.
pub value: f64,
}
What I wanted:
use pyo3::prelude::*;
/// Struct to contain the initial variables.
#[derive(Clone, Copy, Debug)]
#[pyclass] // <- This
pub struct Variable<'v> {
/// Pointer to the tape.
pub tape: &'v Tape,
/// Index to the node.
pub index: usize,
/// Value associated to the node.
pub value: f64,
}
I possibly need to change the Variable
implementation such that it no longer uses explicit lifetime annotations. Open to suggestions.
With the current implementation of bonds, the user is required to initialize the struct with predefined maturity
and price-at-time t
.
From the little research I've done it seems that closed-form zero coupon bond pricing formulae allow for computation at arbitrary maturation T
and times t
(so long as T >= t
).
So the current trait ZeroCouponBond
is a little inflexible. How about computing the price via ZeroCouponBond::price(&self, t: f64, T: f64)
, where t
is the time the user wants to compute the price at and T
is the maturation?
Binomial option pricer has it. Possibly elsewhere ?
Lint defined in lib.rs applies to whole library.
So any additional #![deny(missing_docs)] are superfluous.
Example error:
---- stochastics::cox_ingersoll_ross::tests::test_cox_ingersoll_ross stdout ----
thread 'stochastics::cox_ingersoll_ross::tests::test_cox_ingersoll_ross' panicked at 'misaligned pointer dereference: address must be a multiple of 0x8 but is 0x7f9c19cec269'
I am writing my master thesis currently so I have been lazy and not made use of Rust's Result
and Option
enums like I should have.
Need to write doc-tests for the remaining distributions:
It seems like a tedious task to maintain two separate libraries, one for "base" RustQuant and a separate one for the Python bindings.
Is there a better way?
I don't want to litter the base library with things like #[pyclass]
, #[new]
and #[pymethods
, but keeping two separate copies seems unnecessary.
Just generally improve the documentation, especially when it comes to explaining mathematical aspects of the library such that it is as user-friendly as possible.
Want to be able to download:
Store as a Polars DataFrame
.
Hi @avhz
i have started to develop a stochastic library in rust too. If you approve I can migrate my code and processes into your library, because I dont want to make a totally different like this. It would be great if the community has one strong and featuredull quant and stochastic analysis library in rust.
---- options::lookback::tests::test_lookback_floating stdout ----
thread 'options::lookback::tests::test_lookback_floating' panicked at '
Left: 18.11050747911399,
Right: 25.35335527250393,
Delta: 0.5
', src/options/lookback.rs:273:9
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
Such as:
if CallPutFlag == "c" {
z = 1;
} else if CallPutFlag == "p" {
z = -1;
} else {
panic!("Check call/put flag. Should be either 'c' or 'p'.");
}
Enum is more ergonomic; the error will be spotted at compile time, and not cause a panic at run time when an incorrect &str is passed as an argument.
Interpolator
s to-do list:
I would like a way for users to be able to store and retrieve data from performing various actions in RustQuant, like pricing etc.
At present, the implementations of StochasticProcess::drift()
and StochasticProcess::diffusion()
do not allow for implementation of models such as Ho-Lee and Hull-White which have time-varying parameters. I propose changing their signatures to accept another parameter t: f64
for the point in time to compute the drift/diffusion.
Additionally this would mean changing the implementation of the euler_murayama()
function slightly. I can PR all of these changes and change the existing stochastics
implementations if approved.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.