net.commerce.zocalo.user
Class User
java.lang.Object
net.commerce.zocalo.user.Warnable
net.commerce.zocalo.user.User
- Direct Known Subclasses:
- SecureUser
public class User
- extends Warnable
The agent who trades in the market. Users have accounts, which track their assets, which
consist of funds and coupons.
Constructor Summary |
User(java.lang.String name,
Funds funds)
|
Method Summary |
void |
add(Order order)
|
boolean |
canAfford(Position pos,
Quantity quantity,
Price price,
Quantity outstandingOrderCost)
|
Quantity |
cashOnHand()
|
boolean |
cashSameOrGreaterThan(Quantity amount)
|
java.util.Collection<Position> |
claimsWithAssets()
|
Quantity |
couponCount(Claim claim)
|
Quantity |
couponCount(Position position)
|
void |
displayAccounts(java.lang.StringBuffer buf,
Accounts.PositionDisplayAdaptor printer)
|
void |
displayAccounts(java.lang.StringBuffer buf,
Claim claim,
Accounts.PositionDisplayAdaptor printer)
|
void |
displayMultiMarketAccounts(java.lang.StringBuffer buf,
Claim claim,
Accounts.PositionDisplayAdaptor printer)
|
void |
endow(Coupons balance)
|
Accounts |
getAccounts()
|
java.lang.String |
getHint()
|
java.lang.String |
getName()
|
java.util.List |
getOrders()
|
Quantity |
minCouponsVersus(Position pos)
|
boolean |
negligibleCashOnHand()
|
Quantity |
outstandingAskQuantity(Position pos)
|
Quantity |
outstandingOrderCost(Position pos)
|
Funds |
provideCash(Quantity amount)
|
void |
receiveCash(Funds payment)
|
void |
reduceReservesTo(Quantity perShare,
Position pos)
|
Funds |
releaseDividends(Quantity shares,
Quantity perShareDividend,
Position pos)
we're paying dividends of PERSHAREDIVIDEND on SHARES shares |
Quantity |
releaseReserves(Quantity total,
Position pos)
we covered the position for TOTAL shares, so the reserves are no longer needed |
void |
remove(Order order)
|
void |
reportBookPurchase(Quantity quant,
Position pos)
|
void |
reportMarketMakerPurchase(Quantity quant,
Position pos,
boolean isBuy)
|
Quantity |
reserveBalance(Position pos)
|
boolean |
reserveFunds(Quantity amount,
Quantity quantity,
Position pos)
|
void |
resetOutstandingOrders()
|
void |
setHint(java.lang.String hint)
|
void |
settle(Market market)
|
java.lang.String |
toString()
|
boolean |
useCostLimitUI()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
User
public User(java.lang.String name,
Funds funds)
cashOnHand
public Quantity cashOnHand()
getAccounts
public Accounts getAccounts()
getName
public java.lang.String getName()
- Specified by:
getName
in class Warnable
receiveCash
public void receiveCash(Funds payment)
endow
public void endow(Coupons balance)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
cashSameOrGreaterThan
public boolean cashSameOrGreaterThan(Quantity amount)
negligibleCashOnHand
public boolean negligibleCashOnHand()
claimsWithAssets
public java.util.Collection<Position> claimsWithAssets()
displayAccounts
public void displayAccounts(java.lang.StringBuffer buf,
Accounts.PositionDisplayAdaptor printer)
displayMultiMarketAccounts
public void displayMultiMarketAccounts(java.lang.StringBuffer buf,
Claim claim,
Accounts.PositionDisplayAdaptor printer)
displayAccounts
public void displayAccounts(java.lang.StringBuffer buf,
Claim claim,
Accounts.PositionDisplayAdaptor printer)
settle
public void settle(Market market)
add
public void add(Order order)
getOrders
public java.util.List getOrders()
getHint
public java.lang.String getHint()
setHint
public void setHint(java.lang.String hint)
remove
public void remove(Order order)
outstandingOrderCost
public Quantity outstandingOrderCost(Position pos)
outstandingAskQuantity
public Quantity outstandingAskQuantity(Position pos)
resetOutstandingOrders
public void resetOutstandingOrders()
canAfford
public boolean canAfford(Position pos,
Quantity quantity,
Price price,
Quantity outstandingOrderCost)
provideCash
public Funds provideCash(Quantity amount)
couponCount
public Quantity couponCount(Claim claim)
couponCount
public Quantity couponCount(Position position)
useCostLimitUI
public boolean useCostLimitUI()
reportBookPurchase
public void reportBookPurchase(Quantity quant,
Position pos)
reportMarketMakerPurchase
public void reportMarketMakerPurchase(Quantity quant,
Position pos,
boolean isBuy)
minCouponsVersus
public Quantity minCouponsVersus(Position pos)
reserveFunds
public boolean reserveFunds(Quantity amount,
Quantity quantity,
Position pos)
reserveBalance
public Quantity reserveBalance(Position pos)
releaseReserves
public Quantity releaseReserves(Quantity total,
Position pos)
- we covered the position for TOTAL shares, so the reserves are no longer needed
reduceReservesTo
public void reduceReservesTo(Quantity perShare,
Position pos)
releaseDividends
public Funds releaseDividends(Quantity shares,
Quantity perShareDividend,
Position pos)
- we're paying dividends of PERSHAREDIVIDEND on SHARES shares