PACT Consulting
12/07/2001
Please report bugs, enhancements or suggestions to sdksupport@pactconsulting.com
Contents
SDK Functions
getVersion()
SDK version 2.41
returns the SDK version # (ex: will return ‘241’ for version 2.41)
Prototype:
int getVersion(void);
Syntax:
int verNum = getVersion();
mtGetVersion()
SDK version 3.00
returns version of current SDK (same as getVersion())
Prototype:
int mtGetVersion(void);
Syntax:
int verNum = mtGetVersion();
mtInit
initialize the myTrack SDK
This function initializes the internal structures of the myTrack SDK. It must be
called before any other function is called, and it should only be called once.
It allocates input and output queues from the heap, etc. These are operations
that need be and should be done only once per run of the SDK program.
Prototype:
int mtInit(void);
Syntax:
errCode = mtInit();
This function must be called before any other function.
mtDeInit()
Deinitialize the myTrack SDK
This function deinitializes the internal structures of the myTrack SDK
Prototype:
int mtDeInit(void);
Syntax:
errCode = mtDeInit();
mtSetHost()
New for SDK version 3.00
Sets the host & port of myTrack server
Use this function to override the internally set host & port of the myTrack server
This function is primarily of interest to applications running within the myTrack environment.
Prototype:
int mtSetHost(char * host, int port);
host: name of server, must be a valid DNS name or IP address
port: port that myTrack server is listening on
Syntax:
errCode = mtSetHost(host, port);
mtSetProxy()
New for SDK version 3.00
Sets the host & port of users proxy server
Use this function if you are using tunneling AND your application is running in an environment
that only allows you to go out to the World Wide Web by way of a proxy server.
You must also turn Tunneling on (see mtSetUsingTunnel).
Prototype:
mtSetProxy(char * host, int port);
host: name of proxy server, must be a valid DNS name or IP address
port: port that proxy server is listening on
Syntax:
errCode = mtSetProxy(host, port);
mtSetUsingTunnel()
New for SDK version 3.00
Sets whether the SDK will connect through the tunnel
The SDK can connect to the myTrack servers in 2 ways, through the firewall tunneling service (TunnelThru™), and directly.
Use this function to tell the SDK which way you want to connect.
See also mtSetProxy().
Prototype:
int mtSetUsingTunnel(BOOL flag);
flag: TRUE - connect thru tunnel, FALSE - connect directly
Syntax:
mtSetUsingTunnel(TRUE);
mtIsConnected()
Determines if the SDK is connected to myTrack server. Returns TRUE if it is connected, FALSE if
it is not.
Prototype:
BOOL mtIsConnected (void);
Syntax:
if (mtIsConnected())
{
// put your conditional code here
}
mtConnectToServer()
Connect to MyTrack™ host
This function does the TCP/IP level connect() to the SDK server. If you get a
MT_ERR_NO_CONNECT error from this function, it means that the SDK server you tried to connect
to was not listening. You should make this call again, to try to connect to another of the
SDK servers.
If you are having problems with the server you are connected to, for example the login
response is not coming back, you should disconnect to break the connection to
that server and then reconnect to another server in the server farm.
Prototype:
int mtConnectToServer(void);
Syntax:
errCode = mtConnectToServer();
mtDisconnect()
Disconnect from MyTrack™ host
This function does a TCP/IP level disconnect() from the SDK server. After making this call,
you can place requests to the SDK server.
Prototype:
int mtDisconnect (void);
Syntax:
errCode = mtDisconnect();
mtGetMessage()
Read a queued message from the MyTrack™ host
The SDK has an internal thread which reads the input data from the SDK server and puts the
incoming messages on a queue. This incoming queue is also used for messages internal to the
SDK indicating exceptional conditions such as a disconnect, missing heartbeats from server,
etc. This function mtGetMessage() returns the next message on the input queue. It must be
called often enough so that the input queue does not overflow. Usually the application sets
up a separate thread which calls mtGetmessage() and does some processing on the messages read.
Prototype:
int mtGetMessage(MYTRACK_MSG * message, int flag);
flag:
0 - do not pend for a message – return MT_ERR_NO_MESSAGE if no message if there is a msg waiting it will return it.
-1 - pend forever until a message comes
N - pend for N milliseconds - return a message if it comes in before the time expires. otherwise return MT_ERR_NO_MESSAGE
Syntax:
errCode = mtGetMessage(&message, flag);
The defined message types are:
| | |
| MSG_ERROR_REPORT | 0 | |
| MSG_LOGON_RESPONSE | 1 | response to a mtRequestLogon |
| MSG_LOGOFF_RESPONSE | 2 | response to a mtRequestLogoff |
| MSG_HEART_BEAT | 3 | handled internally by the SDK |
| MSG_HISTORICAL_DATA | 4 | |
| MSG_INTRADAY_UPDATE | 6 | |
| MSG_BACKGROUND_RESPONSE | 7 | |
| MSG_MARKET_PULSE | 8 | |
| MSG_QUOTE_RESPONSE | 9 | |
| MSG_NEWS_HEADLINE | 10 | dynamic news headline |
| MSG_NEWS_RESPONSE | 11 | either news headline or story |
| MSG_DATA_WAREHOUSE | 15 | |
| MSG_TRANSACTION_LOG | 17 | |
| MSG_YESTERDAYS_LOGS | 18 | |
| MSG_OPTION_DATA | 20 | |
| MSG_COMPOSITE_FAMILY_DATA | 25 | |
| MSG_SYMBOL_LOOKUP | 27 | |
| MSG_COMPOSITE_VALUE | 28 | occasional response from intraday update |
| MSG_INTRADAY_DATA | 29 | |
| MSG_HISTORICAL_NEWS | 30 | |
| MSG_TICKER_CLOSED | 32 | deprecated |
| MSG_ZACKS_EARNINGS | 34 | |
| MSG_NASDAQ_LEVEL_2 | 36 | |
| MSG_NEWS_VENDORS | 43 | news vendor codes and descriptions |
| MSG_OPTION_LINKS | 53 | |
| MSG_EDGAR_ONLINE | 55 | |
| MSG_VOLATILITY_DISPLAY | 56 | |
| MSG_HEMINGTON_SCOTT | 57 | |
| | |
| MSG_BROKER_ACCT_IDS | 300 | returns account ID's |
| MSG_BROKER_ACCT_SUMMARY | 301 | returns an account summary |
| MSG_BROKER_ACK_ORDER_BY_MYTRACK | 302 | order ack'd by myTrack |
| MSG_BROKER_ACK_ORDER_BY_BROKER | 303 | order ack'd by broker |
| MSG_BROKER_ORDER_EXEC | 304 | order has executed |
| MSG_BROKER_ACCT_POSITION | 305 | returns a position |
| MSG_BROKER_ACK_CANCEL_BY_MYTRACK | 306 | cancel ack'd by myTrack |
| MSG_BROKER_ACK_CANCEL_BY_BROKER | 307 | cancel ack'd by broker |
| MSG_BROKER_REJ_CANCEL_BY_BROKER | 308 | cancel rejected by broker |
| MSG_BROKER_ORDER_CANCELLED | 309 | order has been cancelled |
| MSG_BROKER_ERROR_MESSAGE | 310 | broker error message |
| MSG_BROKER_TRANSACTION | 311 | transaction data |
| MSG_BROKER_ORDER_DATA | 312 | record of orders |
| MSG_BROKER_CASH_TRANSACTION | 313 | record of orders |
| MSG_BROKER_CASH_TRANSACTION | 314 | record of cash transaction |
The general format of the message returned from the server is:
typedef struct {
short messageCode; // defines what type of message this is
short spare;
int rqn; // the turnaround
union
ERROR_REPORT errorReport;
LOGON_RESPONSE logonResponse;
LOGOFF_RESPONSE logoffResponse;
HISTORICAL_DATA historicalData;
QUOTE_RESPONSE quoteResponse;
BACKGROUND_RESPONSE backgroundResponse;
INTRADAY_UPDATE tick;
NEWS_HEADLINE newsHeadline;
NEWS_RESPONSE newsResponse;
NEWS_VENDORS newsVendors;
SYMBOL_LOOKUP symbolLookup;
OPTION_PACKET optionPacket;
FUTURE_FAMILY_DATA futData;
OPTION_LINKS optionLinks;
INTRADAY_DATA intradayData;
HISTORICAL_NEWS historicalNews;
DATA_WAREHOUSE dataWarehouse;
TRANSACTION_LOG transactionLog;
NASDAQ_LEVEL_2 nasdaqLevel_2;
COMPOSITE_VALUE compositeValue;
BROKER_ACCT_IDS brokerAcctIds;
BROKER_ACCT_SUMMARY brokerAcctSummary;
BROKER_ACK_ORDER brokerAckOrder;
for MSG_BROKER_ACK_ORDER_BY_MYTRACK
and MSG_BROKER_ACK_ORDER_BY_BROKER
BROKER_ACK_CANCEL brokerAckCancel;
for MSG_BROKER_ACK_CANCEL_BY_MYTRACK
and MSG_BROKER_ACK_CANCEL_BY_BROKER
and MSG_BROKER_REJ_CANCEL_BY_BROKER
BROKER_ORDER_CANCEL brokerOrderCancel;
for MSG_BROKER_ORDER_CANCELLED
BROKER_ORDER_EXEC brokerOrderExec;
BROKER_ACCT_POSITION brokerPosition;
BROKER_ACCT_TRANSACTION brokerTransaction;
for MSG_BROKER_TRANSACTION
BROKER_ACCT_ORDER brokerOrder;
BROKER_ACCT_CASH_TRANSACTION brokerCashTransaction;
for MSG_BROKER_CASH_TRANSACTION
BROKER_ERROR_MESSAGE errorMessage;
for MSG_BROKER_ERROR_MESSAGE
} MYTRACK_MSG;
The content of the messages will be discussed in the section for the call for which they are a
response.
mtGetStats()
Gets connection statistics
This function returns a statistics packet that will give you data indicating how your connection to the
SDK server is performing.
Prototype:
int mtGetStats(STATS_PKT *statpacket);
Syntax:
errCode = mtGetStats(&statpacket);
The stats structure returned is:
typedef struct {
int numMsgsReceived; # of msgs received
int maxInputMsgsOnQueue; high water mark of # of msgs waiting
for you to process.
int numInputFaults; # of msgs dropped cause there was no
room to store them on queue.
} STATS_PKT;
The element maxInputMsgsOnQueue should be low. If it is high, it indicates that your
application is not calling mtGetMessage() frequently enough and that the input queue is backing
up.
The element numInputFaults should be zero. If it is not, then you are letting the
input queue back up so far that messages are missed. This indicates a serious fault in your
application architecture.
mtRequestLogon()
Request logon from myTrack host.
Prototype:
int mtRequestLogon (int rqn, // request # - turn around data
char * username, // myTrack username, 16 bytes max
char * password, // mytrack password, 16 bytes max
char * productName, // your product name - 12 bytes max
UCHAR revHO, // your product rev # high order; must be < 99
UCHAR revLO // your product rev # low order; must be < 99
);
Syntax:
errCode = mtRequestLogon(rqn, user, password, product, revH, revL);
When the logon has been processed, a MSG_LOGON_RESPONSE message will be sent by the SDK server.
Typedef struct {
char error; // 0=ok, otherwise see server side errors below
char host[8]; // myTrack host name
} LOGON_RESPONSE;
Important
1. You must logon within 10 seconds of the call to mtConnectToServer()
2. Distributors of myTrack SDK based software:
set productName, revHO, revLO to identify your product to distinguish users of your software
for support and other matters. These values must be less than 99
mtRequestLogoff
Request logoff from myTrack host
Prototype:
mtRequestLogoff (int rqn); // request # - turn around data
Syntax:
errCode = mtRequestLogoff (rqn);
When the logoff has been processed, a MSG_LOGOFF_RESPONSE message will be sent by the SDK server.
struct {
char error; // 0=ok, otherwise see server side errors below
} LOGOFF_RESPONSE;
mtRequestHistoricalData()
Request historical pricing data
The server will send you the data backwards in time from the most recent day going backwards. Therefore
the starting date is really the later date on a chronological basis. The # of packets requested has to be
between 1 and 255. If you need more data, make additional requests.
Prototype:
mtRequestHistoricalData(
int rqn, // request # - turn around data
char *ticker, // ticker symbol - up to 16 bytes
short date[3], // starting date: (see details above)
// year (ex: 1999 or 2001…)
// month (1-12)
// day (1-31)
short numPkts, // # of packets requested
short period // 1=daily 2=weekly 3=monthly
);
Syntax:
errCode = mtRequestHistoricalData(rqn, ticker, date,numPkts,period);
This call will return one or more packets from the server The number of packets sent back does not
always correspond to the number requested. The server may send back less than requested. Be guided by
the packet flag and re-issue another request if needed. Packets are of the form:
typedef struct {
char error;
char recordType; // see recordType below
char packetFlag; // 0=more packets to follow
// 1=last transmission for this request
// 2=no more data for this ticker
UCHAR numPackets; // number of packets returned
int generalSplitFactor; // see below
HIS_PACKET pkt[MAX_HISTORICAL_PKTS_PER_SEND];
// MAX_HISTORICAL_PKTS_PER_SEND is currently set to 50.
}HISTORICAL_DATA;
recordType
| | | | |
| stock | 0 | S&P | 10 |
| index | 1 | mutual fund | 11 |
| option | 2 | money market fund | 12 |
| regional | 3 | technical data | 13 |
| market statistic | 4 | volatility data | 14 |
| future | 5 | otc bond data | 15 |
| future option | 6 | dividend | 16 |
| money rates | 7 | eps and sos | 17 |
| misc option | 8 | splits | 18 |
| bond | 9 |
The server will send back multiple data sub-packets one for each period. Not all fields are
valid for all record types - see below
typedef struct {
short date[3];
UCHAR spare;
UCHAR format; // see below
long open; // O H L C data is for each period(day, week or month)
long high;
long low;
long close;
long volume;
long misc; // see below
} HIS_PACKET;
The following are the valid fields per type of record:
| Type | Date | Format | Open | High | Low | Close | Vol | Misc |
|
| Stock | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Daily Split Factor |
| Index | Yes | Yes | Yes | Yes | Yes | Yes | No | No |
| Option | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
| Mkt stat | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
| Future | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Open Interest |
| Mutual Fund | Yes | Yes | NAV | Offer |
The daily_split_factor is used to correct the historical data for splits. The historical prices
reflect what the actual price was on the day the stock was traded. To correct the historical data
for splits for every day compute the stock value:
Corrected value = (historical value * general_split_factor) / daily_split_factor
The format field is used to account for the many different increments of stock prices (32nd,
64ths, decimals, etc.) The format field is the denominator you divide the value by to get the real price.
if (format < 10)
denominator = 10 ** format; // 10format
else
denominator = 2 ** (format - 10); // 2(format - 10)
Example:
value = 40160 format = 18 denominator = 256 real value = 156.875
value = 663010 format = 2 denominator = 100 real value = 6630.10
Historical value for ‘mkt stat’ instTypes are formatted by the host.
mtRequestQuoteData()
Request quotation for ticker
Prototype:
mtRequestQuoteData(
int rqn, // request # - turn around data
char * ticker, // ticker symbol - up to 14 bytes if
there is an option code present
if the option code pointer is NULL
then the ticker can be extended to 16 bytes
char * optionCode // option code if requesting an option
2 bytes, or null string if not option
);
Syntax:
errCode = mtRequestQuoteData(rqn, ticker, optionCode);
There are two types of packets returned. One type is in response to an option request, the other is for all
other types of instruments.
Check ‘recordType’ to see it the response is for an ‘option’, otherwise use ‘stock’ format.
The stock (and everything else except for options) structure is:
{
| char error; | |
| UCHAR recordType; | see recordType |
| UCHAR rtFlag; | 0 = real time, 1 = delayed |
| char spare[2]; | |
| UCHAR format; | |
| UCHAR tradeHour; | hour of last trade |
| UCHAR tradeMinute; | minute of last trade |
| int last; | last trade price |
| int yestClose; | yesterday's close |
| int volume; | today’s total volume for primary or specified exchange. Must be multiplied by blockFactor |
| int bid; | |
| int ask; | |
| int bidSize; | |
| int askSize; | |
| int high; | |
| int low; | |
| int open; | |
| int lastTradeVolume; | |
| int annualHigh; | |
| int annualLow; | |
| UCHAR tick; | indicator: 1 = up, 255 = down |
| char exchange[2]; | 2 character code of primary market (see
Market Codes) |
| UCHAR volatility; | volatility indicator (between 0 and 150) see VOLATILITY_DISPLAY for formula |
| UCHAR divFrequency; | frequency of dividends |
| UCHAR divDate[3]; | in thousands of a unit (i.e. 1125 = $1.125) |
| int eps; | in thousands of a unit (i.e. 4650 = $4.650) |
| short blockFactor; | multiplier for: INTRADAY_UPDATE: volume QUOTE: volume, lastTradeVolume, yestVolume |
| short shortableQuantity; | 0 = not shortable, otherwise the amount available for shorting, in 100's |
| int implied; | only for stocks that have options, divide by 100, used with delayed-prices as a
better indicator of the current stock price |
| int yestVolume; | yesterday’s closing volume - multiply by blockFactor |
| short newsValue; | minutes from midnight of latest news item |
| short spare3; | |
| int compositeVolume; | in shares - do not multiply by block factor |
| int numTrades; | |
| int afterMktLast; | 0 during regular trading |
| UCHAR afterMktHour; | hour of last after market trade |
| UCHAR afterMktMinute; | minute of last after market trade |
}QUOTE_RESPONSE_STOCK;
This is the structure returned for options:
| char error; | |
| UCHAR recordType; | see recordType |
| UCHAR rtFlag; | 0 = real time, 1 = delayed |
| char spare[2]; | |
| UCHAR format; | |
| UCHAR tradeHour; | hour of last trade |
| UCHAR tradeMinute; | minute of last trade |
| int last; | last trade price |
| int yestClose; | yesterday's close |
| int volume; | today’s total volume for primary or specified exchange. Must be multiplied by blockFactor |
| int bid; | |
| int ask; | |
| int bidSize; | |
| int askSize; | |
| int high; | |
| int low; | |
| int openInterest; | |
| char exchange[2]; | 2 character code of primary market (see
Market Codes) |
| char optionDesignation[2]; | |
| int strikePrice; | use format code to interpret this |
| short daysToExpiration; | calculated from Monday on weekends |
| UCHAR seriesNumber; | |
| UCHAR numDividends; | |
| UCHAR callPutFlag; | 0 = call, 1 = put |
| char spare1[3]; | |
| int yesterdayVolume; | do not multiply by blockFactor |
| char exchangeRoot; | |
| int open; | |
| int numTrades; | |
} QUOTE_RESPONSE_OPTION;
A union is defined to handle these two dissimilar structures:
typedef struct { // the union of stock & option pkts
union {
QUOTE_RESPONSE_STOCK stock;
QUOTE_RESPONSE_OPTION option;
} u;
} QUOTE_RESPONSE;
mtRequestBackground()
Request background info for a ticker symbol
Prototype:
mtRequestBackgroundData(
int rqn, // request # - turn around data
char * ticker, // ticker symbol - up to 14 bytes
char * optionCode // option code if requesting an option
2 bytes, or null string if not option
);
Syntax:
errCode = mtRequestBackgroundData(rqn, ticker, optionCode);
The server will respond with a MSG_BACKGROUND_RESPONSE containing the following packet:
| char error; | |
| UCHAR recordType; | see recordType |
| char description[32]; | name of company |
| char cusip[12]; | standard industry id for this security |
| char industryGroup[6]; | |
| char startDate[3]; | earliest history for this security |
| char endDate[3]; | latest history for this security (will be 00/00/00 for active stocks) |
| UCHAR optionFlag; | 0 = no options, 1 = has options |
| char primaryMarketCode; | see Market Codes |
| int sharesOutstanding; | in thousands |
| int sharesInFloat; | in thousands |
| int averageDailyVolume; | in units |
| int shortInterest; | in units |
| char underlyerSymbol[8] | underlying stock symbol |
| BYTE lotSize | minimum round lot - usually 100, can be 10 or 1 |
} BACKGROUND_RESPONSE;
mtRequestIntradayUpdate()
Request to start/stop dynamic ticker updates
Prototype:
Int mtRequestIntradayUpdate(
int rqn, // request # - turn around data
char * ticker, // ticker symbol - up to 14 bytes
char * optionCode, // option code if requesting an option
2 bytes, or null string if not an option
UCHAR flag //1 = start, 2 = stop
);
Syntax:
errCode = mtRequestIntradayUpdate(rqn, ticker, optionCode, flag);
Server responds with MSG_INTRADAY_UPDATE contianing either an INTRADAY_UPDATE packet for a quote update or a SALE_UPDATE packet
for a trade message. The server will send this message every time a stock trades or the bid/ask change:
| UCHAR error; | |
| UCHAR recordType; | see recordType in HISTORICAL_DATA |
| char flag; | see below |
| char msgType; | 0 - trade, 1 - quote |
| union SALE_UPDATE sale; QUOTE_UPDATE quote; }m; | |
} INTRADAY_UPDATE;
{ // intraday update - sale message
| char time[3]; | |
| char format; | |
| long seq; | unique seq # of this trade (identifies corrections…) |
| long value; | |
| long volume; | must be multiplied by QUOTE blockFactor |
| char saleCode; | defines the type of sale, usually blank. see
Sales Codes |
}SALE_UPDATE;
{ // intraday update - quote message
| char time[3]; | hour:minute:seconds |
| char format; | |
| long seq; | unique seq # of this quote |
| long bid; | |
| long ask; | |
| USHORT bidSize; | |
| USHORT askSize; | |
} QUOTE_UPDATE;
The flag will denote the type of Message. There are 3 possibilities:
- 0: a regular msg
- 1: a cancellation of a previous msg, where the msg to be cancelled is the one with the same sequence
# that is in this msg.
- 2: a correction - replace the msg with the seq # that is sent with this msg with the data in this msg
(new volume & last)
Not all fields are defined for each record type. The following are the valid fields per type of record:
| For a Sale Message: |
| Type | Time | Format | Seq # | Value | Volume | Sale Code |
|
| Stock | Yes | Yes | Yes | Yes | Yes | Yes |
| Index | Yes | Yes | Yes | Yes | No | Yes |
| Option | Yes | Yes | Yes | Yes | Yes | No |
| Regional Stock | Yes | Yes | Yes | Yes | Yes | Yes |
| Mkt Stat | Yes | Yes | Yes | Yes | No | No |
| Future | Yes | Yes | Yes | Yes | Yes | No |
| For a Quote Message: |
| Type | Time | Format | Seq # | Bid | Ask | Bid Size | Ask Size |
|
| Stock | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Index | Yes | Yes | Yes | Yes | No | No | No |
| Option | Yes | Yes | Yes | Yes | Yes | No | No |
| Regional Stock | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Mkt Stat | n/a | | | | | | |
| Future | Yes | Yes | Yes | Yes | Yes | only on Globex |
Note: The server will send MSG_COMPOSITE_VALUE (mc 28) in addition to the other intraday update
messages. The value updates the composite volume.
{
int value;
} COMPOSITE_VALUE;
mtRequestNewsHeadlines()
Request to start/stop dynamic news headlines.
This request will start or stop news headlines from coming in. If you do not call this routine, you
will not get dynamic news. Should only be called once per successful logon.
Prototype:
int mtRequestNewsHeadlines (int rqn, // request # - turn around data
UCHAR flag // 1 - start, 2 - stop
);
Syntax:
errCode = mtRequestNewsHeadlines (rqn, flag);
The server responds with MSG_NEWS_HEADLINE for each new headline that has arrived.
{
UCHAR length; // length of headline
char headline[160];
} NEWS_HEADLINE;
Presently only up to 80 characters will be sent, but allow for a double headline of 160 characters in
the future. The headline will have the following format:
story # vendorCode time text
For example:
01235 R 6.06 Judge rules against Microsoft
where:
| 01235 | is the unique story # - use this # to retrieve the story |
| R | is the vendor code (for Reuters). See below for function mtRequestNewsVendors() to retrieve
the list of vendor codes |
| 6.06 | is the time. AM is indicated by the period 6'.'06, PM is indicated by a colon 6':'06 |
mtRequestNewsByTicker()
Requests all the news headlines for a specific ticker
Prototype:
int mtRequestNewsByTicker (int rqn, // request # - turn around data
char * ticker, // ticker symbol - up to 16 bytes
char y_flag); // 0 - today's news, 1 - yesterday's news
Syntax:
errCode = mtRequestNewsByTicker(rqn, ticker, y_flag);
The server responds with one or more MSG_NEWS_RESPONSE messages, with one message per headline.
{
| UCHAR error; | |
| UCHAR flag; | 0 - more to come, 1 - last msg |
| UCHAR length; | # of bytes in line |
| char line[160]; | the headline as explained above |
} NEWS_RESPONSE;
mtRequestNewsStory()
Request for a specific news story
Prototype:
int mtRequestNewsStory (int rqn, // request # - turn around data
char * storyNumber // story number - up to 8 bytes
);
Syntax:
errCode = mtRequestNewsStory(rqn, storyNumber);
The server responds with one or more MSG_NEWS_RESPONSE messages, with one message per line of the story.
{
| UCHAR error; | |
| UCHAR flag; | 0 - more to come, 1 - last line |
| UCHAR length; | # of bytes in line |
| char line[160]; | |
} NEWS_RESPONSE;
mtRequestNewsVendors()
Request for all news vendor codes and descriptions
Prototype:
int mtRequestNewsVendors (int rqn); // request # - turn around data
Syntax:
errCode = mtRequestNewsVendors (rqn);
The server responds with a MSG_NEWS_VENDORS message of the form:
{
| char flag; | 0 - more to come, 1 - last one |
| char enabled; | 0 - vendor not enabled, 1 - vendor is enabled |
| char vendorCode[3]; | a 1 to 3 character vendor code |
| char vendorSubCode[2]; | 1 or 2 character vendor sub code (see myTrack.txt) |
| char vendorName[14]; | use this name in your display |
} NEWS_VENDORS;
mtRequestSymbolLookup()
Look up company name for a ticker, or return company names matching template
Prototype:
int mtRequestSymbolLookup (int rqn, // request # - turn around data
char * symbol, // ticker or wildcard pattern
char type, // 0 = ticker, 1 = wild card pattern
char next, // (for type 1 only) 0 = initial request 1 = more
char nol // (for type 1 only) number of matching
company names to return
Syntax:
errCode = mtRequestSymbolLookup (rqn);
The server responds with a MSG_SYMBOL_LOOKUP message of the form:
{
| char error; | |
| char type; | |
| char eom_flag; | see below |
| char spare; | |
| char ticker[80]; | Full Company Name |
} SYMBOL_LOOKUP;
The interpretation of the eom_flag is:
0 = more to follow for this request
1 = this request has been satisfied (nol has been reached), but there are more matches in the database
2 = no more matches in the database
Note: eom_flag will always be ‘2’ on a wildcard request for ‘more’, although the server will continue
to return matching results on request for more. The server will return the entire list of symbols as long as
you request ‘more’.
mtRequestOptionData()
Request the list of options for a security matching specified criteria
Prototype:
int mtRequestOptionData(int rqn,
char * ticker,
char RequestType, // 0 - calls, 1 - puts, 2 - both
char composite, // 0 - one market, 1 - all markets
short pct_out, // % out of the money filter
short pct_in, // % in the money filter
BYTE num_lines,
int flag // 0 - initial request, 1 - more of previous request
);
Syntax:
errCode = mtRequestOptionData (rqn, ticker, RequestType, composite, \
pct_out, pct_in, num_lines, flag);
The server responds with one or more MSG_OPTION_DATA messages, with one message per option.
{
| char error; | |
| char recordType; | see recordType |
| char rtFlag; | |
| char eomFlag; | see below |
| char spare; | |
| UCHAR format; | |
| UCHAR tradeHour; | |
| UCHAR tradeMinute; | |
| int last; | |
| int yest_close; | yesterday's close |
| int volume; | |
| int bid; | |
| int ask; | |
| int high; | |
| int low; | |
| int open_interest; | |
| char exchange[2]; | |
| char designation[2]; | option designator |
| int strikePrice; | use format code to interpret this |
| short daysToExp; | days to expiration |
| char series_num; | |
| char numDivPayments; | |
| char callOrPut; | 0 - call, 1 - put |
| char spare1[2]; | |
| int yest_volume; | |
| char exchangeRoot[4]; | |
| int open; | |
| int numTrades; | |
} OPTION_PACKET;
The interpretation of the eom_flag is:
0 = more to follow for this request
1 = this request has been satisfied (num_lines has been reached), but there are more options for this stock
2 = no more options for this stock. The packet containing this flag does not contain any option data.
mtRequestOptionLinks()
Request the list of option links for a security
Prototype:
int mtRequestOptionLinks(int rqn, char *symbol);
Syntax:
errCode = mtRequestOptionLinks (rqn, symbol);
The server responds with a MSG_OPTION_LINKS message:
{
| char error; | |
| char num; | # of tickers (max 20) |
| char ticker[20][4]; | |
} OPTION_LINKS;
mtRequestFutureFamilyData()
Request future family data
Prototype:
int mtRequestFutureFamilyData(int rqn, char *symbol);
Syntax:
errCode = mtRequestFutureFamilyData (rqn, symbol);
The server responds with one or more MSG_FUTURE_FAMILY_DATA messages:
{
| char error; | |
| char recordType; | // see recordType |
| char rtFlag; | 0 - real time, 1 - delayed |
| char eomFlag; | 0 - more packets will be sent, 1 - last packet |
| UCHAR format; | |
| UCHAR tradeHour; | |
| UCHAR tradeMinute; | |
| int last; | |
| int yestClose; | yesterday's close |
| int volume; | |
| int bid; | |
| int ask; | |
| int high; | |
| int low; | |
| int openHi; | |
| int openLo; | |
| int annualHi; | |
| int annualLo; | |
| char tick; | >0 uptick, <0 downtick |
| char exchange[2]; | |
| BYTE volatility; | volatility value between 0 and 150, see VOLATILITY_DISPLAY for formula |
| char firstDeliveryDate[3]; | |
| char lastDeliveryDate[3]; | |
| char lastTradeDate[3]; | |
| char hasOptions; | |
| char spare; | |
| int impliedPrice; | |
| int yestVolume; | |
| int openInterest; | |
| char ticker[6]; | |
} FUTURE_FAMILY_DATA;
mtRequestIntradayData()
Request intraday 1 minute interval data, for the entire day requested.
Prototype:
int mtRequestIntradayData(int rqn,
char *symbol,
BYTE dateFlag // 0 = most current date, 1 - day back,
2 - 2 days back…, 15 - 15 days back
);
Syntax:
errCode = mtRequestIntradayData (rqn, symbol, dateFlag)
The server responds with a series of MSG_INTRADAY_DATA messages, one message per minute where there is data.
If there are no trades during a minute, then no packet will be sent for that minute:
{
| char error; | |
| char recordType; | see recordType |
| char spare[2]; | |
| char date[3]; | |
| char packetFlag; | |
| UCHAR Hour; | |
| UCHAR Minute; | |
| UCHAR Second; | |
| UCHAR format; | |
| int endSeq; | |
| int open; | |
| int high; | |
| int low; | |
| int close; | |
| int volume; | do not multiply by blockFactor |
} INTRADAY_DATA;
| error: |
0 = ok
if no data for the day you requested you'll get err 14
if the day requested is not available you'll get err 25
for other errors see Error
Codes
|
| packet flag: |
0 - more packets to follow
1 - last packet for this ticker
|
mtRequestIntradayDataTime()
Request intraday 1 minute interval data, starting from ‘minutes from midnight’
Use this function when you don’t need the entire day’s data (i.e. to update intraday data previously requested)
Prototype:
int mtRequestIntradayData(int rqn,
char * symbol,
BYTE dateFlag // 0 - most current date,
1 - 1 day ago, 2 - 2 days ago… 15 - 15 days back
short minFromMidnight // send data from this time on
);
Syntax:
errCode = mtRequestIntradayDataTime(rqn, symbol, dateFlag, minFromMidnight)
The server response will be the same as in mtRequestIntradaData()
mtRequestDataWarehouse()
Request for data warehouse
Important: If you use the myTrack program, make sure you are not overwriting information needed by the myTrack app.
Prototype:
int mtRequestDataWarehouse(int rqn,
char actionType, // 1 - get data, 2 - send data, 3 - delete data
short key, // record identifier
char * data // only if saving data
);
Syntax:
errCode = mtRequestDataWarehouse (rqn, actionType, key, data);
The server responds with a MSG_DATA_WAREHOUSE message:
{
| char error; | |
| char actionType; | same as action type in request |
| short key; | identifier of record requested |
| char data[100]; | only if getting data |
} DATA_WAREHOUSE;
mtRequestTransactionLog()
Request for transaction log
Prototype:
int mtRequestTransactionLog(int rqn,
char flag, // 0 - initial request, 1 - page down, 2 - page up
char nol, // # of lines in window (min - 5)
char noc, // # of columns in window: 40 - one
message per line, 80 - 2 messages per line
char * text, // request text (max 10 chars),
typically a ticker symbol
int type // 0 - both trades and quotes,
1 - quotes only, 2 - trades only
);
Syntax:
errCode = mtRequestTransactionLog(rqn, flag, nol, noc, text, type);
The server responds with one or more MSG_TRANSACTION_LOG messages:
{
| char error; | |
| char flag; | 0 - more lines to follow, 1 - last line |
| char spare; | |
| char nob; | number of bytes in line |
| char line[160]; | Data - see ConvertFractions() below |
} TRANSACTION_LOG;
The line[] data in the message contains fractional data that should be passed, byte
by byte, through the following conversion routine for printing:
int ConvertFractions(
unsigned char token, // character value from 'line[]'
char *sToken // pointer to store resulting string
);
The format for the transaction log text (line) is as follows:
Day of month (for yesterday’s log only)
Time of Transaction
Exchange Code
Volume (for trades, left blank for quotes)
Price (for trades) Bid – Ask – Size (for quotes)
Transaction Log code – usually blank, see Sales Codes for codes
For more help see the myTrack help for “using transaction log”
mtRequestNasdaqLevel_2()
Request for Nasdaq Level 2 data
Prototype:
int mtRequestNasdaqLevel_2 (int rqn,
char flag, // 1 - start dynamic monitoring,
2 - terminate monitoring
char nol, // # of lines in the display
minimum of 8, max of 24
char show_closed, // market maker: 1 - do not
display closed mm, 2 - display closed mm
char * text // request text (max 12 chars)
typically a ticker symbol
);
Syntax:
errCode = mtRequestNasdaqLevel_2(rqn, flag, nol, show_closed, text)
The server responds with one or more MSG_NASDAQ_LEVEL_2 messages:
typedef struct {
| char error; | |
| char flag; | 0 - more data for this transmission, 1 - last message in this transmission |
| char nop; | number of packets in this msg |
| char spare; | |
| NQDSDATA packet; | list of ‘nop’ NQDSDATA packets (see below). each packet contains bid AND
ask for a MM you must sort the bid/asks of each MM
separately. |
} NASDAQ_LEVEL_2;
{
| char stMmid[4]; | market maker id |
| BYTE bAction; | 1 = valid MM record, 2 = delete this MM record from your list, the
server will no longer update this MM. ignore the other data in this packet |
| char cQc; | quote condition: 'C' = closed |
| char cPriceFormat; | 0: bid is in 256ths, ask is in 256ths
1: bid is in 256ths, ask is in 1000ds
2: bid is in 1000ds, ask is in 256ths
3: bid is in 1000ds, ask is in 1000ds
4: bid is in 256ths, ask is in 10,000ds
5: bid is in 10000ds, ask is in 256ths
6: bid is in 10000ds, ask is in 10000ds |
| char cTrend; | trend indicator bit 0x01 on - bid up, off - bid down
bit 0x02 on - ask up, off - down |
| long lMmbid; | bid price |
| long lMmbidsz; | bid size |
| long lMmask; | ask price |
| long lMmasksz; | ask size |
| long lTime; | time of quote (seconds from midnight) |
| USHORT sNumBid; | # of times at the inside bid |
| USHORT sNumAsk; | # of times at the inside ask |
} NQDSDATA;
The NASDAQ_LEVEL_2 msg contains a variable number ('nop') of NQDSDATA packets. The ‘packet’ field is a pointer to
the first 'packet'. To get all the packets:
- Get the address of the first packet
- Cast it to an array of packets
- Continue adding to the address of the packet for the num of packets ('nop').
See example in the mt_test demo program.
Notes:
- The first message will contain at least enough packets to fill the amount of lines (‘nol’) you requested.
- A ‘packet’ contains both the bid and ask for a MM.
- You must handle updating, removing and sorting of the MM bid and ask data.
- Subsequent messages will only contain packets with updated MMs. You will need to resort your display and
put it in the correct place.
- The server will stop dynamic updating after 15 minutes. If the window is still monitoring, you need to
refresh this request every 10 minutes. The rqn must be same as in the original request.
- In order for this function to work you must add the following features to your myTrack account:
- Nasdaq Level II entitlements (snap or dynamic)
- real-time data (at least myTrack Silver plan)
- Nasdaq Exchange (chat / entitlements / exchanges)
- Microsoft (MSFT) will work as a sample regardless of entitlements
mtRequestOrderBook()
Request for Order Book data (order stacking at ISLD)
Prototype:
int mtRequestOrderBook (int rqn,
char flag, // 1 - start dynamic monitoring,
2 - terminate monitoring
char nol, // # of lines in the display
minimum of 8, max of 24
char * MMid, // to request a specific MM
char * text // request text (max 12 chars)
usually a ticker symbol
);
Syntax:
errCode = mtRequestOrderBook (rqn, flag, nol, MMid, text);
The server responds with one or more MSG_ORDER_BOOK messages:
typedef struct {
| char error; | |
| char flag; | 0 - more data for this transmission, 1 - last message in this transmission |
| char nop; | number of packets in this msg |
| char spare; | |
| OB_DATA packet; | list of ‘nop’ OB_DATA packets (see below) |
} ORDER_BOOK;
{
| long orderNum; | order number, vendor buy / sell specific |
| char stMmid[4]; | market maker id |
| BYTE bAction; | 1 - valid MM record, 2 - delete this MM record from your list, the
server will no longer update this MM. ignore the other data in this packet |
| char cSide; | 'B' - buy, 'S' - sell |
| BYTE cPriceFormat; | 0: bid is in 256ths, ask is in 256ths
1: bid is in 256ths, ask is in 1000ds
2: bid is in 1000ds, ask is in 256ths
3: bid is in 1000ds, ask is in 1000ds
4: bid is in 256ths, ask is in 10,000ds
5: bid is in 10000ds, ask is in 256ths
6: bid is in 10000ds, ask is in 10000ds |
| char spare; | |
| long price; | |
| long size; | |
| long lTime; | seconds from midnight |
} OB_DATA;
The ORDER_BOOK msg contains a variable number ('nop') of OB_DATA packets. The ‘packet’ field is a pointer to
the first 'packet'. To get all the packets:
- Get the address of the first packet
- Cast it to an array of packets
- Continue adding to the address of the packet for the number of packets ('nop').
See example in the mt_test demo program.
Notes:
- The server will stop dynamic updating after 15 minutes. If the window is still monitoring, you need to
refresh this request every 10 minutes. The rqn must be same as in the original request.
- This feature is only available for NADSAQ issues and the feed begins at 7am est.
mtRequestNewsByVendor()
Request for news by vendor
Prototype:
int mtRequestNewsByVendor(int rqn,
char * vendor, // vendor (ex: D for Dow Jones)
int headline // earliest headline #
to get all of today's news, set to 1
);
Syntax:
errCode = mtRequestNewsByVendor(rqn, vendor, headline);
The server responds with one or more MSG_NEWS_RESPONSE messages, with one message per headline.
{
| UCHAR error; | |
| UCHAR flag; | 0 - more to come, 1 - last msg |
| UCHAR length; | # of bytes in line |
| char line[160]; | |
} NEWS_RESPONSE;
Note: Presently only up to 80 characters will be sent, but allow for a double headline of 160 characters
in the future.
The headline will have the following format:
story # vendorCode time text
For example:
01235 R 6.06 Judge rules against Microsoft
where:
| 01235 | is the unique story # - use this # to retrieve the story |
| R | is the vendor code (for Reuters). See below for function mtRequestNewsVendors() to retrieve
the list of vendor codes |
| 6.06 | is the time. AM is indicated by the period - 6'.'06, PM is indicated by a colon - 6':'06 |
mtRequestHistoricalNews_Ticker()
Request for historical news by ticker
Prototype:
int mtRequestHistoricalNews_Ticker(int rqn,
char nol, // number of headlines to return
char more, // 0 - initial request, 1 - more headlines
char * ticker // ticker symbol i.e 'IBM'
);
Syntax:
errCode = mtRequestHistoricalNews_Ticker (rqn, nol, more, ticker);
The server responds with one or more MSG_HISTORICAL_NEWS messages, with one message per headline.
{
| char error; | |
| char flag; | 0 - more to come, 1 - last msg |
| char nob; | # of bytes in line |
| char line[160]; | |
} HISTORICAL_NEWS;
The first request for historical news should have the parameter more set to 0. This will give the most recent
headlines. If you would like to go back in history further on subsequent requests, set more to 1. The server will
continue from where it left off. Note that the placeholder that allows you to continue back in history does not persist
across sessions, so if you log off from the SDK server you will have to start the process over again.
The data will be sent back in lines. Each line may have up to 160 bytes of text but presently will not exceed 80 bytes.
See mtRequestNewsByVendor() above for headline format.
mtRequestHistoricalNews_Story()
Requests historical news story
Prototype:
int mtRequestHistoricalNews_Story(int rqn,
int storynumber, // ex: 12345
char *mmddyy // the date
);
Syntax:
errCode = mtRequestHistoricalNews_Story(rqn, storynumber, mmddyy)
The server responds with one or more MSG_HISTORICAL_NEWS messages, with one message per line of the story.
{
| char error; | |
| char flag; | 0 - more to come, 1 - last line |
| char nob; | # of bytes in line |
| char line[160]; | |
} HISTORICAL_NEWS;
mt3rdParty_MarketPulse()
Requests Market Pulse display data
Prototype:
int mt3rdParty_MarketPulse(int rqn, char *text);
Syntax:
errCode = mt3rdParty_MarketPulse (rqn, text);
Market Pulse is requested by page number. The page number is the "Market" + "Pulse". For example: NYSE most
active is page
"101" - "Market" NYSE is 100 and "Pulse" most active is 01:
You can enter .1 after any page # to see yesterday’s data (e.g. 101.1).
You can enter .2 after any page # to see after-hours data (e.g. 101.2).
Below is the listing of the "Markets" and
"Pulse's".
| Markets |
| NYSE stocks | 100 | OTCBB | 6100 |
| AMEX stocks | 200 | Equity Options | 400 |
| NASD stocks | 300 | Index Options | 500 |
| Toronto | 1100 | Averages | 600 |
| Montreal | 1200 | Statistics | 700 |
| Vancouver | 1300 | Index Futures | 800 |
| UK | 2100 | Currencies | 900 |
| Pulses |
| Pulse Codes for Stocks |
| most active | 01 | most active (new high) | 08 |
| most up ($) | 02 | most active (new low) | 09 |
| most down ($) | 03 | most gap up ($) | 10 |
| most up (%) | 04 | most gap down ($) | 11 |
| most down (%) | 05 | most active (price * volume) | 12 |
| most up volume (%) | 06 | most active (trading at high) | 13 |
| most active (with news) | 07 | most active (trading at low) | 14 |
Pulse Codes for Index & Equity Options |
| most active calls | 01 | statistics | 04 |
| most active puts | 02 | statistics of equity plus index options | 05 |
| most active family | 03 | |
Pulse Codes for Averages |
| Industrials | 01 | Utilities | 03 |
| Transportations | 01 | World Indices | 50 |
Pulse Codes for Statistics |
| NYSE | 10 | DOW | 40 |
| AMEX | 20 | BOND | 50 |
| OTC | 30 | | |
Pulse Codes for Index Futures |
| Theoretical values & returns | 01 | XOI | 03 |
| XMI | 02 | | |
Pulse Codes for Currencies |
| Currencies page 1 | 01 | | |
The message returned will be of type MSG_MARKET_PULSE.
To format the data in aligned columns:
int mtMPFormatData(char *from, void *to, int type);
At this time the only “type” defined is:
#define MP_FORMAT_TEXT 1
This will format response with all ASCII characters and aligned columns - each line may be up to 160 chars.
mt3rdParty_ZacksEarnings()
Request for information from 3rd party database Zacks Earnings Estimates
Prototype:
int mt3rdParty_ZacksEarnings(int rqn,
char * text // ticker symbol for request
);
Syntax:
errCode = mt3rdParty_ZacksEarnings(rqn, symbol);
The server responds with a MSG_ZACKS_EARNINGS message:
{
| char error; | |
| char flag; | 0 - more pages to follow, 1 - last page |
| short nob; | # of bytes in page |
| char data[24][80]; | 24 by 80 page data |
} ZACKS_EARNINGS;
mt3rdParty_EdgarOnline()
Request for information from 3rd party database Edgar Online
Prototype:
int mt3rdParty_EdgarOnline(int rqn,
char *text // ticker symbol for request
);
Syntax:
errCode = mt3rdParty_EdgarOnline(rqn, symbol);
The server responds with a MSG_EDGAR_ONLINE message:
{
| char error; | |
| char eomflag; | 1 - more to come, 2 - last data |
| char spare[2]; | |
| char dateText[8]; | the date |
| char headline[96]; | |
| char url[128]; | url of the full document |
} EDGAR_ONLINE;
The headline in this structure contains a brief summary of what the Edgar filing is.
The url is the URL on the Edgar site which will give you the full document.
mt3rdParty_HemingtonScott()
Request for information from 3rd party database Hemmington Scott
Prototype:
int mt3rdParty_ HemingtonScott(int rqn,
char * text // ticker symbol for request
);
Syntax:
errCode = mt3rdParty_ HemingtonScott(rqn, symbol);
The server responds with a MSG_HEMINGTON_SCOTT message:
{
| char error; | |
| char spare; | |
| char flag; | 0 - more lines to follow, 1 - last line |
| char nob; | # of bytes in line |
| char text[80]; | line of data |
} HEMINGTON_SCOTT;
mtRequestVolatilityDisplay()
Request for a text page with various volatilities for an instrument
Prototype:
int mtRequestVolatilityDisplay(int rqn,
char * text // ticker symbol for request
);
Syntax:
errCode = mtRequestVolatilityDisplay (rqn, symbol);
The server responds with a MSG_VOLATILITY_DISPLAY message:
{
| char error; | |
| char spare[3]; | |
| char data[24][80]; | 24 by 80 page data |
} VOLATILITY_DISPLAY;
The message contains this display:
(sample for MSFT on August 23, 2000)
| MSFT | Aug | Sep | Oct | Nov |
Dec | Jan | Shares Out (k) |
| vol | 35 | 36 | 34 | 27 | 41 | 43 | 5262405 |
|
| high | 96.37 | 97.87 | 95.25 | 94.50 | 119.93 | 118.62 | |
| low | 80.96 | 88.81 | 85.06 | 84.37 | 90.87 | 94.87 | |
| close | 92.56 | 90.56 | 92.56 | 91.06 | 116.75 | 97.87 | |
|
|   | Feb | Mar | Apr | May | Jun | Jul | |
| vol | 48 | 57 | 95 | 44 | 41 | 38 | |
|
| high | 110.00 | 115.00 | 96.50 | 74.00 | 82.18 | 82.87 | |
| low | 88.12 | 88.93 | 65.00 | 60.37 | 63.81 | 67.25 | |
| close | 89.37 | 106.25 | 69.75 | 62.56 | 80.00 | 69.81 | |
|
|   | 1mo | 3mo | 6mo | 12mo | 2000 | Aug | imp |
| vol | 37 | 40 | 57 | 48 | 56 | 29 | 40 |
|
| high | 82.87 | 82.87 | 115.00 | 119.93 | 118.62 | | |
| low | 67.25 | 60.37 | 60.37 | 60.37 | 63.37 | | |
The top line lists monthly values for the last twelve months. The next three lines the high, low, and closing
price for the same twelve months.
In addition to the monthly volatilities, 7 more volatilities are shown in the line below the monthly prices.
The first six values (reading left to right) are historical values of volatility. These historical values represent
the following time periods: 30 days (1mo), 90 days (3 mo.), 180 days (6 MO), 365 days (12mo), and for the current
year to date and for the current month to date. The high and low prices for these periods are shown below the
volatilities.
The last volatility value is today’s volatility. Based on the price fluctuation of the stock for today.
The last item shown on the first line, shares out (K), is the number of shares outstanding in thousands.
Volatility Formula:
- Get Price Relatives = price on day / price on day x-1
- Calculate log of each Price Relative and Sum all logs
? (Log (price on day x / price on day x-1))
- Calculate the mean of the range of price relatives
? (Log (price on day x / price on day x – 1)) / # price relatives
- Calculate the sum of the square of each price relative
? ((price on day x /price on day x-1)2)
- Volatility = Square Root (253*(sum of the squares or price relatives (# of price
relatives (mean of the logs of
price relatives)2)) / # of price relatives
mtRequestCompositeFamilyData()
Request for a quotation for each exchange a symbol trades on
Prototype:
int mtRequestCompositeFamilyData (int rqn,
char * text // ticker symbol for request
);
Syntax:
errCode = mtRequestCompositeFamilyData(rqn, symbol);
The server responds with one or more MSG_COMPOSITE_FAMILY_DATA messages, one message containing a quote for each market
the instrument is traded on:
{
| char error; | |
| char recordType; | see recordType |
| char rtFlag; | 0 - real time ticker, 1 - delayed ticker |
| char eomflag; | 0 - more packets to come, 1 - last packet |
| char spare; | |
| UCHAR format; | |
| UCHAR tradeHour; | |
| UCHAR tradeMinute; | |
| int last; | |
| int yestClose; | |
| int volume; | |
| int bid; | |
| int ask; | |
| int bidSize; | |
| int askSize; | |
| int high | |
| int low; | |
| int open; | |
| int lastTradeVolume; | |
| int annualHigh; | |
| int annualLow; | |
| UCHAR tick; | |
| char exchange[2]; | market letter (i.e. N for New York) up to 2 letters |
| UCHAR volatility; | see VOLATILITY_DISPLAY for formula |
| UCHAR divFrequency; | |
| UCHAR divDate[3]; | |
| int divAmt; | |
| int eps; | |
| short blockFactor; | |
| short shortableQuantity; | |
| int implied; | only for stocks that have options, divide by 100, used with delayed-prices
as a better indicator of the current stock price |
| int yestVolume; | |
| short newsValue; | |
| short spare3; | |
| int compositeVolume; | |
| int numTrades; | |
| int afterMktLast; | |
| UCHAR afterMktHour; | |
| UCHAR afterMktMinute; | |
| short spare4; | |
| int afterMktVolume; | |
} COMPOSITE_FAMILY_DATA;
mtRequestYesterdaysLogs()
Request for yesterday’s transaction log (time & sales) for a symbol
Prototype:
int mtRequestYesterdaysLogs(int rqn,
char flag, // 0 - initial request, 1 - page down, 2 - page up
char nol, // # of lines in window
char noc, // # of columns in window
char * text, // typically a ticker symbol max 10 chars
int type // 0= both trades and quotes
1 - quotes only, 2 - trades only
);
Syntax:
errCode = mtRequestYesterdaysLogs (rqn, flag, nol, noc, text, type);
The server responds with a MSG_YESTERDAYS_LOGS message:
{
| char error; | |
| char flag; | 0 - more lines to follow, 1 - last line |
| char spare; | |
| char nob; | # of characters in the line |
| char line[80]; | |
} YESTERDAYS_LOGS;
Complete Documentation Table of Contents
Overview