Author |
Topic: Getting Position (4 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
AGagnon Posts: 10 Joined: Jun 15, 2016 |
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: 367 Joined: |
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 |
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: 367 Joined: |
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
|
||||