Skip to content

Commit

Permalink
docs(learning): primary market
Browse files Browse the repository at this point in the history
  • Loading branch information
sambacha committed May 25, 2024
1 parent 3a4276e commit 7508478
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
50 changes: 50 additions & 0 deletions docs/Learning/primary-market.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 1 addition & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ extra:
note: >-
Thanks for your feedback! Help us improve this page by
using our <a href="..." target="_blank" rel="noopener">feedback form</a>.
consent:
actions:
- accept
- reject
- manage
cookies:
analytics:
name: Google Analytics
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 7508478

Please sign in to comment.