AspenEncodePrice()

 

Related Items

 

 

Purpose

This function converts a price given whole and fractional portions to the ASPEN_PRICE.

 

 

Syntax

#include <aspen.h>

...

int AspenEncodePrice(

   long          whole,

   long          remainder,

   ASPEN_QUANTUM quantum,

   ASPEN_PRICE   *price);

 

 

Parameters

whole

whole is a 32-bit integer value that contains the whole number portion of a price. This value may be positive, negative, or zero.

 

remainder

remainder is a 32-bit integer value that contains the remainder or the numerator of the price’s fractional portion (if any). This value may be positive, negative, or zero.

 

If the sign of remainder does not match the sign of a non-zero value in whole, then the sign of remainder will be adjusted internally to match the sign of whole. If either value is zero, then the sign of the other value determines the sign of the encoded price.

 

For example, to encode a value of -1 3/16, then set whole to -1 and remainder to -3 (or 3). (quantum.base would be set to ASPEN_BINARY and quantum.exponent would be set to 4 (for sixteenths)).

 

quantum

quantum contains the base and the exponent members describing the minimum trading unit associated with the price.

 

*price

*price is a pointer to an ASPEN_PRICE variable which will receive the encoded price value.

 

 

Remarks

None.

 

 

Return Value

ASPEN_OK

if successful

ASPEN_FN_BAD_PARAMETERS

if the component values of quantum were illegal.

 

 

See Also

Price Values

ASPEN_PRICE

ASPEN_QUANTUM

 

 

Example

No example shown here.

 

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