Skip to content

Commit

Permalink
jit: add post only slide
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Jan 15, 2024
1 parent 4e1e580 commit 6ca2a7b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion programs/jit-proxy/src/instructions/arb_perp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use drift::math::casting::Cast;
use drift::math::constants::{BASE_PRECISION, MARGIN_PRECISION_U128, QUOTE_PRECISION};
use drift::math::margin::MarginRequirementType;
use drift::program::Drift;
use drift::state::perp_market_map::MarketSet;
use drift::state::order_params::{OrderParams, PostOnlyParam};
use drift::state::perp_market_map::MarketSet;
use std::ops::Deref;

use drift::math::orders::find_bids_and_asks_from_users;
Expand Down
2 changes: 1 addition & 1 deletion programs/jit-proxy/src/instructions/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub fn jit<'info>(ctx: Context<'_, '_, '_, 'info, Jit<'info>>, params: JitParams
reduce_only: false,
post_only: params
.post_only
.unwrap_or(PostOnlyParam::MustPostOnly)
.unwrap_or(PostOnlyParam::Slide)
.to_drift_param(),
immediate_or_cancel: true,
max_ts: None,
Expand Down
2 changes: 2 additions & 0 deletions programs/jit-proxy/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub enum PostOnlyParam {
None,
MustPostOnly, // Tx fails if order can't be post only
TryPostOnly, // Tx succeeds and order not placed if can't be post only
Slide, // Modify price to be post only if can't be post only
}

impl PostOnlyParam {
Expand All @@ -16,6 +17,7 @@ impl PostOnlyParam {
PostOnlyParam::None => DriftPostOnlyParam::None,
PostOnlyParam::MustPostOnly => DriftPostOnlyParam::MustPostOnly,
PostOnlyParam::TryPostOnly => DriftPostOnlyParam::TryPostOnly,
PostOnlyParam::Slide => DriftPostOnlyParam::Slide,
}
}
}
Expand Down

0 comments on commit 6ca2a7b

Please sign in to comment.