class_docstr: A size of a financial instrument for use in trading.
  
  Parameters
  ----------
  instrument : `Instrument`
      The unit of the quantity.
  size : `Decimal`
      The number of units of the instrument.
  path_id : str, optional
      The path order_id that this quantity is allocated for and associated
      with.
  
  Raises
  ------
  InvalidNegativeQuantity
      Raised if the `size` of the quantity being created is negative.
docstr: Converts the quantity into the value of another instrument based
  on its exchange rate from an exchange.
  
  Parameters
  ----------
  exchange_pair : `ExchangePair`
      The exchange pair to use for getting the quoted price to perform
      the conversion.
  
  Returns
  -------
  `Quantity`
      The value of the current quantity in terms of the quote instrument.
docstr_tok: ["Converts","the","quantity","into","the","value","of","another","instrument","based","on","its","exchange","rate","from","an","exchange",".","Parameters","--","--","--","--","--","exchange_pair",":","`","ExchangePair","`","The","exchange","pair","to","use","for","getting","the","quoted","price","to","perform","the","conversion",".","Returns","--","--","--","-","`","Quantity","`","The","value","of","the","current","quantity","in","terms","of","the","quote","instrument","."]
code: def convert(self, exchange_pair: "ExchangePair") -> "Quantity":
      """Converts the quantity into the value of another instrument based
      on its exchange rate from an exchange.
  
      Parameters
      ----------
      exchange_pair : `ExchangePair`
          The exchange pair to use for getting the quoted price to perform
          the conversion.
  
      Returns
      -------
      `Quantity`
          The value of the current quantity in terms of the quote instrument.
      """
      if self.instrument == exchange_pair.pair.base:
          instrument = exchange_pair.pair.quote
          converted_size = self.size / exchange_pair.price
      else:
          instrument = exchange_pair.pair.base
          converted_size = self.size * exchange_pair.price
      return Quantity(instrument, converted_size, self.path_id)
  
imports: import operator
  from typing import Union, Tuple, Callable, TypeVar
  from numbers import Number
  from decimal import Decimal, ROUND_DOWN
  from functools import total_ordering
  from tensortrade.core.exceptions import InvalidNegativeQuantity, IncompatibleInstrumentOperation, InvalidNonNumericQuantity, QuantityOpPathMismatch
label_desc: Use image node_id 4 for calling the Quantity obj's underlying member method code with example usage: obj.convert(exchange_pair) and returns: Quantity