# Has the button of "Exit AtMarket And Cancel" API endpiont?

**URL:** <https://community.tradovate.com/t/has-the-button-of-exit-atmarket-and-cancel-api-endpiont/4458>\
**Category:** API Developers\
**Created:** [April 16, 2022, 8:55am UTC](https://community.tradovate.com/t/has-the-button-of-exit-atmarket-and-cancel-api-endpiont/4458 "2022-04-16T08:55:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhangdc007](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/zhangdc007/32/1792_2.png) [@zhangdc007](https://community.tradovate.com/u/zhangdc007)\
**Post date:** [April 16, 2022, 8:55am UTC](https://community.tradovate.com/t/has-the-button-of-exit-atmarket-and-cancel-api-endpiont/4458/1 "2022-04-16T08:55:04Z")

</div>

Exit AtMarket And Cancel is a good action ,but I has no found in api doc, If I need user it ,I must Implement it by cancel the pending orders and clear position by placse order endpoint?

---

<div class="post-metadata">

**Author:** ![Alexander](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/alexander/32/988_2.png) [@Alexander](https://community.tradovate.com/u/Alexander)\
**Post date:** [April 18, 2022, 2:00pm UTC](https://community.tradovate.com/t/has-the-button-of-exit-atmarket-and-cancel-api-endpiont/4458/2 "2022-04-18T14:00:15Z")

</div>

Yes, what the Trader Application does to accomplish this is iterate over all a user’s open positions and attempt to liquidate them using the `/order/liquidatePosition` endpoint ([docs](https://api.tradovate.com/#operation/liquidatePosition)).

---

<div class="post-metadata">

**Author:** ![zhangdc007](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/zhangdc007/32/1792_2.png) [@zhangdc007](https://community.tradovate.com/u/zhangdc007)\
**Post date:** [April 20, 2022, 3:22pm UTC](https://community.tradovate.com/t/has-the-button-of-exit-atmarket-and-cancel-api-endpiont/4458/3 "2022-04-20T15:22:59Z")

</div>

I try ,but it Access denied

```auto
 send:order/liquidateposition body:{"accountId":xxx,"contractId":2553028,"admin":true} error:"Access is denied"

```

My be is the device Id not Aprove?

---

<div class="post-metadata">

**Author:** ![Alexander](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/alexander/32/988_2.png) [@Alexander](https://community.tradovate.com/u/Alexander)\
**Post date:** [April 20, 2022, 3:35pm UTC](https://community.tradovate.com/t/has-the-button-of-exit-atmarket-and-cancel-api-endpiont/4458/4 "2022-04-20T15:35:24Z")

</div>

Try it with `"admin": false` instead and let me know if that works.

---

<div class="post-metadata">

**Author:** ![zhangdc007](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/zhangdc007/32/1792_2.png) [@zhangdc007](https://community.tradovate.com/u/zhangdc007)\
**Post date:** [April 20, 2022, 4:58pm UTC](https://community.tradovate.com/t/has-the-button-of-exit-atmarket-and-cancel-api-endpiont/4458/5 "2022-04-20T16:58:54Z")

</div>

user admin =false, it worked in demo model ,Thanks

---

<div class="post-metadata">

**Author:** ![Clayhams](https://avatars.discourse-cdn.com/v4/letter/c/4af34b/32.png) [@Clayhams](https://community.tradovate.com/u/Clayhams)\
**Post date:** [September 25, 2024, 3:20am UTC](https://community.tradovate.com/t/has-the-button-of-exit-atmarket-and-cancel-api-endpiont/4458/6 "2024-09-25T03:20:59Z")

</div>

Is there a function that only closes the pending positions or positions in status “working”? Versus closing the pending orders and liquidating the positions?
