removed unreliability indicator
This commit is contained in:
+3
-6
@@ -83,7 +83,7 @@ function public.value(item_key)
|
|||||||
if not private.value_cache[item_key] or private.value_cache[item_key].next_push <= time() then
|
if not private.value_cache[item_key] or private.value_cache[item_key].next_push <= time() then
|
||||||
local item_record = private.read_record(item_key)
|
local item_record = private.read_record(item_key)
|
||||||
|
|
||||||
local value, unreliable
|
local value
|
||||||
if getn(item_record.data_points) > 0 then
|
if getn(item_record.data_points) > 0 then
|
||||||
local weighted_values = {}
|
local weighted_values = {}
|
||||||
local total_weight = 0
|
local total_weight = 0
|
||||||
@@ -97,17 +97,14 @@ function public.value(item_key)
|
|||||||
end
|
end
|
||||||
|
|
||||||
value = private.weighted_median(weighted_values)
|
value = private.weighted_median(weighted_values)
|
||||||
-- not seen at least 3 times in the last two weeks or not ignoring at least two high and low outliers
|
|
||||||
unreliable = not weighted_values[3] or item_record.data_points[3].time < time() - 60*60*24*7*2 or weighted_values[1].weight + weighted_values[2].weight >= 0.5
|
|
||||||
else
|
else
|
||||||
value = private.market_value(item_record)
|
value = private.market_value(item_record)
|
||||||
unreliable = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private.value_cache[item_key] = {value=value, unreliable=unreliable, next_push=item_record.next_push}
|
private.value_cache[item_key] = {value=value, next_push=item_record.next_push}
|
||||||
end
|
end
|
||||||
|
|
||||||
return private.value_cache[item_key].value, private.value_cache[item_key].unreliable
|
return private.value_cache[item_key].value
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.market_value(item_key)
|
function public.market_value(item_key)
|
||||||
|
|||||||
+1
-7
@@ -71,18 +71,12 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
|
|
||||||
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
||||||
|
|
||||||
local value, unreliable = Aux.history.value(item_key)
|
local value = Aux.history.value(item_key)
|
||||||
|
|
||||||
local value_line = 'Value: '
|
local value_line = 'Value: '
|
||||||
|
|
||||||
value_line = value_line..(value and private.format_money(value) or '---')
|
value_line = value_line..(value and private.format_money(value) or '---')
|
||||||
|
|
||||||
local _, _, data_points = Aux.history.price_data(item_key)
|
|
||||||
-- mark as unreliable if less than 5 data points in the last month
|
|
||||||
if value and unreliable then
|
|
||||||
value_line = value_line..' (?)'
|
|
||||||
end
|
|
||||||
|
|
||||||
tooltip:AddLine(value_line, 0.1, 0.8, 0.5)
|
tooltip:AddLine(value_line, 0.1, 0.8, 0.5)
|
||||||
|
|
||||||
if aux_tooltip_daily then
|
if aux_tooltip_daily then
|
||||||
|
|||||||
Reference in New Issue
Block a user