Side: Make inversion function be associated
This commit is contained in:
parent
8e608ac606
commit
6505abcd54
|
@ -492,7 +492,7 @@ impl MangoAccount {
|
|||
.0;
|
||||
// pa.settle_funding(cache);
|
||||
|
||||
let side = invert_side(fill.taker_side);
|
||||
let side = fill.taker_side.invert_side();
|
||||
let (base_change, quote_change) = fill.base_quote_change(side);
|
||||
pa.change_base_position(perp_market, base_change);
|
||||
let quote = I80F48::from_num(
|
||||
|
|
|
@ -54,10 +54,11 @@ pub enum Side {
|
|||
Ask = 1,
|
||||
}
|
||||
|
||||
pub fn invert_side(side: Side) -> Side {
|
||||
if side == Side::Bid {
|
||||
Side::Ask
|
||||
} else {
|
||||
Side::Bid
|
||||
impl Side {
|
||||
pub fn invert_side(self: &Side) -> Side {
|
||||
match self {
|
||||
Side::Bid => Side::Ask,
|
||||
Side::Ask => Side::Bid,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue