func (l *LimitOrder) SetAmountWant(price float64) (err error) {
	if price <= 0 {
		err = fmt.Errorf("Price can't be less than or equal to 0")
		return
	}

	// Rules for all of this amountHave / amountWant confusing stuff because I'm bad at naming variables:
	// Say the market is called BTC/USD
	// This means that if your order is 'buying' then you already have USD and you're looking to buy BTC
	// If you're buying your amountHave will be in units of USD, and your amountWant will be in units of BTC
	// On the other hand, if your side is 'selling' then you already have BTC and you're looking to sell it for USD
	// If you're selling then your amountHave will be in units of BTC and your amountWant will be in units of USD
	// THIS is all different from the assetHave and assetWant in the trading pair
	// in the trading pair, the assetWant is supposed to be the primary asset, so that is BTC in this case
	// the assetWant / have is all from a buyer's point of view in the trading pair struct.
	// just putting this here because this is also where crucial price code is, because price means the SAME thing
	// across a buyer and seller, while everything else means different things.
	if l.IsBuySide() {
		l.AmountWant = uint64(float64(l.AmountHave) * price)
	} else if l.IsSellSide() {
		l.AmountWant = uint64(float64(l.AmountHave) / price)
	} else {
		err = fmt.Errorf("Invalid side for order, must be buy or sell")
		return
	}
	return
}
// SetAmountWant sets the amountwant value of the limit order according to a price
SetAmountWant sets the amountwant value of the limit order according to a price
// SetAmountWant sets the amountwant value of the limit order according to a price
func (l *LimitOrder) SetAmountWant(price float64) (err error) {
	if price <= 0 {
		err = fmt.Errorf("Price can't be less than or equal to 0")
		return
	}
	if l.IsBuySide() {
		l.AmountWant = uint64(float64(l.AmountHave) * price)
	} else if l.IsSellSide() {
		l.AmountWant = uint64(float64(l.AmountHave) / price)
	} else {
		err = fmt.Errorf("Invalid side for order, must be buy or sell")
		return
	}
	return
}
func ( l * LimitOrder ) SetAmountWant ( price float64 ) ( err error ) { if price <= 0 { err = fmt . Errorf ( " " ) return } if l . IsBuySide ( ) { l . AmountWant = uint64 ( float64 ( l . AmountHave ) * price ) } else if l . IsSellSide ( ) { l . AmountWant = uint64 ( float64 ( l . AmountHave ) / price ) } else { err = fmt . Errorf ( " " ) return } return }
SetAmountWant sets the amountwant value of the limit order according to a price
SetAmountWant sets the amountwant value of the limit order according to a price
// Rules for all of this amountHave / amountWant confusing stuff because I'm bad at naming variables: // Say the market is called BTC/USD // This means that if your order is 'buying' then you already have USD and you're looking to buy BTC // If you're buying your amountHave will be in units of USD, and your amountWant will be in units of BTC // On the other hand, if your side is 'selling' then you already have BTC and you're looking to sell it for USD // If you're selling then your amountHave will be in units of BTC and your amountWant will be in units of USD // THIS is all different from the assetHave and assetWant in the trading pair // in the trading pair, the assetWant is supposed to be the primary asset, so that is BTC in this case // the assetWant / have is all from a buyer's point of view in the trading pair struct. // just putting this here because this is also where crucial price code is, because price means the SAME thing // across a buyer and seller, while everything else means different things.