some more history changes, now using the market value in the post panel when no auctions found
This commit is contained in:
+3
-3
@@ -174,7 +174,7 @@ function private.create_record(auction_info)
|
||||
local aux_quantity = auction_info.charges or auction_info.count
|
||||
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
|
||||
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
local buyout_price_per_unit = buyout_price and Aux_Round(auction_info.buyout_price / aux_quantity)
|
||||
local buyout_price_per_unit = buyout_price and Aux.round(auction_info.buyout_price / aux_quantity)
|
||||
|
||||
local status
|
||||
if auction_info.high_bidder then
|
||||
@@ -252,14 +252,14 @@ function private.find_auction(entry, express_mode)
|
||||
if express_mode then
|
||||
CancelAuction(auction_info.index)
|
||||
entry.gone = true
|
||||
Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity..'.')
|
||||
Aux.log('Canceled '..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
Aux.scan.abort()
|
||||
else
|
||||
public.dialog_action = function()
|
||||
if private.create_record(Aux.info.auction(auction_info.index, 'owner')).signature == entry.signature then
|
||||
CancelAuction(auction_info.index)
|
||||
entry.gone = true
|
||||
Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity..'.')
|
||||
Aux.log('Canceled '..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
Aux.scan.abort()
|
||||
AuxAuctionsFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
|
||||
+3
-3
@@ -195,7 +195,7 @@ function private.create_record(auction_info)
|
||||
local aux_quantity = auction_info.charges or auction_info.count
|
||||
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
|
||||
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
local buyout_price_per_unit = buyout_price and Aux_Round(auction_info.buyout_price / aux_quantity)
|
||||
local buyout_price_per_unit = buyout_price and Aux.round(auction_info.buyout_price / aux_quantity)
|
||||
|
||||
local status
|
||||
if auction_info.high_bidder then
|
||||
@@ -283,7 +283,7 @@ function private.find_auction(entry, action, express_mode)
|
||||
if express_mode then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('bidder', auction_info.index, amount)
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..'.')
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
entry.gone = true
|
||||
else
|
||||
Aux.log((action == 'buyout' and 'Purchase' or 'Bid')..' failed: Not enough money.')
|
||||
@@ -294,7 +294,7 @@ function private.find_auction(entry, action, express_mode)
|
||||
if private.create_record(Aux.info.auction(auction_info.index, 'bidder')).signature == entry.signature then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('bidder', auction_info.index, action == 'bid' and MoneyInputFrame_GetCopper(AuxBidsFrameListingDialogContentBid) or amount)
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..'.')
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
entry.gone = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AuxVersion = '2.2.19'
|
||||
AuxVersion = '2.2.20'
|
||||
AuxAuthors = 'shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)'
|
||||
|
||||
local lastRightClickAction = GetTime()
|
||||
@@ -36,7 +36,7 @@ function Aux_OnLoad()
|
||||
local item_id, suffix_id = EnhTooltip.BreakLink(link)
|
||||
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
||||
|
||||
local auction_count, day_count, TDA, EMA7, trend, correlation = Aux.history.price_data(item_key)
|
||||
local auction_count, day_count, TDA, EMA7 = Aux.history.price_data(item_key)
|
||||
|
||||
if auction_count == 0 then
|
||||
EnhTooltip.AddLine('Never seen at auction', nil, true)
|
||||
@@ -46,31 +46,15 @@ function Aux_OnLoad()
|
||||
EnhTooltip.LineColor(0.5, 0.8, 0.1)
|
||||
|
||||
local market_value = Aux.history.market_value(item_key)
|
||||
local trend_percentage = ceil((1 - trend) * 100)
|
||||
local market_value_line
|
||||
if count == 1 then
|
||||
market_value_line = 'Market Value: '..Aux.util.money_string(market_value)
|
||||
else
|
||||
market_value_line = 'Market Value: '..Aux.util.money_string(market_value * count)..' / '..Aux.util.money_string(market_value)
|
||||
if correlation < 0.8 then -- unreliable
|
||||
market_value_line = market_value_line..' (?)'
|
||||
elseif trend_percentage > 0 then
|
||||
market_value_line = market_value_line..' (+'..trend_percentage..'%)'
|
||||
elseif trend_percentage < 0 then
|
||||
market_value_line = market_value_line..' ('..trend_percentage..'%)'
|
||||
end
|
||||
end
|
||||
|
||||
EnhTooltip.AddLine(market_value_line, nil, true)
|
||||
EnhTooltip.LineColor(0.1,0.8,0.5)
|
||||
|
||||
-- EnhTooltip.AddLine('TDA: '..(TDA > 0 and Aux.util.money_string(TDA) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
|
||||
-- EnhTooltip.LineColor(0.1,0.8,0.5)
|
||||
-- EnhTooltip.AddLine('EMA7: '..(EMA7 > 0 and Aux.util.money_string(EMA7) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
|
||||
-- EnhTooltip.LineColor(0.1,0.8,0.5)
|
||||
-- EnhTooltip.AddLine('Trend: '..trend_percentage..'%', nil, true)
|
||||
-- EnhTooltip.LineColor(0.1,0.8,0.5)
|
||||
-- EnhTooltip.AddLine('SD: '..sqrt(variance), nil, true)
|
||||
-- EnhTooltip.LineColor(0.1,0.8,0.5)
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -265,8 +249,8 @@ function Aux.on_tab_click(index)
|
||||
end)
|
||||
end
|
||||
|
||||
function Aux_Round(v)
|
||||
return math.floor(v + 0.5)
|
||||
function Aux.round(v)
|
||||
return floor(v + 0.5)
|
||||
end
|
||||
|
||||
function Aux.price_level_color(pct)
|
||||
|
||||
@@ -744,7 +744,7 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
if express_mode then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('list', auction_info.index, amount)
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..'.')
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
@@ -756,7 +756,7 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
if create_auction_record(Aux.info.auction(auction_info.index)).signature == entry.signature then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid))
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..'.')
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
@@ -817,7 +817,7 @@ function create_auction_record(auction_info, current_page)
|
||||
local aux_quantity = auction_info.charges or auction_info.count
|
||||
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
|
||||
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
local buyout_price_per_unit = buyout_price and Aux_Round(auction_info.buyout_price / aux_quantity)
|
||||
local buyout_price_per_unit = buyout_price and Aux.round(auction_info.buyout_price / aux_quantity)
|
||||
local status
|
||||
if auction_info.current_bid == 0 then
|
||||
status = 'No Bid'
|
||||
@@ -848,7 +848,7 @@ function create_auction_record(auction_info, current_page)
|
||||
itemstring = auction_info.itemstring,
|
||||
page = current_page,
|
||||
bid = bid,
|
||||
bid_per_unit = Aux_Round(bid / aux_quantity),
|
||||
bid_per_unit = Aux.round(bid / aux_quantity),
|
||||
owner = auction_info.owner,
|
||||
duration = auction_info.duration,
|
||||
usable = auction_info.usable,
|
||||
|
||||
+10
-20
@@ -2,7 +2,7 @@ local private, public = {}, {}
|
||||
Aux.history = public
|
||||
|
||||
private.PUSH_INTERVAL = 57600
|
||||
private.NEW_RECORD = '0#0#0#1#1#'
|
||||
private.NEW_RECORD = '0#0#0#'
|
||||
|
||||
function private.load_data()
|
||||
local dataset = Aux.persistence.load_dataset()
|
||||
@@ -17,9 +17,7 @@ function private.read_record(item_key)
|
||||
auction_count = tonumber(record[1]),
|
||||
day_count = tonumber(record[2]),
|
||||
EMA7 = tonumber(record[3]),
|
||||
trend = tonumber(record[4]),
|
||||
correlation = tonumber(record[5]),
|
||||
histogram = Aux.util.map(Aux.persistence.deserialize(record[6], ';', 'x'), function(value)
|
||||
histogram = Aux.util.map(Aux.persistence.deserialize(record[4], ';', 'x'), function(value)
|
||||
return tonumber(value)
|
||||
end),
|
||||
}
|
||||
@@ -31,8 +29,6 @@ function private.write_record(item_key, record)
|
||||
record.auction_count,
|
||||
record.day_count,
|
||||
record.EMA7,
|
||||
record.trend,
|
||||
record.correlation,
|
||||
Aux.persistence.serialize(record.histogram, ';', 'x'),
|
||||
},'#')
|
||||
end
|
||||
@@ -68,18 +64,18 @@ end
|
||||
|
||||
function public.price_data(item_key)
|
||||
local item_record = private.read_record(item_key)
|
||||
return item_record.auction_count, item_record.day_count, private.daily_market_value(item_record.histogram), item_record.EMA7, item_record.trend, item_record.correlation
|
||||
return item_record.auction_count, item_record.day_count, private.daily_market_value(item_record.histogram), item_record.EMA7
|
||||
end
|
||||
|
||||
function public.market_value(item_key)
|
||||
local auction_count, day_count, daily_market_value, EMA7, trend, correlation = public.price_data(item_key)
|
||||
local auction_count, day_count, daily_market_value, EMA7 = public.price_data(item_key)
|
||||
|
||||
if day_count == 0 then
|
||||
if auction_count == 0 then
|
||||
return nil
|
||||
elseif day_count == 0 then
|
||||
return daily_market_value
|
||||
elseif correlation < 0.8 then -- history of bad predictions
|
||||
return EMA7
|
||||
else
|
||||
return EMA7 * trend
|
||||
return EMA7
|
||||
end
|
||||
end
|
||||
|
||||
@@ -121,15 +117,9 @@ function private.push_data()
|
||||
local daily_market_value = private.daily_market_value(item_record.histogram)
|
||||
|
||||
if item_record.day_count == 0 then
|
||||
item_record.EMA7 = daily_market_value
|
||||
item_record.EMA7 = Aux.round(daily_market_value)
|
||||
else
|
||||
local new_trend = daily_market_value / item_record.EMA7
|
||||
local prediction = item_record.EMA7 * item_record.trend
|
||||
local new_correlation = min(prediction, daily_market_value) / max(prediction, daily_market_value)
|
||||
|
||||
item_record.EMA7 = 3/4 * item_record.EMA7 + 1/4 * daily_market_value
|
||||
item_record.trend = 3/4 * item_record.trend + 1/4 * new_trend
|
||||
item_record.correlation = 3/4 * item_record.correlation + 1/4 * new_correlation
|
||||
item_record.EMA7 = Aux.round(3/4 * item_record.EMA7 + 1/4 * daily_market_value)
|
||||
end
|
||||
|
||||
item_record.day_count = item_record.day_count + 1
|
||||
|
||||
@@ -721,7 +721,7 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
if express_mode then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('list', auction_info.index, amount)
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..'.')
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
@@ -733,7 +733,7 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
if create_auction_record(Aux.info.auction(auction_info.index)).signature == entry.signature then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid))
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..'.')
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
@@ -794,7 +794,7 @@ function create_auction_record(auction_info, current_page)
|
||||
local aux_quantity = auction_info.charges or auction_info.count
|
||||
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
|
||||
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
local buyout_price_per_unit = buyout_price and Aux_Round(auction_info.buyout_price / aux_quantity)
|
||||
local buyout_price_per_unit = buyout_price and Aux.round(auction_info.buyout_price / aux_quantity)
|
||||
local status
|
||||
if auction_info.current_bid == 0 then
|
||||
status = 'No Bid'
|
||||
@@ -823,7 +823,7 @@ function create_auction_record(auction_info, current_page)
|
||||
hyperlink = auction_info.hyperlink,
|
||||
page = current_page,
|
||||
bid = bid,
|
||||
bid_per_unit = Aux_Round(bid / aux_quantity),
|
||||
bid_per_unit = Aux.round(bid / aux_quantity),
|
||||
owner = auction_info.owner,
|
||||
duration = auction_info.duration,
|
||||
usable = auction_info.usable,
|
||||
|
||||
+16
-17
@@ -388,28 +388,27 @@ function update_recommendation()
|
||||
MoneyFrame_Update('AuxSellParametersDepositMoneyFrame', floor(current_auction.unit_vendor_price * 0.05 * (current_auction.charges and 1 or get_stack_size_slider_value())) * AuxSellStackCountSlider:GetValue() * AuctionFrameAuctions.duration / 120)
|
||||
|
||||
if existing_auctions[current_auction.key] and existing_auctions[current_auction.key].selected then
|
||||
-- if not existing_auctions[current_auction.key].created or GetTime() - existing_auctions[current_auction.key].created > 1800 then
|
||||
-- AuxSellParametersStrategyDropDownStaleWarning:SetText('Stale data!') -- data older than half an hour marked as stale
|
||||
-- end
|
||||
|
||||
|
||||
local new_buyout_price = existing_auctions[current_auction.key].selected.unit_buyout_price * get_stack_size_slider_value()
|
||||
|
||||
if existing_auctions[current_auction.key].selected.yours == 0 then
|
||||
new_buyout_price = undercut(new_buyout_price)
|
||||
end
|
||||
|
||||
local new_start_price = new_buyout_price * 0.95
|
||||
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux_Round(new_start_price)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux_Round(new_buyout_price)))
|
||||
-- elseif UIDropDownMenu_GetSelectedValue(AuxSellParametersStrategyDropDown) == HISTORICAL then
|
||||
-- local market_price = Aux.history.get_price_suggestion(current_auction.key, current_auction.aux_quantity)
|
||||
-- MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, Aux_Round(market_price * 0.95))
|
||||
-- MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, market_price)
|
||||
elseif existing_auctions[current_auction.key] then
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux_Round(current_auction.unit_vendor_price * (current_auction.charges and 1 or get_stack_size_slider_value()) * 1.053)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux_Round(current_auction.unit_vendor_price * (current_auction.charges and 1 or get_stack_size_slider_value()) * 4)))
|
||||
else
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(new_buyout_price * 0.95)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(new_buyout_price)))
|
||||
|
||||
elseif existing_auctions[current_auction.key] then -- unsuccessful search
|
||||
|
||||
local market_value = Aux.history.market_value(current_auction.key)
|
||||
if market_value then
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(market_value * 0.95)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(market_value)))
|
||||
else
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(current_auction.unit_vendor_price * (current_auction.charges and 1 or get_stack_size_slider_value()) * 1.053)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(current_auction.unit_vendor_price * (current_auction.charges and 1 or get_stack_size_slider_value()) * 4)))
|
||||
end
|
||||
else -- no search yet
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, 0)
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, 0)
|
||||
end
|
||||
@@ -664,7 +663,7 @@ end
|
||||
|
||||
function report(hyperlink, aux_quantity, buyout_price, posted)
|
||||
Aux.log(string.format(
|
||||
'%i %s of %s x %i posted at %s.',
|
||||
'%i %s of %s (%i) posted at %s.',
|
||||
posted,
|
||||
Aux_PluralizeIf('auction', posted),
|
||||
hyperlink,
|
||||
|
||||
Reference in New Issue
Block a user