예제 #1
0
파일: market.py 프로젝트: yetty123/historia
    def __init__(self, manager, location):
        self.manager = manager
        self.location = location

        # dictionary of list of orders by Good
        # stores the current buy and sell orders this market is processing
        self.buy_orders = {}
        self.sell_orders = {}

        # stores historical economic data for past transactions
        self.history = TradeHistory()

        # fill the trade history with a bunch of fake data
        for good in Good.all():
            self.history.register(good)
            self.history.prices.add(good, 1.0)
            self.history.buy_orders.add(good, 1.0)
            self.history.sell_orders.add(good, 1.0)
            self.history.trades.add(good, 1.0)
            self.buy_orders[good] = []
            self.sell_orders[good] = []

        for pop_type in PopType.all():
            self.history.profit.register(pop_type)