Introduction to CLI
What is CLI?
CLI (Command Line Interface) allows you to run and interact with StrategyQuant / QuantDataManager from command line. It ca be used to run SQ / QDM from batch scripts and external programs.
Note – improved CLI is avaiable in StrategyQuant from Build 127. There is a more limited set of commands in earlier versions and in QDM for the moment.
Our focus with CLI is to make it fully featured way to interact with the program, so that you can control SQ / QDM using the commands from external scripts or external programs.
SQ CLI is available as a new sqcli.exe in StrategyQuant installation folder.
Running from command line
You can execute a CLI command from command line or batch file. For example the following command will run CLI command to update all the data
sqcli.exe -data action=update
and then it finishes.
Running in interactive mode
Start sqcli.exe without any parameters. It wil open CLI window:
When CLI is started this way it will start StartegyQuant engine in the backgroound, without an user interface. You can type commands to perform, for example typing
updates all the data.
Type -h to list all the available commands.
When closing interactive CLI please use command -exit so that it exits correctly.
Redirecting output to a file
when you execute some command you might want to log the output. There is a special command > filename for that.
Example in command line CLI:
sqcli.exe -symbol action=list > C:/reports/output.log
The same in interactive CLI:
-symbol action=list > C:/reports/output.log
Running multiple commands
When you want to run multiple consecutive commands, you can use a special command -run filename
which will load and execute all the CLi commands in the filename.
You can start it for example like:
sqcli.exe -run file=C:/commands.txt
and the file C:/commands.txt can contain multiple CLI commands separated by line that will be executed one by one:
-data action=update -symbol action=list > C:/symbols.log -databank action=list project=Builder > C:/databanks.log