The DEMOFEED application is a simplified data server. It supports multiple clients on a single computer, with updates shared between all clients.
The feed is not designed to be scalable, extensible or robust. It is designed only for demonstration purposes.
Commands
The following commands are supported:
Command | Description |
---|---|
GET | Gets a single data item (which may be scalar or array) |
SET | Sets a single data item |
FIND | Gets a list of securities whose codes match the search string |
ADVISE | Registers interest in a single data item, so that the client will receive an update message whenever the value changes. |
UNADVISE | Unregisters interest in a data item, so that update messages for the item are no longer sent to the client. |
GET_UPDATES | Gets all queued update messages concerning changes to items in which the client has registered interest. |
SAVE_DATA | Saves all data from the database to a text file |
RESTORE_DATA | Restores saved data from a text file, optionally clearing all current data |
Fields
The feed server contains a small in-memory database of securities. The table below lists the fields available for each security.
ID | Name | Type | Description |
---|---|---|---|
0 | Code | String | Unique code for security |
1 | Name | String | Name of security |
2 | Bid | Floating-point | Latest bid price |
3 | Ask | Floating-point | Latest ask price |
4 | Series | Vector of floating-point | Series of traded prices |
5 | Latency | Integer | The number of milliseconds the feed should delay before responding to GET commands for the security. |
6 | Dictionary | List | Data dictionary. (This is only available if the security code is "!".) |
API
The client API for the feed consists of a single class, FeedConnection, which supports two-way communication with the feed. The application and its client API are self-contained, and do not rely in the XLL+ run-time libraries.
The methods are summarized below.
Database
The demo feed server loads an initial data set from a data file if one is specified on the command line. If no data file is specified, or if the specified data file is not found, the following data-set is loaded:
Code | Name | Bid | Ask | Series | Latency |
---|---|---|---|---|---|
MGC | MegaCorp | 100 | 101.5 | 99.0;99.5;101.0;100.0;100.25 | 0 |
CD | Cheesedale | 50 | 52 | 49.0;49.5;51.0;50.0;50.25 | 0 |
Usage
To run the data server, run it at the command-line, e.g.:
DATAFEEDOptionally, specify a data file in the same directory as the file DATAFEED.EXE:
DATAFEED -o data2.txtYou can specify the level of information written to the command line using the –l option. The level should be ERROR, WARNING, INFO, DEBUG or TRACE.
DATAFEED -l INFOTo stop the data server, just type Control+C at the command-line.