iqf

IQFEED Desktop API connection

Description

The iqf function creates an iqf object. The iqf object represents an IQFEED® Desktop API connection.

After you create an iqf object, you can use the object functions to retrieve intraday, historical, and news data. You can also retrieve level 1 and 2 data.

Creation

Syntax

c = iqf(username,password)
c = iqf(username,password,portname)

Description

example

c = iqf(username,password) starts IQFEED or makes a connection to an existing IQFEED session, and sets the User and Password properties.

example

c = iqf(username,password,portname) uses a port identifier for the IQFEED connection.

Note

Only one IQFEED connection can be open at a time.

Input Arguments

expand all

Port identifier for the socket connection, specified as a character vector or string scalar.

Data Types: char | string

Properties

expand all

User name, specified as a character vector or string scalar. For credentials, contact IQFEED.

Example: 'username'

Data Types: char | string

Password, specified as a character vector or string scalar. For credentials, contact IQFEED.

Example: 'pwd'

Data Types: char | string

Port, specified as a cell array that contains a Microsoft® .NET Framework Socket object.

Example: {[1×1 System.Net.Sockets.Socket]}

Data Types: cell

Port identifier, specified as a cell array that contains a character vector or string scalar. The text specifies the port for the socket connection.

The iqf function sets this property using the portname input argument.

Data Types: cell

Protocol, specified as a double. The protocol specifies the IQFEED version, which determines the format for the return data.

When you create an iqf object, the iqf function leaves this property unset. Set this value manually at the command line using dot notation. For example, to set the protocol to IQFEED version 5.1, enter:

c.Protocol = 5.1;

Data Types: double

Object Functions

closeClose IQFEED ports
historyIQFEED asynchronous historical end-of-period data
newsIQFEED asynchronous news data
marketdepthIQFEED asynchronous level 2 data
realtimeIQFEED asynchronous level 1 data
timeseriesIQFEED asynchronous intraday tick data

Examples

collapse all

Create an IQFEED connection. Then, retrieve historical daily data for a security. The historical data you see when completing this example can differ from the output data shown.

Create an IQFEED connection with the user name username and password pwd. The iqf object c appears in the MATLAB® workspace.

username = 'username';
password = 'pwd';
c = iqf(username,password)
c = 

  iqf with properties:

        User: 'username'
    Password: 'pwd'
        Port: {[1×1 System.Net.Sockets.Socket]}
    PortName: {'Admin'}
    Protocol: []

Retrieve the Google® security data for the last five days.

history(c,'GOOG',5)

history returns the data in the MATLAB cell array IQFeedHistoryData.

Display the returned data in IQFeedHistoryData.

IQFeedHistoryData
IQFeedHistoryData = 

    '2013-11-21 11:08:58'    '1038.31'    '1026.00'    '1027.00'    '1034.07'    '1092497'    '0'
    '2013-11-20 11:08:58'    '1033.36'    '1020.36'    '1029.95'    '1022.31'    '965535'     '0'
    '2013-11-19 11:08:58'    '1034.75'    '1023.05'    '1031.72'    '1025.20'    '1131619'    '0'
    '2013-11-18 11:08:58'    '1048.74'    '1029.24'    '1035.75'    '1031.55'    '1760249'    '0'
    '2013-11-15 11:08:58'    '1038.00'    '1030.31'    '1034.87'    '1033.56'    '1277772'    '0'

Each row of data represents one day. The columns in IQFeedHistoryData contain the following:

  • Date and time

  • High price

  • Low price

  • Open price

  • Closing price

  • Volume

  • Open interest

Close the IQFEED connection.

close(c)

Create an IQFEED connection using a port identifier. Then, retrieve historical daily data for a security. The historical data you see when completing this example can differ from the output data shown.

Create an IQFEED connection with the user name username, password pwd, and port identifier Admin. The iqf object c appears in the MATLAB workspace.

username = 'username';
password = 'pwd';
portname = 'Admin';
c = iqf(username,password,portname)
c = 

  iqf with properties:

        User: 'username'
    Password: 'pwd'
        Port: {[1×1 System.Net.Sockets.Socket]}
    PortName: {'Admin'}
    Protocol: []

Retrieve the Google security data for the last five days.

history(c,'GOOG',5)

history returns the data in the MATLAB cell array IQFeedHistoryData.

Display the returned data in IQFeedHistoryData.

IQFeedHistoryData
IQFeedHistoryData = 

    '2013-11-21 11:08:58'    '1038.31'    '1026.00'    '1027.00'    '1034.07'    '1092497'    '0'
    '2013-11-20 11:08:58'    '1033.36'    '1020.36'    '1029.95'    '1022.31'    '965535'     '0'
    '2013-11-19 11:08:58'    '1034.75'    '1023.05'    '1031.72'    '1025.20'    '1131619'    '0'
    '2013-11-18 11:08:58'    '1048.74'    '1029.24'    '1035.75'    '1031.55'    '1760249'    '0'
    '2013-11-15 11:08:58'    '1038.00'    '1030.31'    '1034.87'    '1033.56'    '1277772'    '0'

Each row of data represents one day. The columns in IQFeedHistoryData contain the following:

  • Date and time

  • High price

  • Low price

  • Open price

  • Closing price

  • Volume

  • Open interest

Close the IQFEED connection.

close(c)

Introduced in R2012b