Skip to content

Commit

Permalink
log_to_file changes for base agents
Browse files Browse the repository at this point in the history
  • Loading branch information
EC2 Default User committed Nov 16, 2020
1 parent f81f2b4 commit cd02075
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions agent/FinancialAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
# exchanges to make this more useful later on.
class FinancialAgent(Agent):

def __init__(self, id, name, type, random_state):
def __init__(self, id, name, type, random_state, log_to_file=True):
# Base class init.
super().__init__(id, name, type, random_state)
super().__init__(id, name, type, random_state, log_to_file)

# Used by any subclass to dollarize an int-cents price for printing.
def dollarize (self, cents):
Expand Down
6 changes: 4 additions & 2 deletions agent/NoiseAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

class NoiseAgent(TradingAgent):

def __init__(self, id, name, type, symbol='IBM', starting_cash=100000, log_orders=False, random_state=None, wakeup_time = None ):
def __init__(self, id, name, type, symbol='IBM', starting_cash=100000,
log_orders=False, log_to_file=True, random_state=None, wakeup_time = None ):

# Base class init.
super().__init__(id, name, type, starting_cash=starting_cash, log_orders=log_orders, random_state=random_state)
super().__init__(id, name, type, starting_cash=starting_cash, log_orders=log_orders,
log_to_file=log_to_file, random_state=random_state)

self.wakeup_time = wakeup_time,

Expand Down
4 changes: 2 additions & 2 deletions agent/TradingAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# implementing a strategy without too much bookkeeping.
class TradingAgent(FinancialAgent):

def __init__(self, id, name, type, random_state=None, starting_cash=100000, log_orders=False):
def __init__(self, id, name, type, random_state=None, starting_cash=100000, log_orders=False, log_to_file=True):
# Base class init.
super().__init__(id, name, type, random_state)
super().__init__(id, name, type, random_state, log_to_file)

# We don't yet know when the exchange opens or closes.
self.mkt_open = None
Expand Down
5 changes: 3 additions & 2 deletions agent/ValueAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ class ValueAgent(TradingAgent):

def __init__(self, id, name, type, symbol='IBM', starting_cash=100000, sigma_n=10000,
r_bar=100000, kappa=0.05, sigma_s=100000,
lambda_a=0.005, log_orders=False, random_state=None):
lambda_a=0.005, log_orders=False, log_to_file=True, random_state=None):

# Base class init.
super().__init__(id, name, type, starting_cash=starting_cash, log_orders=log_orders, random_state=random_state)
super().__init__(id, name, type, starting_cash=starting_cash,
log_orders=log_orders, log_to_file=log_to_file, random_state=random_state)

# Store important parameters particular to the ZI agent.
self.symbol = symbol # symbol to trade
Expand Down

0 comments on commit cd02075

Please sign in to comment.