Automated overstock detection, carrying cost calculation, and markdown strategy suggestions for inventory optimisation.
import requests, json, pandas as pd
API_INVENTORY = "https://api.example.com/v2/inventory"
def fetch_overstock(days_cover=60):
resp = requests.get(API_INVENTORY, params={"status": "active"})
items = resp.json().get("items", [])
overstock = []
for item in items:
daily_sales = item.get("avg_daily_sales", 0)
if daily_sales == 0: continue
cover_days = item["qty"] / daily_sales
if cover_days >= days_cover:
carrying = round(item["total_cost"] * 0.06, 2)
overstock.append({**item, "cover_days": cover_days, "carrying_cost": carrying})
return sorted(overstock, key=lambda x: x["total_cost"], reverse=True)
def suggest_promo(item):
margin = item.get("margin_pct", 0)
if margin > 40: return "Flash sale 30%"
if margin > 25: return "Bundle deal"
return "Clearance 50%"
overstock = fetch_overstock(60)
for o in overstock:
o["promo"] = suggest_promo(o)
print(json.dumps(overstock, indent=2))
Basic Package
Special SME traction programme by AINNA.
Limited starter website offer. AI usage, hosting, maintenance and custom integrations depend on the confirmed scope.
View SME Offer โ
Ask about AINNA pages, services and articles.
AINNA sources only ยท up to 5 lines ยท 20 questions/hour
No section data available yet.
Sites with documented sections will appear here.
We value your privacy
We use browser storage to remember your choice. Optional analytics runs only after you allow it; your choice is recorded with an anonymous ID. Privacy Policy