Skip to content

Commit

Permalink
add liquidity provider agent
Browse files Browse the repository at this point in the history
  • Loading branch information
kinrezC committed Oct 10, 2023
1 parent a57c317 commit 723f192
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Empty file.
9 changes: 8 additions & 1 deletion box-simulation/src/agents/rebalancer.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use box_core::math::ComputeReturns;
use ethers::utils::format_ether;
use std::ops::Div;
use std::sync::Arc;

use super::*;

pub struct Rebalancer {
pub client: Arc<RevmMiddleware>,
pub lex: LiquidExchange<RevmMiddleware>,
pub g3m: G3M<RevmMiddleware>,
pub next_update_timestamp: u64,
Expand All @@ -28,6 +30,7 @@ impl Rebalancer {
let g3m = G3M::new(exchange_address, client.clone());

Ok(Self {
client,
lex,
g3m,
target_volatility,
Expand Down Expand Up @@ -67,7 +70,7 @@ impl Rebalancer {
Ok(())
}

pub fn calculate_rv(&mut self) -> Result<()> {
fn calculate_rv(&mut self) -> Result<()> {
// if self.asset_prices.len() > 15 then only calcualte for the last 15 elements
if self.asset_prices.len() > 15 {
let asset_rv = self
Expand Down Expand Up @@ -112,4 +115,8 @@ impl Rebalancer {

Ok(())
}

fn execute_smooth_rebalance(&mut self) -> Result<()> {
Ok(())
}
}

0 comments on commit 723f192

Please sign in to comment.