some history bugfixes

This commit is contained in:
Manuel Simon Hirsig
2016-02-09 23:27:33 +01:00
parent 3b2283f045
commit 18c8afb550
2 changed files with 4 additions and 18 deletions
+3 -17
View File
@@ -1,8 +1,6 @@
local private, public = {}, {}
Aux.history = public
aux_conservative_value = false
private.PUSH_INTERVAL = 57600
function private.new_record()
@@ -82,16 +80,6 @@ function public.price_data(item_key)
return item_record.daily_max_bid, item_record.daily_min_buyout, item_record.daily_max_buyout, item_record.market_values, item_record.max_bids
end
function public.conservative_value(item_key)
local item_record = private.read_record(item_key)
if getn(item_record.max_bids) > 0 then
return private.median(item_record.max_bids)
else
return item_record.daily_max_bid
end
end
function public.value(item_key)
if aux_conservative_history then
return private.conservative_historical_value(item_key)
@@ -106,7 +94,7 @@ function private.historical_value(item_key)
if getn(item_record.market_values) > 0 then
return private.median(item_record.market_values)
else
return private.market_value(item_key)
return private.market_value(item_record)
end
end
@@ -120,9 +108,7 @@ function private.conservative_historical_value(item_key)
end
end
function private.market_value(item_key)
local item_record = private.read_record(item_key)
function private.market_value(item_record)
local estimate
if item_record.daily_min_buyout and item_record.daily_max_bid then
@@ -156,7 +142,7 @@ function private.median(list)
end
function private.push_record(item_record)
local market_value = private.market_value(item_key)
local market_value = private.market_value(item_record)
if market_value then
tinsert(item_record.market_values, market_value)
while getn(item_record.market_values) > 11 do
+1 -1
View File
@@ -293,7 +293,7 @@ function m.validator(filter)
end
if filter.max_percent and (record.unit_buyout_price == 0
or not Aux.history.value(record.item_key)
or record.unit_buyout_price / Aux.history.conservative_value(record.item_key) * 100 > filter.max_percent)
or record.unit_buyout_price / Aux.history.value(record.item_key) * 100 > filter.max_percent)
then
return
end