ASPEN_CreateInstrument

 

Related Topics

 

 

Purpose

Add a symbol to the Server's database.

 

 

Call Syntax

#include <aspen.h>

AspenRequest(GLOBAL_session, ASPEN_CreateInstrument, instrument, &this_inum);

 

 

Parameters

Input

A pointer to an ASPEN_CREATEINSTRUMENT_INPUT structure. This structure defines the new instrument in the Server database.

 

Output

A pointer to an ASPEN_INUM used to reference the new instrument in the Server database.

 

 

Structures

typedef struct

{

   char *symbol;

   char *description;

   ASPEN_QUANTUM quantum;

   int exchange;

}ASPEN_CREATEINSTRUMENT_INPUT;

 

 

Remarks

The ASPEN_CreateInstrument service requires:

 

  • An instrument symbol that is an ASCIIZ character string containing the financial instrument's ticker symbol

  • An ASCIIZ character string containing a description of the financial instrument

  • A quantum (base and exponent) for the instrument you are creating

  • An integer containing the number of the exchange in which the instrument will be created

 

The Aspen_CreateInstrument service returns an inum for the instrument created.

Ticker symbols vary by instrument type. Please consult your data vendor's symbol guide for symbol conventions you should use.

 

An instrument description is typically a stock’s corporate name, like “International Business Machine” for the symbol IBM, or “Light Crude Oil Futures” for CLU1 (or CL01U on BridgeFeed).

ASPEN_CreateInstrument obtains an inum for the instrument you are creating. You do not have to request an inum from the Server prior to using this service.

 

Instruments are created as type ASPEN_IT_UNKNOWN on a user defined exchange. The user-defined exchanges are currently defined as 0 and 250.

 

On some data feeds symbol names are case sensitive. Aspen Research Group, Ltd. recommends user defined instruments be created using ALL capital letters. Using mixed case symbol names on case insensitive feeds may result in a symbol that is inaccessible.

 

 

Return Value

ASPEN_OK

Instrument successfully created.

ASPEN_SV_SYMBOL_EXISTS

Symbol already defined on the Server.

ASPEN_SV_INTERNAL_DB_ERROR

Illegal character in ticker symbol.

ASPEN_FN_BAD_PARAMETERS

Out-of-range element in quantum definition (base or exponent).

 

 

See Also

ASPEN_GetInstrumentInfo

AspenRequest()

ASPEN_INUM

ASPEN_QUANTUM

ASPEN_CREATEINSTRUMENT_INPUT

quantum

 

 

Example

int CAspenRequestDlg::DoASPEN_CreateInstrument()

{

   ASPEN_CREATEINSTRUMENT_INPUT  instrument;

   server_list                   *slp = list;

   char                          symb[ASPEN_SYMBOL_SIZE], desc[ASPEN_SYMDESC_SIZE];

   int                           retval, xchg, base, exp;

   strcpy(symb,strSymb);

   strcpy(desc,strDesc);

   xchg = atoi(strXchg);

   base = atoi(strBase);

   exp = atoi(strExp);

   instrument.symbol= symb;

   instrument.description= desc;

   instrument.exchange = xchg;

   instrument.quantum.base = base;

   instrument.quantum.exponent = exp;

   retval = AspenRequest(

            slp->server_session,

            ASPEN_CreateInstrument,

            &instrument,

            &a_inum);

   return retval;

}

 

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