Classes Files

com::wombat::mama::MamaPricePrecision

More…

Public Functions

  Name
  MamaPricePrecision(byte value, String text)
String toString()
int precision2Decimals()
int precision2Denom()
MamaPricePrecision decimals2Precision(int places)
MamaPricePrecision denom2Precision(int denominator)

Public Attributes

  Name
final MamaPricePrecision PRECISION_UNKNOWN
final MamaPricePrecision PRECISION_10
final MamaPricePrecision PRECISION_100
final MamaPricePrecision PRECISION_1000
final MamaPricePrecision PRECISION_10000
final MamaPricePrecision PRECISION_100000
final MamaPricePrecision PRECISION_1000000
final MamaPricePrecision PRECISION_10000000
final MamaPricePrecision PRECISION_100000000
final MamaPricePrecision PRECISION_1000000000
final MamaPricePrecision PRECISION_10000000000
final MamaPricePrecision PRECISION_100000000000
final MamaPricePrecision PRECISION_1000000000000
final MamaPricePrecision PRECISION_10000000000000
final MamaPricePrecision PRECISION_100000000000000
final MamaPricePrecision PRECISION_1000000000000000
final MamaPricePrecision PRECISION_INT
final MamaPricePrecision PRECISION_DIV_2
final MamaPricePrecision PRECISION_DIV_4
final MamaPricePrecision PRECISION_DIV_8
final MamaPricePrecision PRECISION_DIV_16
final MamaPricePrecision PRECISION_DIV_32
final MamaPricePrecision PRECISION_DIV_64
final MamaPricePrecision PRECISION_DIV_128
final MamaPricePrecision PRECISION_DIV_256
final MamaPricePrecision PRECISION_DIV_512
final MamaPricePrecision PRECISION_TICK_32
final MamaPricePrecision PRECISION_HALF_32
final MamaPricePrecision PRECISION_QUARTER_32
final MamaPricePrecision PRECISION_TICK_64
final MamaPricePrecision PRECISION_HALF_64
final MamaPricePrecision PRECISION_10000000000000000

Detailed Description

class com::wombat::mama::MamaPricePrecision;

The MamaPricePrecision class determines how decimals are represented for the price. PRECISION_10 - PRECISION_10000000000 represent decimal places. PRECISION_DIV_2, _4, etc, represent fraction 1/2’s ,1/4’s etc.

TICK_32, HALF_32 are for feeds that send prices in 1/32’s and half 1/32’s.

Public Functions Documentation

function MamaPricePrecision

inline MamaPricePrecision(
    byte value,
    String text
)

function toString

inline String toString()

function precision2Decimals

inline int precision2Decimals()

Return the number of decimal places for this precision. Returns 10 for fractional precision for consistency with C API.

function precision2Denom

inline int precision2Denom()

Return the fractional denominator or 0 if the precision is not fractional.

function decimals2Precision

static inline MamaPricePrecision decimals2Precision(
    int places
)

Return the appropriate precision for a given number of decimal places. If places is greater than 10 return Unknown.

function denom2Precision

static inline MamaPricePrecision denom2Precision(
    int denominator
)

Return the appropriate precision code for a given fractional denominator.

Public Attributes Documentation

variable PRECISION_UNKNOWN

static final MamaPricePrecision PRECISION_UNKNOWN =
        new MamaPricePrecision ((byte) 0x00, "UNKNOWN");

variable PRECISION_10

static final MamaPricePrecision PRECISION_10 =
        new MamaPricePrecision ((byte) 0x01, "10");

variable PRECISION_100

static final MamaPricePrecision PRECISION_100 =
        new MamaPricePrecision ((byte) 0x02, "100");

variable PRECISION_1000

static final MamaPricePrecision PRECISION_1000 =
        new MamaPricePrecision ((byte) 0x03, "1000");

variable PRECISION_10000

static final MamaPricePrecision PRECISION_10000 =
        new MamaPricePrecision ((byte) 0x04, "10000");

variable PRECISION_100000

static final MamaPricePrecision PRECISION_100000 =
        new MamaPricePrecision ((byte) 0x05, "100000");

variable PRECISION_1000000

static final MamaPricePrecision PRECISION_1000000 =
        new MamaPricePrecision ((byte) 0x06, "1000000");

variable PRECISION_10000000

static final MamaPricePrecision PRECISION_10000000 =
        new MamaPricePrecision ((byte) 0x07, "10000000");

variable PRECISION_100000000

static final MamaPricePrecision PRECISION_100000000 =
        new MamaPricePrecision ((byte) 0x08, "100000000");

variable PRECISION_1000000000

static final MamaPricePrecision PRECISION_1000000000 =
        new MamaPricePrecision ((byte) 0x09, "1000000000");

variable PRECISION_10000000000

static final MamaPricePrecision PRECISION_10000000000 =
        new MamaPricePrecision ((byte) 0x0a, "10000000000");

variable PRECISION_100000000000

static final MamaPricePrecision PRECISION_100000000000 =
        new MamaPricePrecision ((byte) 0x0b, "100000000000");

variable PRECISION_1000000000000

static final MamaPricePrecision PRECISION_1000000000000 =
        new MamaPricePrecision ((byte) 0x0c, "1000000000000");

variable PRECISION_10000000000000

static final MamaPricePrecision PRECISION_10000000000000 =
        new MamaPricePrecision ((byte) 0x0d, "10000000000000");

variable PRECISION_100000000000000

static final MamaPricePrecision PRECISION_100000000000000 =
        new MamaPricePrecision ((byte) 0x0e, "100000000000000");

variable PRECISION_1000000000000000

static final MamaPricePrecision PRECISION_1000000000000000 =
        new MamaPricePrecision ((byte) 0x0f, "1000000000000000");

variable PRECISION_INT

static final MamaPricePrecision PRECISION_INT =
        new MamaPricePrecision ((byte) 0x10, "INT");

variable PRECISION_DIV_2

static final MamaPricePrecision PRECISION_DIV_2 =
        new MamaPricePrecision ((byte) 0x11, "2");

variable PRECISION_DIV_4

static final MamaPricePrecision PRECISION_DIV_4 =
        new MamaPricePrecision ((byte) 0x12, "4");

variable PRECISION_DIV_8

static final MamaPricePrecision PRECISION_DIV_8 =
        new MamaPricePrecision ((byte) 0x13, "8");

variable PRECISION_DIV_16

static final MamaPricePrecision PRECISION_DIV_16 =
        new MamaPricePrecision ((byte) 0x14, "16");

variable PRECISION_DIV_32

static final MamaPricePrecision PRECISION_DIV_32 =
        new MamaPricePrecision ((byte) 0x15, "32");

variable PRECISION_DIV_64

static final MamaPricePrecision PRECISION_DIV_64 =
        new MamaPricePrecision ((byte) 0x16, "64");

variable PRECISION_DIV_128

static final MamaPricePrecision PRECISION_DIV_128 =
        new MamaPricePrecision ((byte) 0x17, "128");

variable PRECISION_DIV_256

static final MamaPricePrecision PRECISION_DIV_256 =
        new MamaPricePrecision ((byte) 0x18, "256");

variable PRECISION_DIV_512

static final MamaPricePrecision PRECISION_DIV_512 =
        new MamaPricePrecision ((byte) 0x19, "512");

variable PRECISION_TICK_32

static final MamaPricePrecision PRECISION_TICK_32 =
        new MamaPricePrecision ((byte) 0x1a, "TICK_32");

variable PRECISION_HALF_32

static final MamaPricePrecision PRECISION_HALF_32 =
        new MamaPricePrecision ((byte) 0x1b, "HALF_32");

variable PRECISION_QUARTER_32

static final MamaPricePrecision PRECISION_QUARTER_32 =
        new MamaPricePrecision ((byte) 0x1c, "QUARTER_32");

variable PRECISION_TICK_64

static final MamaPricePrecision PRECISION_TICK_64 =
        new MamaPricePrecision ((byte) 0x1d, "TICK_64");

variable PRECISION_HALF_64

static final MamaPricePrecision PRECISION_HALF_64 =
        new MamaPricePrecision ((byte) 0x1e, "HALF_64");

variable PRECISION_10000000000000000

static final MamaPricePrecision PRECISION_10000000000000000 =
        new MamaPricePrecision ((byte) 0x1f, "10000000000000000");

Updated on 2023-03-31 at 15:29:43 +0100