func (e *TradingEngine) ComputeOrderPrice(o *Order) error {
	tokenPair := e.pairs[o.PairID]

	if o.TokenBuy == tokenPair.BaseToken.Address {
		o.OrderType = BUY
		o.Amount = o.AmountBuy.Uint64()
		o.Price = o.AmountSell.Uint64() * (1e3) / o.AmountBuy.Uint64()
	} else if o.TokenBuy == tokenPair.QuoteToken.Address {
		o.OrderType = SELL
		o.Amount = o.AmountSell.Uint64()
		o.Price = o.AmountBuy.Uint64() * (1e3) / o.AmountSell.Uint64()
	} else {
		return errors.New("Token Buy Address should be equal to base token or quote token address")
	}

	return nil
}
// ComputeOrderPrice calculates the (Amount, Price) tuple corresponding
// to the (AmountBuy, TokenBuy, AmountSell, TokenSell) quadruplet
ComputeOrderPrice calculates the (Amount, Price) tuple corresponding
to the (AmountBuy, TokenBuy, AmountSell, TokenSell) quadruplet
// ComputeOrderPrice calculates the ( Amount Price ) tuple corresponding // to the ( AmountBuy TokenBuy AmountSell TokenSell ) quadruplet
func (e *TradingEngine) ComputeOrderPrice(o *Order) error {
	tokenPair := e.pairs[o.PairID]
	if o.TokenBuy == tokenPair.BaseToken.Address {
		o.OrderType = BUY
		o.Amount = o.AmountBuy.Uint64()
		o.Price = o.AmountSell.Uint64() * (1e3) / o.AmountBuy.Uint64()
	} else if o.TokenBuy == tokenPair.QuoteToken.Address {
		o.OrderType = SELL
		o.Amount = o.AmountSell.Uint64()
		o.Price = o.AmountBuy.Uint64() * (1e3) / o.AmountSell.Uint64()
	} else {
		return errors.New("Token Buy Address should be equal to base token or quote token address")
	}
	return nil
}
func ( e * TradingEngine ) ComputeOrderPrice ( o * Order ) error { tokenPair := e . pairs [ o . PairID ] if o . TokenBuy == tokenPair . BaseToken . Address { o . OrderType = BUY o . Amount = o . AmountBuy . Uint64 ( ) o . Price = o . AmountSell . Uint64 ( ) * ( 1e3 ) / o . AmountBuy . Uint64 ( ) } else if o . TokenBuy == tokenPair . QuoteToken . Address { o . OrderType = SELL o . Amount = o . AmountSell . Uint64 ( ) o . Price = o . AmountBuy . Uint64 ( ) * ( 1e3 ) / o . AmountSell . Uint64 ( ) } else { return errors . New ( " " ) } return nil }
ComputeOrderPrice calculates the (Amount, Price) tuple corresponding
to the (AmountBuy, TokenBuy, AmountSell, TokenSell) quadruplet
ComputeOrderPrice calculates the ( Amount Price ) tuple corresponding to the ( AmountBuy TokenBuy AmountSell TokenSell ) quadruplet