Module Expr Str Import alias ImportFrom alias ImportFrom alias alias ImportFrom alias ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad TryExcept body Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num handlers ExceptHandler type TupleLoad NameLoad NameLoad body Raise NameLoad Str TryExcept body Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num handlers ExceptHandler type NameLoad body Raise NameLoad Str Delete AttributeDel NameLoad attr Assign AttributeStore NameLoad attr ListLoad BinOpDiv AttributeLoad NameLoad attr Num NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If BoolOpAnd CompareGt AttributeLoad NameLoad attr Num CompareGt AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad orelse If CompareLtE AttributeLoad NameLoad attr Num body Assign NameStore NameLoad orelse Assign NameStore NameLoad If NameLoad body If SubscriptLoad AttributeLoad NameLoad attr Index Num body Assign NameStore BinOpDiv Call AttributeLoad NameLoad attr Call NameLoad BinOpMult SubscriptLoad AttributeLoad NameLoad attr Index Num Num BinOpMult AttributeLoad NameLoad attr Num Num orelse Assign NameStore BinOpDiv Call AttributeLoad NameLoad attr Num Call NameLoad BinOpMult SubscriptLoad AttributeLoad NameLoad attr Index Num Num Num Assign NameStore Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr orelse If SubscriptLoad AttributeLoad NameLoad attr Index Num body Assign NameStore BinOpDiv Call AttributeLoad NameLoad attr Num Call NameLoad BinOpMult SubscriptLoad AttributeLoad NameLoad attr Index Num Num Num orelse Assign NameStore BinOpDiv Call AttributeLoad NameLoad attr Call NameLoad BinOpMult SubscriptLoad AttributeLoad NameLoad attr Index Num Num BinOpMult AttributeLoad NameLoad attr Num Num Assign NameStore Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr ListLoad NameLoad NameLoad Return Dict Str Str Str NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str If NameLoad body AugAssignSub AttributeStore NameLoad attr NameLoad AugAssignAdd AttributeStore NameLoad attr BinOpMult NameLoad NameLoad orelse AugAssignAdd AttributeStore NameLoad attr NameLoad AugAssignSub AttributeStore NameLoad attr BinOpMult NameLoad NameLoad Assign AttributeStore NameLoad attr ListLoad NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args defaults body Expr Str Import alias Expr Call AttributeLoad NameLoad attr keyword UnaryOpUAdd AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A 
Module defining ProbeAdjustBSTrader agent class.
 N/A random fms agents fms.utils BUY SELL fms.utils.exceptions MissingParameter ProbeAdjustBSTrader N/A N/A agents Agent N/A N/A 
    Simulate an agent probing and adjusting
    with shared data for BUY, SELL orders

    This agent subclass should have two keys in the
    args dict :
    - maxprice : maximum order price (float)
    - maxbuy : maximum quantity to buy (int)
    If any of those parameters is missing, a MissingParameter
    exception is raised.
    >>> from fms.agents import zerointelligencetrader
    >>> params = {'agents': [{'money':10000, 'stocks':200}]}
    >>> agent = zerointelligencetrader.ZeroIntelligenceTrader(params)
    Traceback (most recent call last):
        ...
    MissingParameter: maxprice
    >>> params = {'agents': [{'money':10000, 'stocks':200, 'args':[999]}]}
    >>> agent = zerointelligencetrader.ZeroIntelligenceTrader(params)
    Traceback (most recent call last):
        ...
    MissingParameter: maxbuy
    >>> params = {'agents': [{'money':10000, 'stocks':200, 'args':[999, 100]}]}
    >>> agent = zerointelligencetrader.ZeroIntelligenceTrader(params)
    >>> print agent.state()
    Agent ... - owns $10000.00 and    200 securities
    >>> print agent.maxprice
    999
    >>> print agent.maxbuy
    100

    The ProbeAdjustBSTrader acts by returning a
    dict with (direction, price, quantity) keys.
    The 3 elements of the dict are randomly chosen,
    in uniform distributions based on the success 
    of previous buy or sell orders.
    >>> len(agent.act())
    3

    - direction is buy or sell
    - price is a %.2f float in [0.01,maxprice]
    - quantity is an int in :
      - if direction==BUY, [1,self.maxbuy]
      - if direction==SELL, [1,self.stocks]
    Thus, shortselling is not allowed.
     __init__ N/A N/A self params offset N/A 0 N/A N/A N/A N/A N/A agents Agent __init__ self params offset N/A N/A N/A N/A self maxprice N/A N/A self args N/A 0 N/A N/A N/A N/A AttributeError IndexError N/A N/A MissingParameter maxprice N/A N/A N/A N/A self maxbuy N/A N/A self args N/A 1 N/A N/A N/A IndexError N/A N/A MissingParameter maxbuy N/A N/A self args N/A N/A self prevorder N/A N/A N/A self maxprice 2.0 False N/A act N/A N/A self world market N/A None None N/A N/A 
        Return order as a dict with keys in (direction, price, quantity).
        If BUY, bid lower if last order was successful, otherwise higher.
        If SELL, bid higher if last order was successful, otherwise lower.
        Bids are random bounded by previous bid.

        To avoid short selling as far as possible, if # of stocks
        is zero or negative, force BUY direction.
          
        To avoid levering up as far as possible, if money
        is zero or negative, force SELL.
         N/A N/A N/A N/A self stocks 0 N/A N/A self money 0 N/A N/A direction N/A N/A random choice N/A BUY SELL N/A N/A N/A N/A self stocks 0 N/A N/A direction BUY N/A N/A direction SELL N/A direction N/A N/A N/A N/A self prevorder N/A 1 N/A N/A price N/A N/A N/A random randint N/A int N/A N/A N/A self prevorder N/A 0 100 N/A N/A self maxprice 100 100.0 N/A N/A price N/A N/A N/A random randint 1 N/A int N/A N/A N/A self prevorder N/A 0 100 100.0 N/A quantity N/A N/A random randint 1 N/A self stocks N/A N/A N/A N/A self prevorder N/A 1 N/A N/A price N/A N/A N/A random randint 1 N/A int N/A N/A N/A self prevorder N/A 0 100 100.0 N/A N/A price N/A N/A N/A random randint N/A int N/A N/A N/A self prevorder N/A 0 100 N/A N/A self maxprice 100 100.0 N/A quantity N/A N/A random randint 1 N/A self maxbuy N/A N/A self prevorder N/A price False N/A N/A direction price quantity direction price quantity N/A record N/A N/A self direction price quantity N/A N/A N/A 
        Record transaction
         N/A direction N/A N/A N/A self stocks quantity N/A N/A self money N/A quantity price N/A N/A N/A self stocks quantity N/A N/A self money N/A quantity price N/A N/A self prevorder N/A price True N/A N/A _test N/A N/A N/A N/A N/A 
    Run tests in docstrings
     N/A doctest N/A N/A N/A doctest testmod optionflags N/A N/A doctest ELLIPSIS N/A N/A N/A __name__ __main__ N/A N/A N/A _test