Docs · Guides
Turn a supplier offer list into a purchase plan
The most common P34 job, end to end: hundreds of offers in, a sized purchase plan out.
The job: a reseller sees hundreds of supplier offers this week and must decide which to buy and how many, without tying cash up in stock that will not sell. This is the decision P34 was built for, and the shape most other uses copy.
1 · This week's offers become the task
One row per offer and per order size you could place, on menu 0, T 0, with cost, expected price and whatever you would look at yourself.
import csv
menus = []
for o in csv.DictReader(open("offers_this_week.csv")): # one row per supplier offer
for q in range(1, int(o["max_qty"]) + 1): # every size you could order
menus.append({"key": o["offer_id"], "menu": 0, "T": 0, "qty": q,
"unit_cost": float(o["unit_cost"]), "unit_price": float(o["expected_price"]),
"sales_rank": float(o["sales_rank"]), "sold_30d": float(o["sold_30d"])})
# past weeks go in the same list: menu = a week id, T = -weeks ago,
# the offers you passed on included, with "profit" where you know it
2 · Past weeks become the history
Add the offers of earlier weeks the same way — including the ones you passed on — with a negative T and profit on the options whose outcome you know. Then export the sales of what you did buy as the sales table.
3 · Write the economics down
One paragraph, formulas welcome:
"business_description": "We buy supplier lots weekly and resell on one marketplace. Net profit per unit = sale price − unit cost − 15% marketplace fee − $2.10 fulfilment − $0.04 per week in storage. Units unsold after 12 weeks are written off at zero. sales_rank is the marketplace rank when the offer arrived; sold_30d is units of the item sold marketplace-wide in the previous 30 days."
4 · Validate, test, fit
POST /validate until it passes, an input test with "mock": true, then the actual fit. The quickstart has the calls.
5 · Review the plan, then buy
The qty > 0 rows are a draft purchase order. Check them against your cash and storage, approve, and place the orders through your usual channels. Next week, the sales of what you bought — and the offers you passed on — join the history, and the plan improves with it.
Prove the loop where it closes fastest: virtual goods, game items and other markets where trades resolve in days. Move to slower, account-heavy markets once the mechanism works.