API Support Forum
OEC API > API Support > "Close" & "Close All" API calls
Author Topic: "Close" & "Close All" API calls
(3 messages, Page 1 of 1)
Moderators: VPfau
PArnoldson
Posts: 154
Joined: Oct 03, 2007


Posted: Nov 09, 2011 @ 01:18 PM             Msg. 1 of 3
Is there a “close position” or “close all” functionality through the api? Meaning when the client wants to simply close all (both open orders & pending orders) and reduce risk they would click a “close all” that would simply cancel all working orders and close any/all open positions without the oec system needing to check to see if they have sufficient margin because the system already knows they are attempting to reduce risk and close/cancel all open positions & pending orders. Currently when people close an open order we simply buy/sell in the opposite direction, but the OEC system occasionally rejects the order and gives a “risk violation” because it doesn’t recognize the trader is simply trying to get flat and reduce risk by closing out their current open position. So, is there a “close open position call” and a “close all” (would close all open/pending orders) call available through the API to avoid “risk violation – insufficient margin” error/rejection messages?

A bus station is where a bus stops. A train station is where a train stops. On my desk I have a work station.....
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Nov 09, 2011 @ 02:34 PM             Msg. 2 of 3
There is no such methods. Before sending an exit order, application should take care about the current open orders: it should cancel them and wait for completed/cancelled statuses.

Victor Vins
Lead Software Developer
eo707
Posts: 68
Joined: Nov 08, 2011


Posted: Feb 27, 2012 @ 11:04 PM             Msg. 3 of 3
Can you affirm that I can find open orders from the number of bought vs the sold???

oec.Accounts.First.AvgPositions.First.Long.Volume
oec.Accounts.First.AvgPositions.First.Short.Volume

if the numbers of Long VS Short is the same, there is no chance that I do have open position somewhere?

I find myself having open positions....
Thank you.