Alpaca SDK Version
Other Environment Details
running flask and gunicorn on heroku, not sure it’s relevant.
I’m trying to close a specific position instead of all positions. I don’t want to close all positions with a specific symbol because that’s not part of my strategy, just close ones with a specific client_order_id
Paper or Live Tradng?
Anyone have any ideas on this? I’ve moved to just using multiple account, but honestly it’s kinda unwieldly at scale.
What do you mean specific position? In Alpaca, for one asset, there is always only one position, no matter how many orders you fill. all are added into one. I also have different broker and there are positions of the same symbol/asset which you can close sepratelly, so I think I know what you mean. I solved this in my app by maintaining my own “virtual” positions.
@Machpa - even if you maintain your own virtual position, there isnt a way to close a particular lot, is there? For tax harvesting, we need to close specific lot or positions originated from specific client_order_id. I am baffled that I cannot find a way to specific which cost basis I want to close. Did you find anything?