Example #1
0
func (f *Fac) createRes(qty float64) {
	if qty < rsrc.EPS {
		return
	}
	r := rsrc.NewGeneric(qty, f.OutUnits)
	f.outBuff.Push(r)
}
Example #2
0
func (f *Fac) genMsg(commod string, qty float64, t trans.TransType) {
	units := f.InUnits
	tran := trans.NewRequest(f)
	if t == trans.Offer {
		units = f.OutUnits
		tran = trans.NewOffer(f)
	}
	r := rsrc.NewGeneric(qty, units)
	tran.SetResource(r)

	mkt, _ := f.eng.GetService(commod)
	m := sim.NewMsg(f, mkt)
	m.Trans = tran
	m.SendOn()
}