Example beat high feedback sellers by $1

This script will change your price to BEAT the lowest price offer with a feedback equal to or greater than 300,000, and a % positive rating AT OR ABOVE 90% in ANY CONDITION on Amazon.com by $1.00 (beating offers with feedback below 300,000 by $0.01), while ignoring your own price. If there isn’t competition, the script will use your Base Price. This script applies a price floor of Cost or $1, whichever is greater. You can also change the price floor from 1.00, the % rating from 90, the feedback value from 300000, and the discount values from 1.00 and 0.01 in the script below, if desired.

Example Code

// beat high feedback sellers by 1.00

var item = FILLZ.ITEM.v1;
var f = FILLZ.FILTERS.v1;

// default price
var price = item.base_price;

// price floor
var floor = Math.max(item.cost, 1.00);

// high feedback
var high_feedback = 300000;

// competition filters
var filters = [];
// consider only offers with rating >= 90%
filters.push(f.rating.greater_than_or_equal(90));
// ignore offers made by me
filters.push(f.seller_id.excludes(FILLZ.SETTINGS.v1.seller_id_for_venue('amazon')));

// filter offers from amazon.com
var offers = FILLZ.SOURCE.AMAZONUS.v2.offers(filters);

// beat if competitors exist after filtering
var lowest = offers.lowest_price_offer();
if (lowest) {
  var discount = 0.01;
  debug('beating lowest price by '+discount+': '+lowest);
  price = lowest.price - discount;
  var lowest_hf = offers.filter(f.feedback.greater_than(high_feedback)).lowest_price_offer();
  if (lowest_hf) {
    var discount_hf = 1.00;
    var price_hf = lowest_hf.price - discount_hf;
    if (price_hf < price) {
      debug('beating lowest high feedback price by '+discount_hf+': '+lowest_hf);
      price = price_hf;
    }
  }
}

//apply price floor
if (price < floor) price = floor;
return price;