API Support Forum
OEC API > API Support > Getting Position
Author Topic: Getting Position
(4 messages, Page 1 of 1)
Moderators: VPfau
AGagnon
Posts: 10
Joined: Jun 15, 2016


Posted: Oct 03, 2016 @ 11:58 AM             Msg. 1 of 4
I'm a bit confused as to how to get the position, and check to see if it has been filled yet. Could someone point me to an example code please? My algo focuses on the ES.
Alex Gagnon
CMicciche902
Posts: 348
Joined:


Posted: Oct 03, 2016 @ 12:11 PM             Msg. 2 of 4
Did you send a buy or sell order to open a position? Refer to the Trading examples: https://gainfutures.com/api/html/9900566b-260a-4247-8326-9698b013e7b8.htm
Chris M
AGagnon
Posts: 10
Joined: Jun 15, 2016


Posted: Dec 29, 2016 @ 07:53 PM             Msg. 3 of 4
This is for a bot that needs to find out for itself, if there is an open position. So there could be an open position, or there may not be one at all. My bot is going to be trading the ES exclusively.

Is this what I need? OEC.API.Account.AvgPositions.Count

Do positions come in int form? If I was long 4 contracts, would it be 4? Would being short 6 contracts be -6?
Alex Gagnon
CMicciche902
Posts: 348
Joined:


Posted: Dec 30, 2016 @ 09:01 AM             Msg. 4 of 4
Take a look at our Samples app to understand how to obtain position information. We also provide source code of the Samples at: https://bitbucket.org/GainFuturesDev/advancedexample/src/2f828076ce7bd06a3b0737eb8d243384af3b745f/AveragePositionsControl.cs?at=master&fileviewer=file-view-default

Net Pos will report positive number for long position, and negative number for short position.
Chris M