From fae940cf9c89ca986aff7ce306c60a5b36a7b3ca Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Sun, 7 Feb 2016 15:10:44 +0100 Subject: [PATCH] testing out bid based market value --- Aux-AddOn.toc | 2 +- history.lua | 20 ++++++++++++++++++++ scan.lua | 8 +++----- scan_util.lua | 4 ++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Aux-AddOn.toc b/Aux-AddOn.toc index e1747ac..684516a 100644 --- a/Aux-AddOn.toc +++ b/Aux-AddOn.toc @@ -2,7 +2,7 @@ ## Title: Aux ## Notes: A lightweight addon designed to help manage auctions ## SavedVariablesPerCharacter: aux_recent_searches, aux_favorite_searches, aux_price_per_unit, aux_scale -## SavedVariables: aux_database, aux_auctionable_items +## SavedVariables: aux_database, aux_auctionable_items, aux_max_bids slash.lua core.xml diff --git a/history.lua b/history.lua index 8a8a79c..d2fd45e 100644 --- a/history.lua +++ b/history.lua @@ -19,6 +19,11 @@ function private.read_record(item_key) last_daily_values = Aux.util.map(Aux.persistence.deserialize(record[3], ';'), function(value) return tonumber(value) end), + -- auction count + -- latest_buyout_dailies + -- latest_bid_dailies + -- current_day_max_bid + -- current_day_buyout_histogram histogram = Aux.util.map(Aux.persistence.deserialize(record[4], ';', 'x'), function(value) return tonumber(value) end), @@ -37,6 +42,21 @@ end function public.process_auction(auction_info) + -- experimental + local unit_high_bid = auction_info.high_bid/auction_info.aux_quantity + aux_max_bids[auction_info.item_key] = max(aux_max_bids[auction_info.item_key] or 0, unit_high_bid) + if aux_max_bids[auction_info.item_key] > 0 then + snipe.log(auction_info.hyperlink..': '..Aux.money.to_string(aux_max_bids[auction_info.item_key])) + end + -- experimental + + local snapshot = Aux.persistence.load_snapshot() + if not snapshot.contains(auction_info.signature) then + return + end + snapshot.add(auction_info.signature, auction_info.duration) + + if auction_info.buyout_price == 0 then return end diff --git a/scan.lua b/scan.lua index c54324c..0db4ffb 100644 --- a/scan.lua +++ b/scan.lua @@ -1,6 +1,8 @@ local private , public = {}, {} Aux.scan = public +aux_max_bids = {} + local PAGE_SIZE = 50 local controller = (function() @@ -186,11 +188,7 @@ function scan_auctions_helper(i, n, k) auction_info.page = state.page auction_info.query = current_query() - local snapshot = Aux.persistence.load_snapshot() - if not snapshot.contains(auction_info.signature) then - snapshot.add(auction_info.signature, auction_info.duration) - Aux.history.process_auction(auction_info) - end + Aux.history.process_auction(auction_info) if not current_query().validator or current_query().validator(auction_info) then return wait_for_callback{state.params.on_read_auction or Aux.util.pass, auction_info, recurse } diff --git a/scan_util.lua b/scan_util.lua index 1c6f695..29843c6 100644 --- a/scan_util.lua +++ b/scan_util.lua @@ -292,8 +292,8 @@ function m.validator(filter) return end if filter.max_percent and (record.unit_buyout_price == 0 - or not Aux.history.market_value(record.item_key) - or record.unit_buyout_price / Aux.history.market_value(record.item_key) * 100 > filter.max_percent) + or not aux_max_bids + or record.unit_buyout_price / aux_max_bids[record.item_key] * 100 > filter.max_percent) then return end