Skip to content

Commit

Permalink
liquidator: rebalance with openbook (limit order) (#938)
Browse files Browse the repository at this point in the history
liquidator: rebalance with limit order
  • Loading branch information
farnyser committed Aug 9, 2024
1 parent ec3d54c commit e04ce1c
Show file tree
Hide file tree
Showing 4 changed files with 362 additions and 61 deletions.
7 changes: 7 additions & 0 deletions bin/liquidator/src/cli_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ pub struct Cli {
#[clap(long, env, default_value = "30")]
pub(crate) rebalance_refresh_timeout_secs: u64,

#[clap(long, env, value_enum, default_value = "false")]
pub(crate) rebalance_using_limit_order: BoolArg,

/// distance (in bps) from oracle price at which to place order for rebalancing
#[clap(long, env, default_value = "100")]
pub(crate) rebalance_limit_order_distance_from_oracle_price_bps: u64,

/// if taking tcs orders is enabled
///
/// typically only disabled for tests where swaps are unavailable
Expand Down
3 changes: 3 additions & 0 deletions bin/liquidator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ async fn main() -> anyhow::Result<()> {
.unwrap_or_default(),
use_sanctum: cli.sanctum_enabled == BoolArg::True,
allow_withdraws: true,
use_limit_order: cli.rebalance_using_limit_order == BoolArg::True,
limit_order_distance_from_oracle_price_bps: cli
.rebalance_limit_order_distance_from_oracle_price_bps,
};
rebalance_config.validate(&mango_client.context);

Expand Down
Loading

0 comments on commit e04ce1c

Please sign in to comment.