Enablements Required:
CQG API Streaming, CQG API Trading
- Create a new project.
- Add COM reference to CQG 4.0 Type Library - Revised.
- Create the CQGCEL object.
- Configure the CQGCEL object using CQGCEL.APIConfiguration.
If your application is always available to receive CQGCEL events; set CQGAPIConfig.ReadyStatusCheck to rscOff.
The ReadyStatusCheck is commonly used if the application has compute-intensive work and will not respond promptly or if it is used from MS Excel. In these cases, set CQGAPIConfig.ReadyStatusCheck to rscOn and handle the CQGCEL.IsReady event. - Start the CQGCEL by calling the CQGCEL.Startup method.
- Wait for the CQGCEL.CELStarted event. If CQGIC is not started, a CQGCEL.DataError event will be fired, notifying about that.
- Handle the CQGCEL.GWConnectionStatusChanged event. GW Connection status will be changed upon logging in/out of the Gateway account from within CQGIC.
- After the CQGCEL.GWConnectionStatusChanged event returns csConnectionUp, set the AccountSubscriptionLevel to aslAccountsAndUpdates.
- When the GW Account subscription level change succeeds, the CQGCEL.AccountChanged event is fired where the change parameter is actAccountsReloaded, and corresponding CQGAccount objects are created in the CQGAccounts collection.
- In order to have the account's OTE/MVO information calculated in real-time, set the CQGAccount.AutoSubscribeInstruments to True.
- To receive updates on positions for a particular account, set CQGAccount.PositionSubcriptionLevel property for that account to pslSnapshotAndUpdates.
- To receive updates on positions for all accounts; before calling the CQGCEL.Startup method, set APIConfiguration.DefPositionSubscriptionLevel to pslSnapshotAndUpdates.
- You can receive the account’sOTE/MVO values through the CQGAccountSummary interface.
- You can also receive a position’s OTE/MVO values through the CQGPosition interface.
- When the data connection is down, OTE/MVO will not be updated. Handle the CQGCEL.DataConnectionStatusChanged event to notify the user about that.
- When the position subscription level change succeeds, the CQGCEL.AccountChanged event is fired where the change parameter is actPositionsReloaded,and corresponding CQGPosition objects are created in the CQGAccount.CQGPositions collection.
- Handle the CQGCEL.AccountChanged event to monitor the account and position properties.