func (e *TradingEngine) AddOrder(o *Order) error {
	tokenPair, ok := e.pairs[o.PairID]
	if !ok {
		return errors.New("Token pair does not exist")
	}

	ob, ok := e.orderbooks[tokenPair]
	if !ok {
		return errors.New("Orderbook does not exist")
	}

	err := e.ComputeOrderPrice(o)
	if err != nil {
		return err
	}

	ok, err = o.VerifySignature()
	if err != nil {
		return err
	}

	if !ok {
		return errors.New("Signature is not valid")
	}

	e.ComputeOrderPrice(o)
	ob.AddOrder(o)
	return nil
}
// AddOrder computes the order price point
AddOrder computes the order price point
// AddOrder computes the order price point
func (e *TradingEngine) AddOrder(o *Order) error {
	tokenPair, ok := e.pairs[o.PairID]
	if !ok {
		return errors.New("Token pair does not exist")
	}
	ob, ok := e.orderbooks[tokenPair]
	if !ok {
		return errors.New("Orderbook does not exist")
	}
	err := e.ComputeOrderPrice(o)
	if err != nil {
		return err
	}
	ok, err = o.VerifySignature()
	if err != nil {
		return err
	}
	if !ok {
		return errors.New("Signature is not valid")
	}
	e.ComputeOrderPrice(o)
	ob.AddOrder(o)
	return nil
}
func ( e * TradingEngine ) AddOrder ( o * Order ) error { tokenPair , ok := e . pairs [ o . PairID ] if ! ok { return errors . New ( " " ) } ob , ok := e . orderbooks [ tokenPair ] if ! ok { return errors . New ( " " ) } err := e . ComputeOrderPrice ( o ) if err != nil { return err } ok , err = o . VerifySignature ( ) if err != nil { return err } if ! ok { return errors . New ( " " ) } e . ComputeOrderPrice ( o ) ob . AddOrder ( o ) return nil }
AddOrder computes the order price point
AddOrder computes the order price point