ASPEN_PutTick

 

Related Topics

 

 

Purpose

Insert a tick in the Server database for an existing financial instrument symbol.

 

 

Call Syntax

#include <aspen.h>

AspenRequest(GLOBAL_session, ASPEN_PutTick, &input, NULL);

 

 

Parameters

Input

An ASPEN_PUTTICK_INPUT structure.

 

Output

None.

 

 

Structures

typedef struct

{

   ASPEN_INUM   inum;

   ASPEN_PRICE  price;

   ASPEN_BATE   bate;

   ASPEN_TIME   time;

   ASPEN_VOLUME tkvol;

}ASPEN_PUTTICK_INPUT;

 

 

Remarks

By definition, a tick is a price (and volume, and bate) in time (to the minute). Therefore, ASPEN_PutTick requires,

 

 

Call AspenRequest() with either ASPEN_GetInstrumentNumber or ASPEN_GetInstrumentInfo to get a symbol's inum.

 

Applications designed for synthetic instrument transaction entry should take advantage of the ASPEN_PutTick service.

 

ASPEN_BATE_BID and ASPEN_BATE_ASK ticks may not show up on Aspen Workstation charts. It is possible to chart bids and asks, but most exchanges use trading rules that suppress the plotting of bids and asks on charts. To create a bid-driven instrument, define a custom exchange,  apply a trading rule to that exchange that allows the charting of bids and asks, and insert ticks into that exchange.

 

ASPEN_BATE_TRADE, ASPEN_BATE_OPEN, and ASPEN_BATE_CLOSE will show up on an Aspen Workstation chart.

 

Ticks inserted using ASPEN_PutTick are appended to the end of the specified minute.

 

Care must be taken to ensure that you do not enter a "tick in the future." The Server will return ASPEN_OK, but in fact the price will be lost. The best way to avoid this phenomenon is to check the tick's time against the server time using ASPEN_GetServerTime. In a synthetic instrument entry application, set the insertion time to the Server’s current minute.

 

A financial instrument symbol must exist in the Servers database prior to using ASPEN_PutTick. Call AspenRequest() with the ASPEN_CreateInstrument service to create a new symbol.

 

 

Return Value

ASPEN_OK

if the tick was successfully added to the Server.

 

 

See Also

ASPEN_GetInstrumentInfo

AspenRequest()

ASPEN_INUM

ASPEN_PUTTICK_INPUT

ASPEN_BATE

ASPEN_TIME

ASPEN_GetServerTime

ASPEN_GetInstrumentNumber

 

 

Example

int CAspenRequestDlg::DoASPEN_PutTick()

{

   ASPEN_PUTTICK_INPUT  this_tick;

   server_list          *slp = list;

   int                  retval;

   long                 lprice,lvolume,mnth,day,minute,hour,year;

   char                 symb[ASPEN_SYMBOL_SIZE];

   char                 cprice[15],cvolume[30],cmonth[2],cday[2];

   char                 cminute[2],chour[2],cyear[4];

   strcpy(symb,strSymb);

   retval = AspenRequest(slp->server_session, ASPEN_GetInstrumentNumber, symb, &a_inum);

   if(retval == ASPEN_OK)

   {

      strcpy(cprice,strPrice);

      lprice = atol(cprice);

      strcpy(cvolume,strVolume);

      lvolume = atol(cvolume);

      strcpy(cmonth,strMonth);

      mnth = atol(cmonth);

      strcpy(cday,strDay);

      day = atol(cday);

      strcpy(cminute,strMinute);

      minute = atol(cminute);

      strcpy(chour,strHour);

      hour = atol(chour);

      strcpy(cyear,strYear);

      year = atol(cyear);

      time_of_day = time(NULL);

      localTime = gmtime(&time_of_day);

      localTime->tm_mon = mnth - 1;

      localTime->tm_mday = day;

      localTime->tm_year = year - 1900;

      localTime->tm_hour   = hour;

      localTime->tm_min = minute;

      localTime->tm_sec = 0;

      ANSITimeToAspenTime(localTime, localTimeZone, &(this_tick.time));

      this_tick.inum = a_inum;

      this_tick.price = lprice;

      this_tick.bate = a_bate;

      this_tick.tkvol = lvolume;

      retval = AspenRequest(slp->server_session, ASPEN_PutTick, &this_tick, NULL);

   }

   return retval;

}

 

©2006 Aspen Research Group, Ltd. All rights reserved. Terms of Use.