testing out bid based market value

This commit is contained in:
Manuel Simon Hirsig
2016-02-07 15:10:44 +01:00
parent 61efe10681
commit fae940cf9c
4 changed files with 26 additions and 8 deletions
+1 -1
View File
@@ -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
+20
View File
@@ -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
+3 -5
View File
@@ -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 }
+2 -2
View File
@@ -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