How do I connect to CQG realtime data?

2 visualizzazioni (ultimi 30 giorni)
Clayton Leung
Clayton Leung il 5 Ago 2021
Risposto: Anavi Somani il 15 Giu 2023
I have an active CQG Trader account.
I have follow the instruction on this Link to setup my CQG connection with Matlab.
After that, i have follow the instruction on this page to setup the realtime data:
c = cqg
c =
cqg with properties:
Handle: [1×1 COM.CQG_CQGCEL_4]
APIConfig: [1×1 Interface.C3E14FEA_ED20_478B_...]
c.APIConfig.TimeZoneCode = 'tzEastern';
startUp(c)
eventNames = {'CELStarted','DataError','IsReady', ...
'DataConnectionStatusChanged','GWConnectionStatusChanged', ...
'GWEnvironmentChanged'}
for i = 1:length(eventNames)
registerevent(c.Handle,{eventNames{i}, ...
@(varargin)cqgconnectioneventhandler(varargin{:})})
end
streamEventNames = {'InstrumentSubscribed','InstrumentChanged', ...
'IncorrectSymbol'};
for i = 1:length(streamEventNames)
registerevent(c.Handle,{streamEventNames{i}, ...
@(varargin)cqgrealtimeeventhandler(varargin{:})})
end
instrument = 'EPU21';
realtime(c,instrument)
cqgDataEZC(1,1)
Invoke Error, Dispatch Exception:
Description: Object is disposed. No method can be called.
c.Handle.NewInstrument(s)
It gives me the above error message.
How do I make it work?

Risposte (1)

Anavi Somani
Anavi Somani il 15 Giu 2023
The error message "Error using COM.CQG_CQGCEL_4/NewInstrument" typically occurs when there is a connection issue between MATLAB and the CQG realtime data servers. This error can occur due to a variety of reasons, such as network connectivity issues, a problem with the CQG server, or an issue with the credentials being used.
The error "Object is disposed. No method can be called" in the context of connecting to CQG realtime data in MATLAB using the CQG Toolbox typically indicates that the CQG session object has been disposed or closed. This could occur due to various reasons, such as network connectivity issues, invalid login credentials, or timeouts.
To resolve this error, you can try the following steps:
  1. Check your network connectivity to ensure that you are connected to the internet and that the connection is stable.
  2. Verify that your CQG API Username and Password are correct and that you have proper permissions for accessing CQG realtime data. You can contact CQG support if you have any issues or questions related to your account.
  3. Try restarting MATLAB or the CQG Toolbox and reconnect to CQG Realtime Data. Sometimes, simply restarting the application can resolve the issue.
  4. Disable firewalls: If you have a firewall enabled, it may be blocking the connection to the CQG server. You can try temporarily disabling the firewall to see if that resolves the issue.
  5. Check if the CQG server is down: Occasionally, CQG servers go down or experience issues that prevent them from functioning properly. You can check the CQG Status page to see if there are any known issues or outages.
  6. Use the clear command to clear any existing objects related to the CQG session, then try reconnecting. For example:
c = cqgconnect();
clear c
c = cqgconnect();
These steps should help you resolve the issue. If the error persists, you may need to contact CQG support for further assistance.

Prodotti


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by