https://github.com/primitivefinance/m3-rs
Simple rust interface to get derived analytical information of algorithmic market making models (M3).
https://github.com/primitivefinance/m3-rs
Last synced: 11 months ago
JSON representation
Simple rust interface to get derived analytical information of algorithmic market making models (M3).
- Host: GitHub
- URL: https://github.com/primitivefinance/m3-rs
- Owner: primitivefinance
- Created: 2023-07-10T22:28:22.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-21T16:00:11.000Z (almost 3 years ago)
- Last Synced: 2025-04-05T14:02:57.722Z (about 1 year ago)
- Language: Rust
- Homepage:
- Size: 38.1 KB
- Stars: 12
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# M3-rs
Constant function market makers are a class of automated market making strategies implemented via smart contracts on blockchain networks like Ethereum.
M3-rs is a Rust interface for interacting with these models and their properties, such as the amount of assets that can be sold at a price.
# Install
```
Add to Cargo.toml:
m3-rs = { git = "https://github.com/primitivefinance/m3-rs" }
```
# Usage
```rust
use m3_rs::{...};
fn main() {
// Create a base model
let mut base = BaseModel::new(
"base_model_name".to_string(),
"base_model_version".to_string(),
"base_model_code".to_string(),
"base_model_id".to_string(),
);
// Set it's objective, i.e. the model.
base.set_objective(Box::new(RMM01 {
strike: 1_f64,
volatility: 1_f64,
time_to_maturity: 1.0,
}))
// Use the functions in plot.rs to plot different derived data using these models.
}
```