SmartQuant Discussion
http://www.smartquant.com/forums/

Calling current quantity of contract held through BrokerInfo
http://www.smartquant.com/forums/viewtopic.php?f=44&t=9693
Page 1 of 1

Author:  RedEye [ Fri Sep 16, 2011 9:40 pm ]
Post subject:  Calling current quantity of contract held through BrokerInfo

Could someone assist me by showing a code example:
Program only trades one underlying at a time.
Aim is to pull the quantity currently long or short through "getBrokerInfo" call or some other OpenQuant call.

I would like to be able to call the quantity currently held of the underlying into a double variable such as:

positionSize = BrokerInfo.BrokerPosition(); <---This is the line which is incorrect and I can't tell from the API docs how to finish.
Console.WriteLine("{0},... {1}", PnL, positionSize);

Thanks for the assistance!
Red

Author:  Alexei Kurov [ Sun Sep 18, 2011 8:11 pm ]
Post subject:  Re: Calling current quantity of contract held through Broker

Hi,

Code:
positionSize = brokerInfo.Accouns["<account>"].Positions["<symbol>"].Qty;

Author:  RedEye [ Mon Sep 19, 2011 12:22 am ]
Post subject:  Re: Calling current quantity of contract held through Broker

excellent, thank you for the example. :)

Red

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/