New classes for processing offers in order books:

* BookTip provides consume-and-step offer traversal
* OfferStream applies offer business rules and presents offers to callers
* Taker class manages state for the active party during order processing
* Offer class wraps book offers for presentation
This commit is contained in:
Vinnie Falco
2014-04-02 14:26:38 -07:00
parent 53bf5e7f36
commit 04ea9ff74c
18 changed files with 1094 additions and 46 deletions

View File

@@ -635,8 +635,10 @@ public:
{
if (!isZero ()) mIsNegative = !mIsNegative;
}
void zero ()
{
// VFALCO: Why -100?
mOffset = mIsNative ? 0 : -100;
mValue = 0;
mIsNegative = false;
@@ -733,6 +735,11 @@ public:
return multiply (v1, v2, v1);
}
/* addRound, subRound can end up rounding if the amount subtracted is too small
to make a change. Consder (X-d) where d is very small relative to X.
If you ask to round down, then (X-d) should not be X unless d is zero.
If you ask to round up, (X+d) should never be X unless d is zero. (Assuming X and d are positive).
*/
// Add, subtract, multiply, or divide rounding result in specified direction
static STAmount addRound (const STAmount& v1, const STAmount& v2, bool roundUp);
static STAmount subRound (const STAmount& v1, const STAmount& v2, bool roundUp);