Estimating Markups

The basic formulas are:

price = (1 + markup) * base_price

profit = (1 + markup)*(1 - commission)*base_price - base_price

where the markup and commission are fractional (i.e. 33% is 0.33).  

It's easiest to just use a range of markups and calculate the values, but you could rearrange the equations to figure out the markup given a desired profit. I'll leave that exercise to the reader.

# (c) 2024 Treadco
#  Estimate price to ask given base price and commission

import sys

def main():
    if len(sys.argv) < 3:
        print("Usage base_price commission(in percent)")
    base = float(sys.argv[1])
    commission = float(sys.argv[2])
    if commission > 1.:
        commission = commission/100.

    for markup in range(0,31):
        markup = float(markup/10.)
        print( str(markup)+' price '+str( base*(1.+markup))+' profit '+str( base*(1.+markup)*(1.-commission)-base))