net.commerce.zocalo.market
Class BinaryMarket
java.lang.Object
net.commerce.zocalo.market.Market
net.commerce.zocalo.market.BinaryMarket
- Direct Known Subclasses:
- UnaryMarket
public class BinaryMarket
- extends Market
a Market in a claim; always supports book orders, sometimes supports a marketMaker.
Responsibilities include reporting on price levels and book contents as well as
buying claims.
Fields inherited from class net.commerce.zocalo.market.Market |
maxPrice |
Method Summary |
protected void |
buyAtMarketPrice(Position pos,
Price price,
Quantity quantity,
User user)
|
void |
buyOrAddBookOrder(Position pos,
Price price,
Quantity quantity,
User user)
|
Quantity |
buyWithCostLimit(Position pos,
Price price,
Quantity costLimit,
User user)
|
Quantity |
buyWithCostLimit(Position position,
Price price,
Quantity costLimit,
User user,
boolean isBuy)
|
BinaryClaim |
getBinaryClaim()
|
Claim |
getClaim()
|
java.lang.String |
getName()
|
static BinaryMarket |
make(BinaryClaim claim,
CouponBank couponMint,
SecureUser owner,
java.util.Properties props,
ReserveVerifier verifier,
int scale)
This factory method allows the owner to create unbalanced pairs of coupons. |
static BinaryMarket |
make(BinaryClaim claim,
SecureUser owner,
Funds empty,
Price maxPrice)
|
static BinaryMarket |
make(BinaryClaim claim,
SecureUser owner,
Funds empty,
Price maxPrice,
ReserveVerifier v)
|
static BinaryMarket |
make(BinaryClaim claim,
SecureUser user,
Funds empty,
Quantity maxPrice,
int scale)
|
static BinaryMarket |
make(BinaryClaim claim,
SecureUser owner,
Funds empty,
ReserveVerifier v)
|
static BinaryMarket |
make(SecureUser owner,
BinaryClaim claim,
Funds empty)
|
MarketMaker |
makeMarketMaker(SecureUser owner,
Quantity endowment)
|
MarketMaker |
makeMarketMaker(SecureUser owner,
Quantity endowment,
Probability initialProbability)
|
void |
marketCallBack(MarketCallback callback)
|
Price |
maxPrice()
|
protected void |
postPurchaseActions(Position pos,
User user,
Quantity quantityPurchased)
|
protected Quantity |
purchaseAtMarketPrice(Position pos,
Price price,
Quantity quantity,
User user)
|
void |
recordBookTrade(User acceptor,
Price price,
Quantity quantity,
Position position)
|
void |
recordLimitTrade(Order order,
Quantity quantityTraded,
Position opposite)
|
void |
setClaim(Claim claim)
|
void |
setMaker(MarketMaker maker)
|
Methods inherited from class net.commerce.zocalo.market.Market |
asPrice, asPrice, close, currentPrice, currentProbability, decideClaimAndRecord, describeOutcome, gateKeeper, getBook, getLastTrade, getMaxPrice, getOutcome, getOwner, hasMaker, identifyCouponBank, isOpen, limitOrder, marketOrder, mintBalance, open, outcome, outcomeIsContinuous, printNewCouponSets, requiredReserves, requireReserves, resetBook, scaleToPrice, sellHoldings, setMaxPrice, setOutcome, setOwner, setRequireReserves, setReserveVerifier, settle, setWholeShareTradingOnly, verifyPriceRange, verifyReserves, wholeShareTradingOnly, withholdReserves, withholdReserves |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BinaryMarket
protected BinaryMarket(CouponBank bank,
SecureUser owner,
BinaryClaim claim,
Quantity maxPrice,
int scale)
make
public static BinaryMarket make(SecureUser owner,
BinaryClaim claim,
Funds empty)
make
public static BinaryMarket make(BinaryClaim claim,
SecureUser owner,
Funds empty,
ReserveVerifier v)
make
public static BinaryMarket make(BinaryClaim claim,
SecureUser owner,
Funds empty,
Price maxPrice)
make
public static BinaryMarket make(BinaryClaim claim,
SecureUser owner,
Funds empty,
Price maxPrice,
ReserveVerifier v)
make
public static BinaryMarket make(BinaryClaim claim,
SecureUser user,
Funds empty,
Quantity maxPrice,
int scale)
make
public static BinaryMarket make(BinaryClaim claim,
CouponBank couponMint,
SecureUser owner,
java.util.Properties props,
ReserveVerifier verifier,
int scale)
- This factory method allows the owner to create unbalanced pairs of coupons.
makeMarketMaker
public MarketMaker makeMarketMaker(SecureUser owner,
Quantity endowment)
makeMarketMaker
public MarketMaker makeMarketMaker(SecureUser owner,
Quantity endowment,
Probability initialProbability)
getClaim
public Claim getClaim()
- Specified by:
getClaim
in class Market
getBinaryClaim
public BinaryClaim getBinaryClaim()
getName
public java.lang.String getName()
- Overrides:
getName
in class Market
setClaim
public void setClaim(Claim claim)
- Specified by:
setClaim
in class Market
buyOrAddBookOrder
public void buyOrAddBookOrder(Position pos,
Price price,
Quantity quantity,
User user)
throws DuplicateOrderException
- Specified by:
buyOrAddBookOrder
in class Market
- Throws:
DuplicateOrderException
buyAtMarketPrice
protected void buyAtMarketPrice(Position pos,
Price price,
Quantity quantity,
User user)
- Specified by:
buyAtMarketPrice
in class Market
purchaseAtMarketPrice
protected Quantity purchaseAtMarketPrice(Position pos,
Price price,
Quantity quantity,
User user)
postPurchaseActions
protected void postPurchaseActions(Position pos,
User user,
Quantity quantityPurchased)
buyWithCostLimit
public Quantity buyWithCostLimit(Position position,
Price price,
Quantity costLimit,
User user,
boolean isBuy)
- Specified by:
buyWithCostLimit
in class Market
marketCallBack
public void marketCallBack(MarketCallback callback)
- Specified by:
marketCallBack
in class Market
setMaker
public void setMaker(MarketMaker maker)
- Specified by:
setMaker
in class Market
buyWithCostLimit
public Quantity buyWithCostLimit(Position pos,
Price price,
Quantity costLimit,
User user)
recordLimitTrade
public void recordLimitTrade(Order order,
Quantity quantityTraded,
Position opposite)
- Specified by:
recordLimitTrade
in class Market
recordBookTrade
public void recordBookTrade(User acceptor,
Price price,
Quantity quantity,
Position position)
- Specified by:
recordBookTrade
in class Market
maxPrice
public Price maxPrice()
- Specified by:
maxPrice
in class Market