# Close position by client\_order\_id?

**URL:** https://forum.alpaca.markets/t/close-position-by-client-order-id/7643
**Category:** Alpaca Account Troubleshooting
**Created:** [December 7, 2021, 2:48pm UTC](https://forum.alpaca.markets/t/close-position-by-client-order-id/7643 "2021-12-07T14:48:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![inkheist](https://avatars.discourse-cdn.com/v4/letter/i/7993a0/32.png) [@inkheist](https://forum.alpaca.markets/u/inkheist)
#### Post date: [December 7, 2021, 2:48pm UTC](https://forum.alpaca.markets/t/close-position-by-client-order-id/7643/1 "2021-12-07T14:48:38Z")

</div>

## Environment

**Language**  
Python

**Alpaca SDK Version**  
v2

**Other Environment Details**  
running flask and gunicorn on heroku, not sure it’s relevant.

## Problem

**Summary**

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?**  
Paper

---

<div class="post-metadata">

### Author: ![inkheist](https://avatars.discourse-cdn.com/v4/letter/i/7993a0/32.png) [@inkheist](https://forum.alpaca.markets/u/inkheist)
#### Post date: [January 15, 2022, 10:39pm UTC](https://forum.alpaca.markets/t/close-position-by-client-order-id/7643/2 "2022-01-15T22:39:29Z")

</div>

Anyone have any ideas on this? I’ve moved to just using multiple account, but honestly it’s kinda unwieldly at scale.

---

<div class="post-metadata">

### Author: ![machpa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/machpa/32/3508_2.png) [@machpa](https://forum.alpaca.markets/u/machpa)
#### Post date: [January 17, 2022, 12:55am UTC](https://forum.alpaca.markets/t/close-position-by-client-order-id/7643/3 "2022-01-17T00:55:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![talipini](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/talipini/32/3704_2.png) [@talipini](https://forum.alpaca.markets/u/talipini)
#### Post date: [February 10, 2022, 12:43pm UTC](https://forum.alpaca.markets/t/close-position-by-client-order-id/7643/4 "2022-02-10T12:43:01Z")

</div>

@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?
