File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212- program: add new settle pnl invariants ([ #1812 ] ( https://github.com/drift-labs/protocol-v2/pull/1812 ) )
1313- program: add update_perp_market_pnl_pool ([ #1810 ] ( https://github.com/drift-labs/protocol-v2/pull/1810 ) )
14+ - program: update mark twap crank use 5min basis for bid/ask ([ #1769 ] ( https://github.com/drift-labs/protocol-v2/pull/1769 ) )
1415
1516### Fixes
1617
Original file line number Diff line number Diff line change @@ -125,7 +125,13 @@ pub fn update_mark_twap_crank(
125125
126126 // handle crossing bid/ask
127127 if best_bid_price > best_ask_price {
128- if best_bid_price >= oracle_price_data. price . cast ( ) ? {
128+ let market_basis = amm
129+ . last_mark_price_twap_5min
130+ . cast :: < i64 > ( ) ?
131+ . safe_sub ( amm. historical_oracle_data . last_oracle_price_twap_5min ) ?
132+ . clamp ( -oracle_price_data. price /100 , oracle_price_data. price /100 ) ;
133+
134+ if best_bid_price >= oracle_price_data. price . safe_add ( market_basis) ?. cast ( ) ? {
129135 best_bid_price = best_ask_price;
130136 } else {
131137 best_ask_price = best_bid_price;
You can’t perform that action at this time.
0 commit comments