API Support Forum
OEC API > New Feature Requests > Request: Add OECAPI()->ClosePosition() function
Author Topic: Request: Add OECAPI()->ClosePosition() function
(4 messages, Page 1 of 1)
Moderators: VPfau
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Mar 19, 2014 @ 10:20 PM             Msg. 1 of 4
We're users of the COM api. We'd love it if the api had an OECAPI()->ClosePosition() function. Here's a couple reasons:

1) We have a customer in the Far East (.5 second round trip average on his pings of US servers) who is occasionally getting his positions reversed instead of closed. We're still troubleshooting, but it appears that the message queue is getting a bit backed up when his charts are really moving. Of course it's our responsibility, not that of the COM api, to do the right thing in this situation. Its possible he sends an event to close his position, and after a brief time, he send its again. When the msg queue gets around to it, it sends both the orders created, and so the position reverses. (Just a theory.) If we had a ClosePosition() method, it would eliminate the issue.

2) A better reason is that when a customer is trying to close his position and his account is below the margin requirement, he can't execute the order that would close his position for lack of margin. We wonder why there has to be a margin check if one is closing out a position.

Meanwhile, I confirm that we follow the example code provided in the api documentation for closing positions, in particular the PlaceExitOrder function. (SeeUseful Code Snippets: Closing Position)

Do you think there's any possibility of adding such a method in the future?

Thanks,

CHW
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Jul 07, 2014 @ 12:43 PM             Msg. 2 of 4
I haven't heard anything back from OEC devs forum about this request.

Is there any way OEC could provide a ClosePosition function in the api?

In the current way of closing a position, the user's margin is counted against them when they are simply trying to close out a position. Therefore, closing a position can fail for lack of margin.

The ClosePosition function would avoid such a margin check, so positions can be closed out when the customer's balance is too low to pass the margin check.

Thanks,



CHW
Edited by CWeber984 on Jul 8, 2014 at 20:38:34
Edited by CWeber984 on Jul 8, 2014 at 20:40:19
RVinicky
-Administrator-
Posts: 62
Joined:


Posted: Jul 08, 2014 @ 09:12 PM             Msg. 3 of 4
I will place your request (We'd love it if the api had an OECAPI()->ClosePosition() function) in jira and it will be reviewed for development along with our other clients requests when time permits in our schedule.

Thank you,

Robert Vinicky
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Jul 21, 2015 @ 04:16 AM             Msg. 4 of 4
Feature Request:
A year has passed since we submitted this feature request. We continue to need and want this feature, and think about it often. So we are updating our existing feature request for a ClosePosition function that closes out the exact qty for an existing position.

Reason For Request:
We like to close out an existing position, and perhaps place a MKT order in the opposite direction. Due to slow fills, the close position function is far more reliable than simply placing an offsetting order and waiting for it to fill. We like to place orders sometimes faster than once a second, and the slow fills make it impossible to accurately count the qty of the existing position when the fills are slower than that second duration. Conversely, given a close position function, we are assured that we are not over-counting and over-placing orders, and we don't have to wait for slow fills to fill before placing our next order.

Kindly let us know if you've been able to review the request, and if so, if it has been selected for development. If not, could you let us know when you might review this feature request?

Thanks,
Edited by CWeber984 on Jul 21, 2015 at 04:17:10