| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Datafeed Toolbox |
| Contents | Index |
| Learn more about Datafeed Toolbox |
D = fetch(K,KSQL)
D = fetch(K,KSQL,P1,P2,P3)
| K | Kx Systems, Inc. kdb+ connection object created with the kx function. |
| KSQL | The Kx Systems, Inc. kdb+ command. |
| P1,P2,P3 | Input parameters for the KSQL command. |
D = fetch(K,KSQL) returns data from a Kx Systems, Inc. kdb+ database in a MATLAB structure where K is the Kx Systems, Inc. kdb+ object and KSQL is the Kx kdb+ command. KSQL can be any valid kdb+ command. The output of this method is any data resulting from the command specified in KSQL.
D = fetch(K,KSQL,P1,P2,P3) executes the command specified in KSQL with one or more input parameters, and returns the data from this command.
Run the following command from a DOS prompt to specify the port number 5001:
q tradedata.q -p 5001
Connect to a Kx Systems, Inc. server using IP address LOCALHOST and port number 5001:
K = kx('localhost',5001);
Retrieve data using the command select from trade:
D = fetch(K,'select from trade');
D =
sec: {5000x1 cell}
price: [5000x1 double]
volume: [5000x1 int32]
exchange: [5000x1 double]
date: [5000x1 double]
Retrieve data, passing an input parameter 'ACME' to the command select from trade:
D = fetch(K,'totalvolume','ACME');
D =
volume: [1253x1 int32] This is the total trading volume for the security ACME in the table trade. The function totalvolume is defined in the sample Kx Systems, Inc. kdb+ file, tradedata.q.
![]() | kx.close | kx.get | ![]() |
View demos and recorded presentations led by industry experts.
Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |