tensortrade.oms.orders.criteria module

class tensortrade.oms.orders.criteria.Criteria[source]

Bases: object

A criteria to be satisfied before an order will be executed.

check(order: tensortrade.oms.orders.order.Order, exchange: tensortrade.oms.exchanges.exchange.Exchange) → bool[source]

Checks whether the order is executable on exchange.

Parameters:
  • order (Order) – An order.
  • exchange (Exchange) – The exchange to check.
Returns:

bool – Whether order is executable on exchange.

class tensortrade.oms.orders.criteria.CriteriaBinOp(left: Callable[[tensortrade.oms.orders.order.Order, tensortrade.oms.exchanges.exchange.Exchange], bool], right: Callable[[tensortrade.oms.orders.order.Order, tensortrade.oms.exchanges.exchange.Exchange], bool], op: Callable[[bool, bool], bool], op_str: str)[source]

Bases: tensortrade.oms.orders.criteria.Criteria

A class for using a binary operation for criteria.

Parameters:
  • left (Callable[[Order, Exchange], bool]) – The left criteria argument.
  • right (Callable[[Order, Exchange], bool]) – The right criteria argument.
  • op (Callable[[bool, bool], bool]) – The binary boolean operation.
  • op_str (str) – The string representing the op.
check(order: tensortrade.oms.orders.order.Order, exchange: tensortrade.oms.exchanges.exchange.Exchange) → bool[source]

Checks whether the order is executable on exchange.

Parameters:
  • order (Order) – An order.
  • exchange (Exchange) – The exchange to check.
Returns:

bool – Whether order is executable on exchange.

class tensortrade.oms.orders.criteria.Limit(limit_price: float)[source]

Bases: tensortrade.oms.orders.criteria.Criteria

An order criteria that allows execution when the quote price for a trading pair is at or below a specific price, hidden from the public order book.

Parameters:limit_price (float) – The quote price to check for execution.
check(order: tensortrade.oms.orders.order.Order, exchange: tensortrade.oms.exchanges.exchange.Exchange) → bool[source]

Checks whether the order is executable on exchange.

Parameters:
  • order (Order) – An order.
  • exchange (Exchange) – The exchange to check.
Returns:

bool – Whether order is executable on exchange.

class tensortrade.oms.orders.criteria.NotCriteria(criteria: Callable[[tensortrade.oms.orders.order.Order, tensortrade.oms.exchanges.exchange.Exchange], bool])[source]

Bases: tensortrade.oms.orders.criteria.Criteria

A criteria to invert the truth value of another criteria.

Parameters:criteria (Callable[[Order, Exchange], bool]) – The criteria to invert the truth value of.
check(order: tensortrade.oms.orders.order.Order, exchange: tensortrade.oms.exchanges.exchange.Exchange) → bool[source]

Checks whether the order is executable on exchange.

Parameters:
  • order (Order) – An order.
  • exchange (Exchange) – The exchange to check.
Returns:

bool – Whether order is executable on exchange.

class tensortrade.oms.orders.criteria.Stop(direction: Union[tensortrade.oms.orders.criteria.StopDirection, str], percent: float)[source]

Bases: tensortrade.oms.orders.criteria.Criteria

An order criteria that allows execution when the quote price for a trading pair is above or below a specific price.

Parameters:
  • direction (Union[StopDirection, str]) – The direction to watch for the stop criteria.
  • percent (float) – The percentage of the current price to use for watching.
check(order: tensortrade.oms.orders.order.Order, exchange: tensortrade.oms.exchanges.exchange.Exchange) → bool[source]

Checks whether the order is executable on exchange.

Parameters:
  • order (Order) – An order.
  • exchange (Exchange) – The exchange to check.
Returns:

bool – Whether order is executable on exchange.

class tensortrade.oms.orders.criteria.StopDirection[source]

Bases: enum.Enum

An enumeration for the directions of a stop criteria.

DOWN = 'down'
UP = 'up'
class tensortrade.oms.orders.criteria.Timed(duration: float)[source]

Bases: tensortrade.oms.orders.criteria.Criteria

An order criteria for waiting a certain amount of time for execution.

Parameters:duration (float) – The amount of time to wait.
check(order: tensortrade.oms.orders.order.Order, exchange: tensortrade.oms.exchanges.exchange.Exchange)[source]

Checks whether the order is executable on exchange.

Parameters:
  • order (Order) – An order.
  • exchange (Exchange) – The exchange to check.
Returns:

bool – Whether order is executable on exchange.