Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigz/make-auction-start-baseline-more-passive #890

Merged
merged 6 commits into from
Feb 20, 2024

Conversation

0xbigz
Copy link
Member

@0xbigz 0xbigz commented Feb 17, 2024

No description provided.

perp_market.amm.last_bid_price_twap.cast::<i64>()? / price_divisor
}
PositionDirection::Short => {
-(perp_market.amm.last_ask_price_twap.cast::<i64>()? / price_divisor)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should short start above oracle, why is this negative?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is only when *_twap_ts has more than 60 second mismatch (cant be trusted to enforce optimistic starts), so the boundary is not strict at all


return Ok(match direction {
PositionDirection::Long => {
perp_market.amm.last_bid_price_twap.cast::<i64>()? / price_divisor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be good to add comment that it's starting at bid (beneath oracle) intentionally to get a good price?

@@ -402,31 +429,27 @@ impl OrderParams {
.last_oracle_price_twap_5min,
)?;

let frac_of_long_spread_in_price: i64 = perp_market
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can save some compute by doing the calculation in the match blocks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i need both of them for both though

for the slow, i pushing it up slightly from the opposite side of the book
for the fast, im pulling it away from the mid

}
PositionDirection::Long => baseline_start_price_offset_slow
.safe_add(frac_of_long_spread_in_price)?
.min(baseline_start_price_offset_fast.safe_sub(frac_of_short_spread_in_price)?),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so before we were doing max, which gives the more aggressive, now we're doing min, which is less aggresswive?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct, doing min for long is less aggressive

Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Merging #890 (7add9ec) into master (dc9dfdb) will increase coverage by 0.03%.
Report is 7 commits behind head on master.
The diff coverage is 79.23%.

❗ Current head 7add9ec differs from pull request most recent head 1afa87b. Consider uploading reports for the commit 1afa87b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #890      +/-   ##
==========================================
+ Coverage   74.76%   74.80%   +0.03%     
==========================================
  Files         130      130              
  Lines       30966    31046      +80     
==========================================
+ Hits        23151    23223      +72     
- Misses       7815     7823       +8     
Components Coverage Δ
drift 74.99% <79.23%> (+0.03%) ⬆️

@crispheaney crispheaney merged commit 5f707e8 into master Feb 20, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants