cambl
A library for working with financial amounts involving multiple commodities.
CAMBL

Struct
COMMODITYPOOL

BYNAMEMAP

DEFAULTCOMMODITY


Function
MAKECOMMODITYPOOL
(&key ((bynamemap bynamemap) (makehashtable :test 'equal)) ((defaultcommodity defaultcommodity) nil)) 
Variable
*DEFAULTCOMMODITYPOOL*
(cambl:makecommoditypool)

Variable
*DEFAULTDISPLAYPRECISION*
3

Variable
*EXTRAPRECISION*
6

Struct
COMMODITYANNOTATION

PRICE

DATE

TAG


Function
ANNOTATIONPRICE
(instance) 
Function
(setf ANNOTATIONPRICE)
(value instance) 
Function
ANNOTATIONDATE
(instance) 
Function
(setf ANNOTATIONDATE)
(value instance) 
Function
ANNOTATIONTAG
(instance) 
Function
(setf ANNOTATIONTAG)
(value instance) 
Function
MAKECOMMODITYANNOTATION
(&key ((price price) nil) ((date date) nil) ((tag tag) nil)) 
Class
ANNOTATEDCOMMODITY
(COMMODITY
)
REFERENT
Accessor:GETREFERENT

ANNOTATION
Accessor:GETCOMMODITYANNOTATION


Function
ANNOTATEDCOMMODITYP
(object) 
Struct
AMOUNT

COMMODITY

QUANTITY

FULLPRECISION

KEEPPRECISIONP


Function
AMOUNTP
(object) 
Function
AMOUNTCOMMODITY
(instance) 
Function
(setf AMOUNTCOMMODITY)
(value instance) 
Function
AMOUNTQUANTITY
(instance) 
Function
(setf AMOUNTQUANTITY)
(value instance) 
Function
AMOUNTKEEPPRECISIONP
(instance) 
Function
(setf AMOUNTKEEPPRECISIONP)
(value instance) 
Function
BALANCEP
(object) 
Function
GETAMOUNTSMAP
(instance) 
Function
(setf GETAMOUNTSMAP)
(value instance) 
Type
VALUE

Function
VALUEP
(object) 
GenericFunction
VALUEZEROP
(value) 
GenericFunction
VALUEZEROP*
(value) 
GenericFunction
VALUEMINUSP
(value) 
GenericFunction
VALUEMINUSP*
(value) 
GenericFunction
VALUEPLUSP
(value) 
GenericFunction
VALUEPLUSP*
(value) 
GenericFunction
COMPARE
(left right) 
GenericFunction
COMPARE*
(left right) 
GenericFunction
VALUEEQUAL
(left right) 
GenericFunction
VALUEEQUALP
(left right) 
GenericFunction
VALUENOTEQUAL
(left right) 
GenericFunction
VALUENOTEQUALP
(left right) 
GenericFunction
VALUE=
(left right) 
GenericFunction
VALUE/=
(left right) 
GenericFunction
VALUEABS
(value) 
GenericFunction
NEGATE
(value) 
GenericFunction
ADD
(valuea valueb) 
GenericFunction
SUBTRACT
(valuea valueb) 
GenericFunction
MULTIPLY
(valuea valueb) 
GenericFunction
DIVIDE
(valuea valueb) 
GenericFunction
PRINTVALUE
(value &key outputstream omitcommodityp fullprecisionp width latterwidth linefeedstring) 
GenericFunction
FORMATVALUE
(value &key omitcommodityp fullprecisionp width latterwidth linefeedstring) 
GenericFunction
COMMODITYNAME
(item &optional noannotation) 
GenericFunction
DISPLAYPRECISION
(item) 
GenericFunction
AMOUNTPRECISION
(item) 
GenericFunction
MARKETVALUE
(anyitem &optional fixedtime) 
GenericFunction
COMMODITYANNOTATION
(item) 
GenericFunction
COMMODITYANNOTATIONEQUAL
(leftitem rightitem) 
GenericFunction
ANNOTATECOMMODITY
(item annotation) 
GenericFunction
STRIPANNOTATIONS
(anyitem &key keepprice keepdate keeptag) 
Function
COMMODITYTHOUSANDMARKSP
(comm) 
Function
COMMODITYEUROPEANSTYLEP
(comm) 
Function
COMMODITYNOMARKETPRICEP
(comm) 
Function
COMMODITYBUILTINP
(comm) 
Function
COMMODITYPRICEHISTORY
(comm) 
Function
COMMODITYPOOL
(comm) 
Condition
AMOUNTERROR
(ERROR
) 
Method
AMOUNTPRECISION
((item rational)) 
Method
AMOUNTPRECISION
((item amount)) 
Function
AMOUNT
(string &key (pool *defaultcommoditypool*)) 
Function
AMOUNT*
(string &key (pool *defaultcommoditypool*)) 
Function
PARSEAMOUNT
(&rest args) 
Function
PARSEAMOUNT*
(&rest args) 
Function
EXACTAMOUNT
(string &key (pool *defaultcommoditypool*)) 
Function
VALUEMAYBEROUND
(amount) 
Method
VALUEZEROP
((rational rational)) 
Method
VALUEZEROP
((amount amount)) 
Method
VALUEZEROP*
((rational rational)) 
Method
VALUEZEROP*
((amount amount)) 
Method
VALUEMINUSP
((rational rational)) 
Method
VALUEMINUSP
((amount amount)) 
Method
VALUEMINUSP*
((rational rational)) 
Method
VALUEMINUSP*
((amount amount)) 
Method
VALUEPLUSP
((rational rational)) 
Method
VALUEPLUSP
((amount amount)) 
Method
VALUEPLUSP*
((rational rational)) 
Method
VALUEPLUSP*
((amount amount)) 
Function
COMMODITYEQUAL
(a b)Two commodities are EQUAL if they are the same object. 
Function
COMMODITYEQUALP
(a b) 
Method
VALUEEQUAL
((left rational) (right rational)) 
Method
VALUEEQUAL
((left rational) (right amount)) 
Method
VALUEEQUAL
((left rational) (right balance)) 
Method
VALUEEQUAL
((left amount) (right rational)) 
Method
VALUEEQUAL
((left amount) (right amount)) 
Method
VALUEEQUAL
((left amount) (right balance)) 
Method
VALUEEQUAL
((left balance) (right rational)) 
Method
VALUEEQUAL
((left balance) (right amount)) 
Method
VALUEEQUAL
((left balance) (right balance)) 
Method
VALUEEQUALP
((left rational) (right rational)) 
Method
VALUEEQUALP
((left rational) (right amount)) 
Method
VALUEEQUALP
((left rational) (right balance)) 
Method
VALUEEQUALP
((left amount) (right rational)) 
Method
VALUEEQUALP
((left amount) (right amount)) 
Method
VALUEEQUALP
((left amount) (right balance)) 
Method
VALUEEQUALP
((left balance) (right rational)) 
Method
VALUEEQUALP
((left balance) (right amount)) 
Method
VALUEEQUALP
((left balance) (right balance)) 
Method
VALUENOTEQUAL
((left rational) (right rational)) 
Method
VALUENOTEQUAL
((left rational) (right amount)) 
Method
VALUENOTEQUAL
((left rational) (right balance)) 
Method
VALUENOTEQUAL
((left amount) (right rational)) 
Method
VALUENOTEQUAL
((left amount) (right amount)) 
Method
VALUENOTEQUAL
((left amount) (right balance)) 
Method
VALUENOTEQUAL
((left balance) (right rational)) 
Method
VALUENOTEQUAL
((left balance) (right amount)) 
Method
VALUENOTEQUAL
((left balance) (right balance)) 
Method
VALUENOTEQUALP
((left rational) (right rational)) 
Method
VALUENOTEQUALP
((left rational) (right amount)) 
Method
VALUENOTEQUALP
((left rational) (right balance)) 
Method
VALUENOTEQUALP
((left amount) (right rational)) 
Method
VALUENOTEQUALP
((left amount) (right amount)) 
Method
VALUENOTEQUALP
((left amount) (right balance)) 
Method
VALUENOTEQUALP
((left balance) (right rational)) 
Method
VALUENOTEQUALP
((left balance) (right amount)) 
Method
VALUENOTEQUALP
((left balance) (right balance)) 
Method
VALUE=
((left rational) (right rational)) 
Method
VALUE=
((left rational) (right amount)) 
Method
VALUE=
((left rational) (right balance)) 
Method
VALUE=
((left amount) (right rational)) 
Method
VALUE=
((left amount) (right amount)) 
Method
VALUE=
((left amount) (right balance)) 
Method
VALUE=
((left balance) (right rational)) 
Method
VALUE=
((left balance) (right amount)) 
Method
VALUE=
((left balance) (right balance)) 
Method
VALUE/=
((left rational) (right rational)) 
Method
VALUE/=
((left rational) (right amount)) 
Method
VALUE/=
((left rational) (right balance)) 
Method
VALUE/=
((left amount) (right rational)) 
Method
VALUE/=
((left amount) (right amount)) 
Method
VALUE/=
((left amount) (right balance)) 
Method
VALUE/=
((left balance) (right rational)) 
Method
VALUE/=
((left balance) (right amount)) 
Method
VALUE/=
((left balance) (right balance)) 
Function
VALUELESSP
(left right) 
Function
VALUELESSP*
(left right) 
Function
VALUELESSEQP
(left right) 
Function
VALUELESSEQP*
(left right) 
Function
VALUE<
(left right) 
Function
VALUE<=
(left right) 
Function
VALUEGREATERP
(left right) 
Function
VALUEGREATERP*
(left right) 
Function
VALUEGREATEREQP
(left right) 
Function
VALUEGREATEREQP*
(left right) 
Function
VALUE>
(left right) 
Function
VALUE>=
(left right) 
Method
VALUEABS
((rational rational)) 
Method
VALUEABS
((amount amount)) 
Method
VALUEABS
((balance balance)) 
Function
VALUEROUND
(amount &optional precision)Round the given AMOUNT to the stated PRECISION. If PRECISION is less than the current internal precision, data will be lost. If it is greater, this operation has no effect. 
Method
NEGATE
((rational rational)) 
Method
NEGATE
((amount amount)) 
Method
NEGATE
((balance balance)) 
Function
AMOUNTINBALANCE
(balance commodity) 
Method
ADD
((left rational) (right rational)) 
Method
ADD
((left rational) (right amount)) 
Method
ADD
((left rational) (right balance)) 
Method
ADD
((left amount) (right rational)) 
Method
ADD
((left amount) (right amount)) 
Method
ADD
((left amount) (right balance)) 
Method
COMPARE
((left rational) (right rational)) 
Method
COMPARE
((left amount) (right rational)) 
Method
COMPARE
((left rational) (right amount)) 
Method
COMPARE
((left amount) (right amount)) 
Method
COMPARE*
((left rational) (right rational)) 
Method
COMPARE*
((left amount) (right rational)) 
Method
COMPARE*
((left rational) (right amount)) 
Method
COMPARE*
((left amount) (right amount)) 
Function
SIGN
(amount)Return 1, 0 or 1 depending on the sign of AMOUNT. 
Function
SIGN*
(amount)Return 1, 0 or 1 depending on the sign of AMOUNT. 
Function
FINDANNOTATEDCOMMODITY
(nameorcommodity details &key (createifnotexistsp nil) (pool *defaultcommoditypool*))Find an annotated commodity matching the commodity symbol NAME, which may be a STRING or a COMMODITYSYMBOL, and given set of commodity DETAILS, of type COMMODITYANNOTATION. Returns two values: COMMODITY or NIL, NEWLYCREATEDP 
Function
READAMOUNT
(in &key (observepropertiesp t) (pool *defaultcommoditypool*))Parse an AMOUNT from the input stream IN. If :OBSERVEPROPERTIESP is T (the default), any display details noticed in this amount will be set as defaults for displaying this kind of commodity in the future. If :POOL is set, any commodities created by this routine (a maximum possible of two, if an annotated price is given with a second commodity) will be associated with the given commodity pool. The possible syntax for an amount is: []NUM[ ]SYM [ANNOTATION] SYM[ ][]NUM [ANNOTATION] 
Function
READAMOUNT*
(in &key (pool *defaultcommoditypool*)) 
Function
READEXACTAMOUNT
(in &key (pool *defaultcommoditypool*)) 
Function
BALANCECOMMODITIES
(balance) 
Function
BALANCEAMOUNTS
(balance) 
Function
BALANCEFIRSTAMOUNT
(balance) 
Function
BALANCECOMMODITYCOUNT
(balance) 
Function
COMMODITYLESSP
(left right)Return T if commodity LEFT should be sorted before RIGHT. 
Method
ADD
((left balance) (right rational)) 
Method
ADD
((left balance) (right amount)) 
Method
ADD
((left balance) (right balance)) 
Method
SUBTRACT
((left rational) (right rational)) 
Method
SUBTRACT
((left rational) (right amount)) 
Method
SUBTRACT
((left rational) (right balance)) 
Method
SUBTRACT
((left amount) (right rational)) 
Method
SUBTRACT
((left amount) (right amount)) 
Method
SUBTRACT
((left amount) (right balance)) 
Method
SUBTRACT
((left balance) (right rational)) 
Method
SUBTRACT
((left balance) (right amount)) 
Method
SUBTRACT
((left balance) (right balance)) 
Method
MULTIPLY
((left rational) (right rational)) 
Method
MULTIPLY
((left rational) (right amount)) 
Method
MULTIPLY
((left rational) (right balance)) 
Method
MULTIPLY
((left amount) (right rational)) 
Method
MULTIPLY
((left amount) (right amount)) 
Method
MULTIPLY
((left balance) (right rational)) 
Method
MULTIPLY
((left balance) (right amount)) 
Method
DIVIDE
((left rational) (right rational)) 
Method
DIVIDE
((left rational) (right amount)) 
Method
DIVIDE
((left rational) (right balance)) 
Method
DIVIDE
((left amount) (right rational)) 
Method
DIVIDE
((left amount) (right amount)) 
Method
DIVIDE
((left balance) (right rational)) 
Method
DIVIDE
((left balance) (right amount)) 
Method
PRINTVALUE
((integer integer) &key (outputstream *standardoutput*) omitcommodityp fullprecisionp (width nil) latterwidth linefeedstring) 
Method
PRINTVALUE
((rational rational) &key (outputstream *standardoutput*) omitcommodityp fullprecisionp (width nil) latterwidth linefeedstring) 
Method
PRINTVALUE
((amount amount) &key (outputstream *standardoutput*) (omitcommodityp nil) (fullprecisionp nil) (width nil) latterwidth linefeedstring) 
Function
COMPAREAMOUNTSVISUALLY
(left right) 
Method
PRINTVALUE
((balance balance) &key (outputstream *standardoutput*) (omitcommodityp nil) (fullprecisionp nil) (width 12) (latterwidth nil) (linefeedstring (format nil "~c" #\newline))) 
Method
FORMATVALUE
((rational rational) &key omitcommodityp fullprecisionp (width nil) latterwidth linefeedstring) 
Method
FORMATVALUE
((amount amount) &key (omitcommodityp nil) (fullprecisionp nil) (width nil) latterwidth linefeedstring) 
Method
FORMATVALUE
((balance balance) &key (omitcommodityp nil) (fullprecisionp nil) (width nil) (latterwidth nil) (linefeedstring (format nil "~c" #\newline))) 
Condition
COMMODITYERROR
(ERROR
) 
Method
COMMODITYNAME
((null null) &optional noannotation) 
Method
COMMODITYNAME
((commodity commodity) &optional noannotation) 
Method
COMMODITYNAME
((amount amount) &optional noannotation) 
Method
DISPLAYPRECISION
((commodity commodity)) 
Method
DISPLAYPRECISION
((annotatedcommodity annotatedcommodity)) 
Method
DISPLAYPRECISION
((amount amount)) 
Method
MARKETVALUE
((commodity commodity) &optional fixedtime) 
Method
MARKETVALUE
((annotatedcommodity annotatedcommodity) &optional fixedtime) 
Method
MARKETVALUE
((rational rational) &optional fixedtime) 
Method
MARKETVALUE
((amount amount) &optional fixedtime) 
Method
MARKETVALUE
((balance balance) &optional fixedtime) 
Function
EXCHANGECOMMODITY
(amount &key (totalcost nil) (perunitcost nil) (moment nil) (tag nil)) 
Function
RESETCOMMODITYPOOL
(&optional pool) 
Macro
PUSHEND
(item thelist &optional finalcons) 
Function
FINDCOMMODITY
(name &key (createifnotexistsp nil) (pool *defaultcommoditypool*))Find a COMMODITY identifier by the symbol name found by parsing NAME. The NAME can be either a string or an input stream, or nil, in which case the name is read from *STANDARDINPUT*. The argument :POOL specifies the commodity pool which will maintain this commodity, and by which other code may access it again. The argument :CREATEIFNOTEXISTSP indicates whether a new commodity should be created if one cannot already be found. The return values are: COMMODITY or NIL, NEWLYCREATEDP 
Method
ANNOTATECOMMODITY
((commodity commodity) (details commodityannotation)) 
Method
ANNOTATECOMMODITY
((amount amount) (details commodityannotation)) 
Method
COMMODITYANNOTATION
((commodity commodity)) 
Method
COMMODITYANNOTATION
((annotatedcommodity annotatedcommodity)) 
Method
COMMODITYANNOTATION
((amount amount)) 
Method
COMMODITYANNOTATIONEQUAL
((a commodityannotation) (b commodityannotation)) 
Method
STRIPANNOTATIONS
((annotatedcommodity annotatedcommodity) &key keepprice keepdate keeptag) 
Method
STRIPANNOTATIONS
((amount amount) &key keepprice keepdate keeptag) 
Method
STRIPANNOTATIONS
((balance balance) &key keepprice keepdate keeptag)