So I see that to make a fractional buy, I run this (from alpaca-py):
market_order_data = MarketOrderRequest(
symbol=ticker,
notional=100,
side=OrderSide.BUY,
time_in_force=TimeInForce.DAY
)
Which will create a purchase order for $100 worth of “ticker” but on the other side, how does a sale work when it’s notional?
For instance, if I buy $100 worth of AAPL and then it runs up 10% and I want to sell all of it, do I need to run the below command?
market_order_data = MarketOrderRequest(
symbol='AAPL',
notional=110,
side=OrderSide.SELL,
time_in_force=TimeInForce.DAY
)
In which case, do I have to keep track of the dollar value of the security within my algorithm in order to submit the appropriate notional sales amount? Or is there a way to “sell-all” for a security?
Also let’s say that my investment in AAPL goes up to $109.32, do I also need to ensure I’m using the correct sig figs when rounding?