HELP opening 2 positions Long/short

Environment

Language
Python 3

Alpaca SDK Version
latest alpaca sdk

Hello everyone, now this may seem like a weird thing to want to do but I want too anyway haha:
I want to open 2 positions in the same stock, one short and one long.
So in summary I want one long and one short position in the same stock at the same time.
However Obviously when I buy a share and then go to short it I am essentially just closing the original position. Could anyone suggest a way in which to do this?

This wouldn’t make sense, but you also seem to already know that going long a stock and going short the same stock in equal quantity is an offsetting position.

If your goal is to be long 100 shares and short 75, you’d also be better off just being long 25 shares.

You may be thinking of various options strategies where you can be long / short the underlying at different strike prices to profit either between those strikes or outside of those strikes. These strategies are unique to options though, and not applicable to stocks.

This is easy.You just need a layer of abstraction. In Python you could use dictionaries to keep track of the separate positions/weights such as:
target_portfolio1 = {‘MSFT’ : 1}
target_portfolio2 = [‘MSFT’ : -1}

Then before ordering, you’d just add target_portfolio1 to garget_portfolio2 and subtract your current positions from that sum to arrive at the amount you need to order. In this case, you should arrive as a 0 as the target weight for MSFT.