Example match item price using data for each venue

This script will change your price to MATCH the lowest offer in ANY CONDITION, with a % positive rating AT OR ABOVE 90%, using Specific Pricing Data, while ignoring your own Amazon prices. 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 in the script below, if desired. You will need to edit the marketplaces and data sources below.

Example Code

// match item price using data for each venue

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);

// competition filters
var filters = [];
// do not compete with oneself (for amazon marketplaces only)
// consider only offers with rating >= 90%

// map venues to sources  
var sources = {
    'abebooks': FILLZ.SOURCE.ABEBOOKS.v2,
    'amazon':   FILLZ.SOURCE.AMAZONUS.v2,
    'amazonca': FILLZ.SOURCE.AMAZONCA.v2,
    'amazonuk': FILLZ.SOURCE.AMAZONUK.v2,
    'amazonde': FILLZ.SOURCE.AMAZONDE.v2,
    'amazonfr': FILLZ.SOURCE.AMAZONFR.v2,
    'valore':   FILLZ.SOURCE.AMAZONUS.v2,
var source = sources[FILLZ.venue];
// filter offers from source chosen above
var offers = source.offers(filters);

// match if competitors exist after filtering
var lowest = offers.lowest_price_offer();
if (lowest) {
  debug('matching lowest price: '+lowest);
  price = lowest.price;

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

return price;