Price at average of configurable number of lowest competitors

From MediaSell

Jump to: navigation, search

This script will set your price to the average lowest price of up to three sellers (Example: It will use the average of two lowest sellers if there aren't three). It also has a maximum price drop set to 30% of your base price.

(Replace A00000000000 with your Amazon ID.)

myAmzID = "A00000000000";
 
price = item.basePrice;
numSellers = 3;
maxDiscount = 0.30;
minPrice = price * (1 - maxDiscount);
 
priceList = getPrices('sameOrBetter');
 
count = 0;
sum = 0;
if (priceList) {
  for (pind=0; count < numSellers && pind < priceList.length; pind++) {
    if (priceList[pind].sellerid == myAmzID) continue;
    count++;
    sum += priceList[pind].price;
  }
}
 
if (count > 0) {
  price = sum/count;
} else {
  if (debug) alert("no competition");
}
 
if (price < minPrice) price = minPrice;
return price;
Personal tools