tensortrade.core.exceptions module

Holds all the exceptions for the project.

exception tensortrade.core.exceptions.DoubleLockedQuantity(quantity: Quantity, *args)[source]

Bases: Exception

Raised when a locked Quantity is trying to get locked again.

Parameters:
  • quantity (Quantity) – A locked quantity.
  • *args (positional arguments) – More positional arguments for the exception.
exception tensortrade.core.exceptions.DoubleUnlockedQuantity(quantity: Quantity, *args)[source]

Bases: Exception

Raised when a free Quantity is trying to get unlocked.

Parameters:
  • quantity (Quantity) – A unlocked quantity.
  • *args (positional arguments) – More positional arguments for the exception.
exception tensortrade.core.exceptions.IncompatibleInstrumentOperation(left: Quantity, right: Quantity, *args)[source]

Bases: Exception

Raised when two quantities with different instruments occurs.

Parameters:
  • left (Quantity) – The left argument of the operation.
  • right (Quantity) – The right argument of the operation.
  • *args (positional arguments) – More positional arguments for the exception.
exception tensortrade.core.exceptions.InsufficientFunds(balance: Quantity, size: Quantity, *args)[source]

Bases: Exception

Raised when requested funds are greater than the free balance of a Wallet

Parameters:
  • balance (Quantity) – The balance of the Wallet where funds are being allocated from.
  • size (Quantity) – The amount being requested for allocation.
  • *args (positional arguments) – More positional arguments for the exception.
exception tensortrade.core.exceptions.InvalidNegativeQuantity(size: float, *args)[source]

Bases: Exception

Raised when a Quantity tries to be instantiated with a negative amount.

Parameters:
  • size (float) – The size that was specified for the Quantity.
  • *args (positional arguments) – More positional arguments for the exception.
exception tensortrade.core.exceptions.InvalidNonNumericQuantity(size: Union[float, int, numbers.Number], *args)[source]

Bases: Exception

Raised when a Quantity tries to be instantiated with a value that is not numeric.

Parameters:
  • size (Union[float, int, Number]) – The value that was specified for the Quantity.
  • *args (positional arguments) – More positional arguments for the exception.
exception tensortrade.core.exceptions.InvalidOrderQuantity(quantity: Quantity, *args)[source]

Bases: Exception

Raised when an Order with a non-negative amount is placed

Parameters:
  • quantity (Quantity) – An invalid order quantity.
  • *args (positional arguments) – More positional arguments for the exception.
exception tensortrade.core.exceptions.InvalidTradingPair(base: Instrument, quote: Instrument, *args)[source]

Bases: Exception

Raised when an invalid trading pair is trying to be created.

Parameters:
  • base ('Instrument') – The base instrument of the pair.
  • quote ('Instrument') – The quote instrument of the pair.
  • *args (positional arguments) – More positional arguments for the exception.
exception tensortrade.core.exceptions.QuantityNotLocked(quantity: Quantity, *args)[source]

Bases: Exception

Raised when a locked Quantity does not have a path_id in the Wallet it is trying to be unlocked in.

Parameters:
  • quantity (Quantity) – A locked quantity.
  • *args (positional arguments) – More positional arguments for the exception.
exception tensortrade.core.exceptions.QuantityOpPathMismatch(left_id: str, right_id: str, *args)[source]

Bases: Exception

Raised when an operation tries to occur between quantities that are not under the same path_id.

Parameters:
  • left_id (str) – The path_id for the left argument in the operation.
  • right_id (str) – The path_id for the right argument in the operation.
  • *args (positional arguments) – More positional arguments for the exception.