|
|
|
|
Purpose |
Get historical ticks for a financial instrument. | ||
|
|
| ||
|
Call Syntax |
#include <aspen.h> … AspenRequest(GLOBAL_session, ASPEN_GetTickHistory, &tick_input, &tick_output); … | ||
|
|
| ||
|
Parameters |
Input The input parameter for this service is a pointer to a ASPEN_GETTICKS_INPUT tick.
Output The output parameter for this service is a pointer to a ASPEN_GETTICKS_OUTPUT. | ||
|
|
| ||
|
Structures |
typedef struct { ASPEN_INUM inum; ASPEN_PRICE *prices; ASPEN_VOLUME *volumes; ASPEN_TIME *times; ASPEN_BATE *bates; ASPEN_TIME start_time; ASPEN_TIME end_time; int max_ticks;
typedef struct { int num_ticks; ASPEN_TIME next_time; | ||
|
|
| ||
|
Remarks |
This service request does not return ticks that have been marked as “bad” in the Server's database.
No tick flags (ASPEN_TICK_FLAGS) are available for historical ticks. | ||
|
|
| ||
|
Return Value |
| ||
|
|
| ||
|
See Also |
|||
|
|
| ||
|
Example |
int CAspenRequestDlg::DoASPEN_GetTickHistory() { ASPEN_GETINSTRUMENT_INPUT input; ASPEN_INSTRUMENT contract; ASPEN_GETTICKS_INPUT tick_input; ASPEN_GETTICKS_OUTPUT tick_output; int retval,i; char symbol_xlat[256],tickTimeStr[80]; server_list *slp = list; CString strText; CString bateStr; char priceStr[16];
strcpy(symbol_xlat,strSymb); retval = AspenRequest(slp->server_session, ASPEN_GetInstrumentNumber, symbol_xlat, &inum); if (ASPEN_OK == retval) { input.want_updates = ASPEN_NO; input.inum = inum; retval = AspenRequest(slp->server_session, ASPEN_GetInstrumentInfo, &input, &contract); } time_of_day = time(NULL); localTime = gmtime(&time_of_day); localTime->tm_hour = start_hour; localTime->tm_min = start_minute; localTime->tm_sec = 0; ANSITimeToAspenTime(localTime, localTimeZone, &(tick_input.start_time)); time_of_day = time(NULL); localTime = gmtime(&time_of_day); localTime->tm_hour = end_hour; localTime->tm_min = end_minute; localTime->tm_sec = 0; ANSITimeToAspenTime(localTime, localTimeZone, &(tick_input.end_time)); tick_input.bates = bates; tick_input.prices = prices; tick_input.volumes = volumes; tick_input.times = times; tick_input.inum = input.inum; tick_input.max_ticks = ASPEN_MAX_TICKS; retval = AspenRequest(slp->server_session, ASPEN_GetTickHistory, &tick_input, &tick_output);
while (tick_output.next_time != 0) { for (i = 0; i < tick_output.num_ticks; i++) { struct tm localTime; q.base = contract.quantum.base; q.exponent = contract.quantum.exponent; AspenTimeToANSITime(tick_input.times[i], 0, 0, &localTime, NULL); strftime( tickTimeStr, sizeof(tickTimeStr), "%A, %B %d, %Y %H:%M", &localTime); strText.Format("%s", tickTimeStr); m_HistoryEdit.AppendString(strText); AspenDecodePrice(tick_input.prices[i], q, ASPEN_YES, priceStr, NULL, NULL, NULL); switch (*tick_input.bates) { case ASPEN_BATE_REFRESH: bateStr = "Refresh"; break; case ASPEN_BATE_TRADE: bateStr = "Trade"; break; case ASPEN_BATE_BID: bateStr = "Bid"; break; case ASPEN_BATE_ASK: bateStr = "Ask"; break; case ASPEN_BATE_SETTLE: bateStr = "Settle"; break; case ASPEN_BATE_OPEN: bateStr = "Open"; break; case ASPEN_BATE_CLOSE: bateStr = "Close"; break; case ASPEN_BATE_UNKNOWN: bateStr = "Unknown"; break; } // end switch strText.Format("TPVB: %d, %s, %d, %s", tick_input.times, priceStr, tick_input.volumes, bateStr); m_HistoryEdit.AppendString(strText); } // end for tick_input.start_time=tick_output.next_time;
retval = AspenRequest(slp->server_session, ASPEN_GetTickHistory, &tick_input, &tick_output); } // end while return retval; } |
©2006 Aspen Research Group, Ltd. All rights reserved. Terms of Use.