net.commerce.zocalo.history
Class CostAccounter

java.lang.Object
  extended by net.commerce.zocalo.history.CostAccounter

public class CostAccounter
extends java.lang.Object

Compute costs of acquiring positions. Relies on DB Trade and Redemption records. Distinguish costs of buying shares, costs to buy complements when selling, and value of complete sets liquidated, as well as shares redeemed when markets close.


Constructor Summary
CostAccounter(SecureUser user, Market market)
           
 
Method Summary
 Quantity getBuyCost(java.lang.String position)
          How much did the user pay to acquire holdings in position? Doesn't count sales.
 Quantity getBuyQuantity(java.lang.String position)
          How many units of position did the user buy?
 Quantity getCost(java.lang.String pos)
          How much did the user spend acquiring the current holdings in position?
 Quantity getQuantity(java.lang.String pos)
          How much of position does the user hold?
 Quantity getRedemptions(java.lang.String position)
          How many shares of position did the user hold?
 Quantity getRedemptionValue(java.lang.String pos)
          How much did the user receive when the position was closed out?
 Quantity getSellCost(java.lang.String position)
          how much did the user receive by selling position? In a unary market, the user received this much in exchange for coupons already held, otherwise the user spent this amount to acquire complements to position.
 Quantity getSellQuantity(java.lang.String position)
          How many units of position did the user sell? In multi-outcome markets, how many complementary sets did the user sell?
 Quantity totalCost()
          How much did the user pay for current holdings in all positions of this claim?
 Quantity totalRedemptions()
          How many coupons did the user hold in all positions when the claim was settled?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CostAccounter

public CostAccounter(SecureUser user,
                     Market market)
Method Detail

totalCost

public Quantity totalCost()
How much did the user pay for current holdings in all positions of this claim?


totalRedemptions

public Quantity totalRedemptions()
How many coupons did the user hold in all positions when the claim was settled?


getBuyQuantity

public Quantity getBuyQuantity(java.lang.String position)
How many units of position did the user buy?


getBuyCost

public Quantity getBuyCost(java.lang.String position)
How much did the user pay to acquire holdings in position? Doesn't count sales. See getCost() for total cost of holdings.


getSellQuantity

public Quantity getSellQuantity(java.lang.String position)
How many units of position did the user sell? In multi-outcome markets, how many complementary sets did the user sell?


getSellCost

public Quantity getSellCost(java.lang.String position)
how much did the user receive by selling position? In a unary market, the user received this much in exchange for coupons already held, otherwise the user spent this amount to acquire complements to position.


getRedemptions

public Quantity getRedemptions(java.lang.String position)
How many shares of position did the user hold?


getRedemptionValue

public Quantity getRedemptionValue(java.lang.String pos)
How much did the user receive when the position was closed out?


getQuantity

public Quantity getQuantity(java.lang.String pos)
How much of position does the user hold?


getCost

public Quantity getCost(java.lang.String pos)
How much did the user spend acquiring the current holdings in position?