CQG API 4.0 - Revised
Balance Method
See Also  Send Feedback
day_

The desired day represented as Long:

day_ = 0 (Default): Means "today/current"

day_ > 0: Means "historical value for the specified day back": day_ = 1 (one day back) i.e. "yesterday close", 2 (two days back) i.e. "the day-before-yesterday close" etc.

CQGAccountSummary Interface : Balance Method

Glossary Item Box

Description

Returns the account balance.

Syntax

Visual Basic
Public Function Balance( _
   Optional ByVal day_ As Long = 0 _
) As Double

Parameters

day_

The desired day represented as Long:

day_ = 0 (Default): Means "today/current"

day_ > 0: Means "historical value for the specified day back": day_ = 1 (one day back) i.e. "yesterday close", 2 (two days back) i.e. "the day-before-yesterday close" etc.

Return Type

Balance value represented as Double.

If the requested day_ parameter is 0, the returned value will be based on the current positions.

If the requested day_ parameter is higher than 0, the "close balance" of the requested day will be returned.

If no data is available for the requested day an invalid value will be returned.

Remarks

If the account summary was requested through CQGCEL.QuerySummariesStatement, (which has its Date_ parameter specified) day_ will be ignored.

Note: In this release only one day back (i.e., "yesterday close") value is available.

The balance calculation for the current day adds the previous day's close and the current profit loss. It means that balance calculation requires market data for each instrument in the positions. To subscribe to the necessary market data automatically, set CQGAccount.AutoSubscribeInstruments property value to True and CQGAccount.PositionSubcriptionLevel to ePositionSubscriptionLevel.pslSnapshotAndUpdates.

Example

See the usage of Balance method in the AccountChanged event's example section.

See Also