Documentation
¶
Overview ¶
Package pricing computes a suggested sell price for a craftable item from the live market cost of its inputs plus a profit margin. It powers the play_as `price` command: given an item's decomposition (recipe inputs or bill-of-materials ore), it prices each component two ways — Nearby (cheapest ask within N jumps) and Market-wide (mean ask across stations) — rolls the costs up per output unit, adds a margin line, and compares the result to the finished good's own current market price.
Index ¶
Constants ¶
const ( ClassUnder = "UNDERPRICED" ClassOver = "OVERPRICED" ClassFair = "FAIRLY PRICED" )
Verdicts comparing the finished good's current market ask to the cost-plus-margin suggestion.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Basis ¶
type Basis struct {
BuildCost float64 // Σ qty×unit over components priced on this basis
PerUnit float64 // BuildCost / outputUnits
Margin float64 // PerUnit × marginPct/100
Suggested float64 // PerUnit + Margin
Covered int // components priced on this basis
Total int // total components
}
Basis is the rolled-up cost on one pricing basis (Nearby or Market-wide).
type PriceReport ¶
type PriceReport struct {
ItemID string `json:"item_id"`
RecipeName string `json:"recipe_name,omitempty"`
OutputUnits int `json:"output_units"`
MarginPct float64 `json:"margin_pct"`
Components []PricedComponent `json:"components"`
Nearby Basis `json:"nearby"`
Mkt Basis `json:"market"`
CurAskNearby float64 `json:"cur_ask_nearby,omitempty"`
HasAskNearby bool `json:"has_ask_nearby"`
CurAskMkt float64 `json:"cur_ask_mkt,omitempty"`
HasAskMkt bool `json:"has_ask_mkt"`
CurBid float64 `json:"cur_bid,omitempty"`
HasBid bool `json:"has_bid"`
Class string `json:"class,omitempty"`
}
PriceReport is the full pricing result for one decomposition of one item.
func Report ¶
func Report(ctx context.Context, col *market.Collector, kb knowledge.Base, fromSystem string, hops int, itemID, recipeName string, outputUnits int, comps []Component, marginPct float64) (*PriceReport, error)
Report prices every component of one decomposition (comps) on both bases, rolls them up per output unit, prices the finished good, and classifies. recipeName is surfaced in the header ("" for BoM / no-recipe). outputUnits is the recipe's output-per-run for recipe mode, or 1 for BoM mode (its quantities are already per unit).
type PricedComponent ¶
type PricedComponent struct {
Component
NearbyUnit float64
MktUnit float64
NearbyFound bool
MktFound bool
}
PricedComponent annotates a Component with its resolved unit prices on each basis. A *Found flag is false when no station offered the component on that basis; the unit price is then zero and excluded from the roll-up.