Conversation
77167fe to
2a24716
Compare
|
I think before touching the feature-facing structures we have, we should first tackle No. 1 of #78; its the bare bone to any of those structures and the derived api/models/routines that the features that consume them, use them for its current API.
Hypixel provides no intrinsic identity anyhow to no order/offer (lets call it a What I have in mind is that the BazaarDataManager will hold two Map<ProductId, PriceLevelPool>, one for each side of the book, where we will insert, poll and splice given a ranking of our data sources:
Besides the ranking we give them on a |
We will have a separate list for tracking live user orders, the price level pool is a reconciliation of "where the market is" and each tracked order would be the correctness of where user's order currently is within that pool. |
I agree, though I think this should go into a separate pr
If we could consistently get the user transaction data from screens, we wouldnt even need tolerance, and we could have more accurate prices data. |
d809363 to
baf2ec8
Compare
There was a problem hiding this comment.
Pull request overview
This PR is an internal refactoring of the Bazaar-related data structures. It has two main goals: (1) extract market price caching into a dedicated MarketPrices class (separating it from PriceInfo), and (2) begin the migration from OrderType to TransactionType to better represent whether a transaction is a buy or sell, with two new supporting enums (PriceType moved out of BazaarDataManager, and new MarketType and TransactionType).
Changes:
- New
MarketPricesclass: Extracts themarketBuyPrice/marketSellPricefields and associated logic fromPriceInfo, creating an independent event-subscribing component that caches and auto-updates Bazaar market prices. - New
TransactionType+PriceType+MarketTypeenums: Lays the groundwork for replacingOrderTypewith a clearerTransactionType;PriceTypeis promoted to a top-level class from an inner class ofBazaarDataManager;MarketType(previously nested inInputHelper) is promoted and extended withTransactionType-aware methods. - Consumer refactoring:
OrderInfo,Order,SignInputHelper, andBookmarkSearchWidgetare updated to useMarketPricesinstead of callingupdateMarketPrice()directly, andBookmarknow stores aMarketPricesinstance instead of a plainproductIDstring.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
MarketPrices.java |
New class extracting market price caching from PriceInfo; extends BUListener for automatic updates |
PriceInfo.java |
Removes marketBuyPrice/marketSellPrice fields and related methods now moved to MarketPrices |
TransactionType.java |
New enum for buy/sell intention, intended to replace OrderType |
PriceType.java |
Promoted from inner class of BazaarDataManager to top-level enum |
OrderType.java |
Marked @Deprecated; asPriceType() updated to use standalone PriceType |
MarketType.java |
Promoted from inner class of InputHelper to top-level; adds resolvePriceType(TransactionType) |
OrderInfo.java |
Adds marketPrices field; delegates price lookups to it |
Order.java |
Removes redundant updateMarketPrice() calls; delegates price methods to marketPrices |
BazaarDataManager.java |
Removes PriceType inner class; imports standalone PriceType |
SignInputHelper.java |
Uses MarketPrices instead of PriceInfo for price resolution |
Bookmark.java |
Record now holds MarketPrices instead of String productID |
BookmarkSearchWidget.java |
Uses Bookmark.marketPrices() for price lookups instead of creating OrderInfo |
ToggleBookmarkButton.java |
Creates MarketPrices instance when adding a bookmark |
*AmountHelper.java / *PriceHelper.java |
Import updates to use standalone MarketType and MarketPrices |
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/SignInputHelper.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/market/price/MarketPrices.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/features/gui/buttons/bookmarks/Bookmark.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/market/order/TransactionType.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/market/order/MarketType.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/SignInputHelper.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/market/order/PriceType.java
Outdated
Show resolved
Hide resolved
...java/com/github/mkram17/bazaarutils/features/gui/buttons/bookmarks/BookmarkSearchWidget.java
Outdated
Show resolved
Hide resolved
...java/com/github/mkram17/bazaarutils/features/gui/buttons/bookmarks/BookmarkSearchWidget.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/features/gui/buttons/bookmarks/Bookmark.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/market/order/TransactionType2.java
Outdated
Show resolved
Hide resolved
...java/com/github/mkram17/bazaarutils/features/gui/buttons/bookmarks/BookmarkSearchWidget.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/features/gui/buttons/bookmarks/Bookmark.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/BUCommands.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/market/order/OrderUtil.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/market/price/PriceInfo.java
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/market/order/OrderUtil.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/events/handler/ChatHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/mkram17/bazaarutils/utils/bazaar/data/BazaarDataManager.java
Show resolved
Hide resolved
|
@0xar-ds what do you think about the two potential impls of TransactionType? I did one 37778a2 and one here f31189b . Still need to rebase but you get the gist of the refactors. I personally prefer the second option because it is much easier to read and imo handles backend using PriceType better, but the first option is possible as well. Lmk if you have any other ideas. |
e849e93 to
830a9fc
Compare
| int priceIndex = TextSearch.indexOf(siblings, "for") + 1; | ||
|
|
||
| processOrderEvent(siblings, BazaarChatEvent.BazaarEventTypes.INSTA_SELL, OrderType.BUY, 2, 4, priceIndex); | ||
| processOrderEvent(siblings, BazaarChatEvent.BazaarEventTypes.INSTA_SELL, TransactionType.of(TransactionType.Side.SELL, TransactionType.Method.INSTANT), 2, 4, priceIndex); |
There was a problem hiding this comment.
Cancellation isnt any type of current transaction. Should we add it to TransactionType?
in favor of TransactionType.Side and TransactionType.Method
1784aba to
33f9a9b
Compare
Use TransactionType(Side, Method) which resolves to a PriceType instead of an OrderType or sometimes PriceType and MarketType combo
Instead of using PriceInfo to store and query market prices, directly query utility classes