Esempio n. 1
0
    def __set_agent_values__(self):
        int_rate = self.model_params["int_rate"]
        min_holding = self.model_params['min_holding']
        init_cash = self.model_params['init_cash']
        position = self.model_params['init_holding']
        min_cash = self.model_params['min_cash']
        tolerance = self.model_params['tolerance']
        mistake_threshold = self.model_params['mistake_threshold']
        make_mistakes = self.model_params['make_mistakes']

        for i in range(int(self.model_params['num_agents'])):
            agent = Agents.Agent(id=i,
                                 name='Agent ' + str(i),
                                 int_rate=int_rate,
                                 min_holding=min_holding,
                                 init_cash=init_cash,
                                 position=position,
                                 forecast_params=self.forecast_params,
                                 dividend=self.init_dividend,
                                 price=self.init_asset_price,
                                 conditions=self.conditions,
                                 min_cash=min_cash,
                                 risk_aversion=self.__gen_agent_risk__,
                                 tolerance=tolerance,
                                 mistake_threshold=mistake_threshold,
                                 make_mistakes=make_mistakes)
            agent.__set_holdings__()
            self.population.append(agent)
Esempio n. 2
0
import pyparsing as pp
import Agents
import argparse

from settings import *

import re
global args
agent = Agents.Agent(args.groups)
#===========================


def printenv(e):
    # print("")
    # print("========ENVIRONMENT=======")
    # for k in e.keys():
    #     print("\t"+k)
    #     print("\t\t"+str(e[k]))
    # print("--------------------------")
    # print("")
    pass


def dprintenv(e):
    print("")
    print("========ENVIRONMENT=======")
    for k in e.keys():
        print("\t" + k.replace("_", " "))
        print("\t\t" + str(e[k]))
    print("--------------------------")
    print("")