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.
|
Method Summary |
void |
buy(Position pos,
double price,
double quantity,
User user,
boolean marketOrder)
|
double |
buyWithCostLimit(Position pos,
double price,
double costLimit,
User user)
|
double |
buyWithCostLimit(Position position,
double price,
double costLimit,
User user,
boolean isBuy)
|
double |
fullScale(double price)
|
BinaryClaim |
getBinaryClaim()
|
Claim |
getClaim()
|
double |
getMaxPrice()
|
java.lang.String |
getName()
|
double |
invertAndFullScale(double price)
|
double |
invertAndScaleToOne(double price)
|
static BinaryMarket |
make(BinaryClaim claim,
CouponBank couponMint,
SecureUser owner,
java.util.Properties props,
ReserveVerifier verifier)
This factory method allows the owner to create unbalanced pairs of coupons. |
static BinaryMarket |
make(BinaryClaim claim,
SecureUser owner,
Funds empty,
double maxPrice)
|
static BinaryMarket |
make(BinaryClaim claim,
SecureUser owner,
Funds empty,
double maxPrice,
ReserveVerifier v)
|
static BinaryMarket |
make(SecureUser owner,
BinaryClaim claim,
Funds empty)
|
static BinaryMarket |
make(SecureUser owner,
BinaryClaim claim,
Funds empty,
ReserveVerifier v)
|
MarketMaker |
makeMarketMaker(SecureUser owner,
double endowment)
|
MarketMaker |
makeMarketMaker(SecureUser owner,
double endowment,
double initialProbability)
|
void |
marketCallBack(MarketCallback callback)
|
void |
recordBookTrade(User acceptor,
double price,
double quantity,
Position position)
|
void |
recordLimitTrade(Order order,
double quantityTraded,
Position opposite)
|
double |
scaleToOne(double price)
|
void |
setClaim(Claim claim)
|
void |
setMaker(MarketMaker maker)
|
void |
setMaxPrice(double maxPrice)
Deprecated. |
boolean |
verifyPriceRange(double price)
|
| Methods inherited from class net.commerce.zocalo.market.Market |
close, currentProbability, decideClaimAndRecord, describeOutcome, getBook, getLastTrade, getOutcome, getOwner, hasMaker, identifyCouponBank, isOpen, limitOrder, marketOrder, mintBalance, negligible, open, outcome, outcomeIsContinuous, printNewCouponSets, requiredReserves, requireReserves, resetBook, sellHoldings, setOutcome, setOwner, setRequireReserves, setReserveVerifier, settle, setWholeShareTradingOnly, verifyReserves, wholeShareTradingOnly, withholdReserves, withholdReserves |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
make
public static BinaryMarket make(SecureUser owner,
BinaryClaim claim,
Funds empty)
make
public static BinaryMarket make(SecureUser owner,
BinaryClaim claim,
Funds empty,
ReserveVerifier v)
make
public static BinaryMarket make(BinaryClaim claim,
SecureUser owner,
Funds empty,
double maxPrice)
make
public static BinaryMarket make(BinaryClaim claim,
SecureUser owner,
Funds empty,
double maxPrice,
ReserveVerifier v)
make
public static BinaryMarket make(BinaryClaim claim,
CouponBank couponMint,
SecureUser owner,
java.util.Properties props,
ReserveVerifier verifier)
- This factory method allows the owner to create unbalanced pairs of coupons.
makeMarketMaker
public MarketMaker makeMarketMaker(SecureUser owner,
double endowment)
makeMarketMaker
public MarketMaker makeMarketMaker(SecureUser owner,
double endowment,
double 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
buy
public void buy(Position pos,
double price,
double quantity,
User user,
boolean marketOrder)
throws DuplicateOrderException
- Specified by:
buy in class Market
- Throws:
DuplicateOrderException
buyWithCostLimit
public double buyWithCostLimit(Position position,
double price,
double 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 double buyWithCostLimit(Position pos,
double price,
double costLimit,
User user)
recordLimitTrade
public void recordLimitTrade(Order order,
double quantityTraded,
Position opposite)
- Specified by:
recordLimitTrade in class Market
recordBookTrade
public void recordBookTrade(User acceptor,
double price,
double quantity,
Position position)
- Specified by:
recordBookTrade in class Market
fullScale
public double fullScale(double price)
- Overrides:
fullScale in class Market
verifyPriceRange
public boolean verifyPriceRange(double price)
- Overrides:
verifyPriceRange in class Market
scaleToOne
public double scaleToOne(double price)
- Overrides:
scaleToOne in class Market
invertAndScaleToOne
public double invertAndScaleToOne(double price)
invertAndFullScale
public double invertAndFullScale(double price)
- Overrides:
invertAndFullScale in class Market
setMaxPrice
public void setMaxPrice(double maxPrice)
- Deprecated.
getMaxPrice
public double getMaxPrice()
- Overrides:
getMaxPrice in class Market