net.commerce.zocalo.rpc
Class RPCServer.RPCHandler

java.lang.Object
  extended by net.commerce.zocalo.rpc.RPCServer.RPCHandler
Enclosing class:
RPCServer

public static class RPCServer.RPCHandler
extends java.lang.Object

RPCHandler class specifies the namespace and actual interface available for external XML-RPC calls


Constructor Summary
RPCServer.RPCHandler()
           
 
Method Summary
 java.lang.String closeMarket(java.lang.String userName, java.lang.String marketName, java.lang.String position)
           
 java.lang.String createMarket(java.lang.String userName, java.lang.String marketName, java.lang.String outcomes, java.lang.String description, int endowAMM)
           
 Quantity getCurrentBalance(java.lang.String userName)
          Get current cash balance of the specified user
 Price getMarketMakerPrice(java.lang.String marketName, java.lang.String positionName)
          This method responds with a Double, the price that the market maker is offering.
 java.lang.String grantCash(java.lang.String userName, java.math.BigDecimal amt)
          This method adds an arbitrary amount of money to a user's account.
 java.lang.String tradeClaim(java.lang.String userName, java.lang.String marketName, java.lang.String buySell, java.lang.String position, Price price, int shares)
           
 java.lang.String transferCash(java.lang.String fromUserName, java.lang.String toUserName, java.math.BigDecimal amt)
          Transfer a positive balance from one user account to another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RPCServer.RPCHandler

public RPCServer.RPCHandler()
Method Detail

grantCash

public java.lang.String grantCash(java.lang.String userName,
                                  java.math.BigDecimal amt)
This method adds an arbitrary amount of money to a user's account. It shouldn't be available in production environments, but is necessary when dealing with unreliable agent code.

Parameters:
userName - to receive the new cash
amt - of cash to receive
Returns:
result "ERROR:" or "SUCCESS:" followed with human-readable details

closeMarket

public java.lang.String closeMarket(java.lang.String userName,
                                    java.lang.String marketName,
                                    java.lang.String position)

createMarket

public java.lang.String createMarket(java.lang.String userName,
                                     java.lang.String marketName,
                                     java.lang.String outcomes,
                                     java.lang.String description,
                                     int endowAMM)

tradeClaim

public java.lang.String tradeClaim(java.lang.String userName,
                                   java.lang.String marketName,
                                   java.lang.String buySell,
                                   java.lang.String position,
                                   Price price,
                                   int shares)

getMarketMakerPrice

public Price getMarketMakerPrice(java.lang.String marketName,
                                 java.lang.String positionName)
This method responds with a Double, the price that the market maker is offering.

Parameters:
marketName - the market for which
Returns:
marketMakerPrice price offered by Automated Market Maker, or null in case of error

transferCash

public java.lang.String transferCash(java.lang.String fromUserName,
                                     java.lang.String toUserName,
                                     java.math.BigDecimal amt)
Transfer a positive balance from one user account to another.

Parameters:
fromUserName -
toUserName -
amt -
Returns:
result "ERROR:" or "SUCCESS:" followed with human-readable details

getCurrentBalance

public Quantity getCurrentBalance(java.lang.String userName)
Get current cash balance of the specified user

Parameters:
userName -
Returns:
cash balance of user, or null in case of error