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

Time In Force #23

Merged
merged 16 commits into from Mar 8, 2023
Merged

Time In Force #23

merged 16 commits into from Mar 8, 2023

Conversation

jarry-xiao
Copy link
Contributor

@jarry-xiao jarry-xiao commented Mar 6, 2023

Draft implementation of time-in-force (TIF) orders for Phoenix v1.

Added a standard test in test_market.rs. Could use more coverage

Changes:

  • Uses the padding on the FIFORestingOrder to store and expiration slot and an expiration time
  • Modifies the OrderPacket struct to enable specification of expiration
  • Injects logic into the matching engine to skip orders that are expired

@jarry-xiao jarry-xiao changed the title Initial implementation complete (untested) Time In Force Mar 7, 2023
src/program/processor/new_order.rs Show resolved Hide resolved
src/state/markets/fifo.rs Outdated Show resolved Hide resolved
src/state/markets/fifo.rs Outdated Show resolved Hide resolved
Comment on lines +821 to +822
current_slot,
current_unix_timestamp,
Copy link
Contributor

Choose a reason for hiding this comment

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

weird to sometimes pass around the get_clock_fn and sometimes pass around the values, no?

Copy link
Contributor Author

@jarry-xiao jarry-xiao Mar 7, 2023

Choose a reason for hiding this comment

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

If get_clock_fn were an actual clock (ticking while executing) you really want the snapshot of that clock to be taken at the time of place. That makes passing its outputs into the private function match_order a reasonable decision.

Copy link
Contributor

Choose a reason for hiding this comment

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

ya but it's not, and never will be

src/state/markets/fifo.rs Outdated Show resolved Hide resolved
src/state/markets/fifo.rs Outdated Show resolved Hide resolved
src/state/markets/fifo.rs Outdated Show resolved Hide resolved
src/state/markets/test_market.rs Outdated Show resolved Hide resolved
src/state/order_schema/order_packet.rs Outdated Show resolved Hide resolved
tests/test_phoenix.rs Show resolved Hide resolved
src/program/events.rs Show resolved Hide resolved
#[inline]
/// Quote lot budget with fees adjusted (sells)
///
/// The desired result is adjusted_quote_lots / (1 - fee_bps). We approach this result by taking
Copy link
Contributor

Choose a reason for hiding this comment

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

explain in comment the use case for this one, it's definitely not obvious

src/state/markets/fifo.rs Show resolved Hide resolved
src/state/markets/fifo.rs Show resolved Hide resolved
src/state/markets/fifo.rs Outdated Show resolved Hide resolved
Comment on lines +821 to +822
current_slot,
current_unix_timestamp,
Copy link
Contributor

Choose a reason for hiding this comment

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

ya but it's not, and never will be

src/state/markets/fifo.rs Outdated Show resolved Hide resolved
src/state/markets/fifo.rs Outdated Show resolved Hide resolved
@jarry-xiao jarry-xiao changed the base branch from master to dev March 8, 2023 19:08
@jarry-xiao jarry-xiao merged commit 512030f into dev Mar 8, 2023
jarry-xiao added a commit that referenced this pull request Mar 14, 2023
Time-in-force (TIF) orders for Phoenix v1.

Changes:
- Uses the padding on the FIFORestingOrder to store and expiration slot
and an expiration time
- Modifies the OrderPacket struct to enable specification of expiration
- Injects logic into the matching engine to skip orders that are expired
eugene-chen pushed a commit that referenced this pull request Mar 14, 2023
Time-in-force (TIF) orders for Phoenix v1.

Changes:
- Uses the padding on the FIFORestingOrder to store and expiration slot
and an expiration time
- Modifies the OrderPacket struct to enable specification of expiration
- Injects logic into the matching engine to skip orders that are expired
@jarry-xiao jarry-xiao deleted the phoenix-v1/tif branch May 1, 2023 14:14
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