From 7508478eef93217cfcfbb800c942518d9e3368cf Mon Sep 17 00:00:00 2001 From: sam bacha Date: Fri, 24 May 2024 17:04:58 -0700 Subject: [PATCH] docs(learning): primary market --- .github/workflows/ci.yml | 3 +- docs/Learning/primary-market.md | 50 +++++++++++++++++++++++++++++++++ mkdocs.yml | 6 +--- 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 docs/Learning/primary-market.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d87a385..c91b3de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,5 +11,6 @@ jobs: - uses: streetsidesoftware/cspell-action@v6 with: config: 'cspell.json' - files: '**/*.md' + files: 'docs/**/*.md' incremental_files_only: true + strict: false diff --git a/docs/Learning/primary-market.md b/docs/Learning/primary-market.md new file mode 100644 index 0000000..f377265 --- /dev/null +++ b/docs/Learning/primary-market.md @@ -0,0 +1,50 @@ +--- +title: Primary Market +subtitle: Call Market Reference +--- + + +```mermaid +sequenceDiagram + participant Client as Client + participant DA as Discriminatory Auction COP + participant FB as Flatten Bids + participant SB as Sort Bids + participant PAB as Process Auction Bids + participant HRI as Has Remaining Items + participant AI as Allocate Items + + Client->>DA: Start Auction(num_items, bids) + DA->>FB: flatten_bids(bids) + FB-->>DA: List of (price, quantity, bidder_id) + DA->>SB: sort_bids(all_bids) + SB-->>DA: Sorted list of bids + DA->>PAB: process_auction_bids(sorted_bids, num_items) + loop For Each Bid + PAB->>HRI: has_remaining_items(remaining_items) + HRI-->>PAB: Yes/No + alt If Yes + PAB->>AI: allocate_items(bid, remaining_items) + AI-->>PAB: Allocation result, Updated remaining_items + else If No + PAB-->>DA: Final Allocation + end + end + PAB-->>DA: Final Allocation + DA-->>Client: Auction Results +``` + +Client Starts Auction: The process begins with the client calling the Start Auction method, providing the number of items and the bids. + +Flatten Bids: The Discriminatory Auction (DA) system flattens the structured bids into a list of tuples. +Sort Bids: The flattened bids are then sorted in descending order based on the bid price. +Process Auction Bids: Enters a loop to process each bid in the sorted list. + +Check for Remaining Items: For each bid, it checks if there are remaining items to be auctioned. + If there are no remaining items, the auction process is concluded, and the final allocation is returned. + If there are remaining items, it proceeds to allocate items based on the current bid. +Allocate Items: Items are allocated to the bidder if the conditions are met (i.e., there are enough remaining items to fulfill at least part of the bid). +Loop Continues: This loop continues until all bids are processed or there are no more items to auction + + +Auction Results Returned: Finally, the auction results are compiled and returned to the client. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 49d6059..9d5ca58 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -103,11 +103,6 @@ extra: note: >- Thanks for your feedback! Help us improve this page by using our feedback form. - consent: - actions: - - accept - - reject - - manage cookies: analytics: name: Google Analytics @@ -201,6 +196,7 @@ nav: - Learning: # - Flashbots Comparison: Learning/flashbots-comparison.md - Auction Design: Learning/aup_auction.md + - Primary Market: Learning/primary-market.md - Forward Contracts: Learning/Forward-Contracts.md # Disable Article # - 'Secondary Market': 'Learning/secondary-market.md'