To describe the SOBI strategy family more precisely, we need to introduce some terminology.
Note that Si and Bi will always be positive numbers. They can be interpreted as a measure of the "distance" from the last price of the top i*25% of the respective order book.
1. Basic SOBI. The basic SOBI strategy perpetually
computes Si and Bi and places buy or sell orders according to the
following rules:
If (Si - Bi > theta),
place an order to buy orderVolume shares at (lastPrice-orderPrice);
If (Bi - Si > theta), place
an order to sell orderVolume shares at (lastPrice+orderPrice);
We refer to SOBI as a family of strategies because we leave the choices of i=1,2,3,4, theta, orderPrice, and orderVolume as parameters.
2. Hedging SOBI. Here we introduce a new parameter hedgeOrderPrice, the "hedge" parameter.
If (Si - Bi > theta),
place an order to buy orderVolume shares at (lastPrice-orderPrice);
and also place an order to sell orderVolume shares at (lastPrice+hedgeOrderPrice);
If (Bi - Si > theta), place
an order to sell orderVolume shares at (lastPrice+orderPrice);
and also place an order to buy orderVolume shares at (lastPrice-hedgeOrderPrice);
Thus, the most recent goodies will generally be available in directory /home/pxs/bin on gradient. We thus now recommend that you execute pxs and sobi using the following commands:
Some comments and explanation on the command syntax:
Notes:
1. to avoid port
collision,
users must use only their assigned port numbers!
mkearns 9586 0.1 0.2 2552 2032 pts/81 S 08:13:55 0:01 ./pxs -p 9800
mkearns 10272 0.1 0.1 976 744 pts/81 S 08:18:17 0:00 grep pxs
This simply indicates that among all users, there are two jobs running involving the string "pxs". One of these is the ps command itself, but the other, number 9586, is a simulator job. This job can be terminated by the command kill -9 9586. You can learn more about ps via doing "man ps".
set terminal postscript
set output "foo.ps"
plot "foo.dat" with lines
set terminal x11
set output
Please, read below for more information.
To make gnuplot to write the plot in "postscript" format, just execute the following command in the gnuplot interpreter
set terminal postscript
We also want gnuplot to write the plot to a file. To write to file "foo.ps", type
set output "foo.ps"
Finally, to plot the data file "foo.dat" as a line, type
plot "foo.dat" with lines
Note that when we execute this command, the plot will not be shown as an X window, since we have changed the terminal. So we'll not really see what we are plotting and the current X window will not refresh. The idea is that before we changed the terminal and output, we had plotted the data to the X windows already. The command will instead generate a file "foo.ps" that is a postscript version of the plot. You can then use an external postscript viewer like 'gv' (outside gnuplot!) to display and print the postscript file. When done plotting to the file, we want to get back to the default values for terminal and output in gnuplot. To do this, type
set terminal x11
set output
This will set the terminal so that future plots will be shown in the screen and the output will be written to the X window terminal where gnuplot is running, as it was before we decided to plot to a postscript file. This is important since if the terminal or the output is not changed, gnuplot will keep writting future plots to the output file in the terminal format specified!
One way to know the current setting of these options is by executing the command 'show'. For instance,
show terminal
show output
displays information about the current settings of the terminal and output options, respectively. Similarly with other options.
Yet, another way of doing all this in one step is by writing a "gnuplot script"---a file containing a sequence of gnuplot commands. For instance, let's say we write a file, called it 'plotps.gnu', with the following lines
set terminal postscript
set output "foo.ps"
plot "foo.dat" with lines
set terminal x11
set output
Then at the gnuplot prompt ('gnuplot>'), we type
load "plotps.gnu"
This will plot the data in the file 'foo.dat' and write it to the file 'foo.ps'. So, as you can see, when using the gnuplot command 'load' with a "script" file, it will just execute the gnuplot commands sequentially as if they were entered interactively (in the same sequence) at the gnuplot prompt. In general, you can create many different scripts of this kind that suit your needs. In general, we encourage you to play with gnuplot and create your own scripts.
You can always learn more by using the help provided in gnuplot. For instance, typing
help
will display the main help menu. From there you can get additional help on different sub-topics. You can also go immediate to the help for a specific command, option, or keyword in gnuplot, by typing
help [command | option | keyword]
For example,
help plot
displays help on how the plot command works. Similarly, you can execute 'help set', 'help terminal', 'help output', 'help with', 'help lines', etc. You can also find more information, and even manuals on how to use gnuplot, by doing a web-search.
Usage: getpxs OPTION IFILE OFILE
where
OPTION : --price (extract "Last price" field values from IFILE)
IFILE : name of file containing pxs output (i.e., 'out.pxs')
OFILE : name of file where extracted data will be written out (i.e., 'price.dat')
Example usage:
getpxs --price out.pxs price.dat
writes the price of the stock throughout the execution of the simulator from the file 'out.pxs' to the file 'price.dat'.
Usage: getsobi OPTION IFILE OFILE
where
OPTION : --value (extract "Present Value" field values from IFILE), --share (extract "Share" field values), --cash (extract "Cash" field values)
IFILE : name of file containing pxs output (i.e., 'out.sobi')
OFILE : name of file where extracted data will be written out (i.e., 'value.dat')
Example usage:
getsobi --value out.sobi value.dat
writes the value of sobi trategy throughout its the execution from the file 'out.sobi' to the file 'value.dat'.