tensortrade.oms.orders.create module

tensortrade.oms.orders.create.hidden_limit_order(side: tensortrade.oms.orders.trade.TradeSide, exchange_pair: tensortrade.oms.instruments.exchange_pair.ExchangePair, limit_price: float, size: float, portfolio: tensortrade.oms.wallets.portfolio.Portfolio, start: int = None, end: int = None)[source]

Creates a hidden limit order.

Parameters:
  • side (TradeSide) – The side of the order.
  • exchange_pair (ExchangePair) – The exchange pair to perform the order for.
  • limit_price (float) – The limit price of the order.
  • size (float) – The size of the order.
  • portfolio (Portfolio) – The portfolio being used in the order.
  • start (int, optional) – The start time of the order.
  • end (int, optional) – The end time of the order.
Returns:

Order – A hidden limit order.

tensortrade.oms.orders.create.limit_order(side: tensortrade.oms.orders.trade.TradeSide, exchange_pair: tensortrade.oms.instruments.exchange_pair.ExchangePair, limit_price: float, size: float, portfolio: tensortrade.oms.wallets.portfolio.Portfolio, start: int = None, end: int = None)[source]

Creates a limit order.

Parameters:
  • side (TradeSide) – The side of the order.
  • exchange_pair (ExchangePair) – The exchange pair to perform the order for.
  • limit_price (float) – The limit price of the order.
  • size (float) – The size of the order.
  • portfolio (Portfolio) – The portfolio being used in the order.
  • start (int, optional) – The start time of the order.
  • end (int, optional) – The end time of the order.
Returns:

Order – A limit order.

tensortrade.oms.orders.create.market_order(side: tensortrade.oms.orders.trade.TradeSide, exchange_pair: tensortrade.oms.instruments.exchange_pair.ExchangePair, price: float, size: float, portfolio: tensortrade.oms.wallets.portfolio.Portfolio) → tensortrade.oms.orders.order.Order[source]

Creates a market order.

Parameters:
  • side (TradeSide) – The side of the order.
  • exchange_pair (ExchangePair) – The exchange pair to perform the order for.
  • price (float) – The current price.
  • size (float) – The size of the order.
  • portfolio (Portfolio) – The portfolio being used in the order.
Returns:

Order – A market order.

tensortrade.oms.orders.create.proportion_order(portfolio: Portfolio, source: Wallet, target: Wallet, proportion: float) → Order[source]

Creates an order that sends a proportion of funds from one wallet to another.

Parameters:
  • portfolio (Portfolio) – The portfolio that contains both wallets.
  • source (Wallet) – The source wallet for the funds.
  • target (Wallet) – The target wallet for the funds.
  • proportion (float) – The proportion of funds to send.
tensortrade.oms.orders.create.risk_managed_order(side: TradeSide, trade_type: TradeType, exchange_pair: ExchangePair, price: float, quantity: Quantity, down_percent: float, up_percent: float, portfolio: Portfolio, start: int = None, end: int = None)[source]

Create a stop order that manages for percentages above and below the entry price of the order.

Parameters:
  • side (TradeSide) – The side of the order.
  • trade_type (TradeType) – The type of trade to make when going in.
  • exchange_pair (ExchangePair) – The exchange pair to perform the order for.
  • price (float) – The current price.
  • down_percent (float) – The percentage the price is allowed to drop before exiting.
  • up_percent (float) – The percentage the price is allowed to rise before exiting.
  • quantity (Quantity) – The quantity of the order.
  • portfolio (Portfolio) – The portfolio being used in the order.
  • start (int, optional) – The start time of the order.
  • end (int, optional) – The end time of the order.
Returns:

Order – A stop order controlling for the percentages above and below the entry price.