Build a Sell Order¶
Helper for creating a sell order
-
analysis_engine.build_sell_order.
build_sell_order
(ticker, num_owned, close, balance, commission, date, details, use_key, minute=None, shares=None, version=1, auto_fill=True, is_live_trading=False, backtest_shares_default=10, reason=None)[source]¶ Create an algorithm sell order as a dictionary
Parameters: - ticker – ticker
- num_owned – integer current owned number of shares for this asset
- close – float closing price of the asset
- balance – float amount of available capital
- commission – float for commission costs
- date – string trade date for that row usually
COMMON_DATE_FORMAT
(YYYY-MM-DD
) - minute – optional - string with the minute that the
order was placed. format is
COMMON_TICK_DATE_FORMAT
(YYYY-MM-DD HH:MM:SS
) - details – dictionary for full row of values to review
all sells after the algorithm finishes.
(usually
row.to_json()
) - use_key – string for redis and s3 publishing of the algorithm result dictionary as a json-serialized dictionary
- shares – optional - integer number of shares to sell
if None sell all
num_owned
shares at theclose
. - version – optional - version tracking integer
- auto_fill – optional - bool for not assuming the trade
filled (default
True
) - is_live_trading – optional - bool for filling trades
for live trading or for backtest tuning filled
(default
False
which is backtest mode) - backtest_shares_default – optional - integer for
simulating shares during a backtest even if there
are not enough funds
(default
10
) - reason – optional - string for recording why the algo decided to sell for review after the algorithm finishes