예제 #1
0
 def __init__(self, sim_env, api_wrapper, name, cash):
     self.sim_env = sim_env
     self.api_wrapper = api_wrapper
     self.name = name
     self.portfolios = []
     self.info_obj = YAFIObjects.YAFIObjectDepotInfo([0])
     self.starting_cash = cash
     self.loadStuff()
예제 #2
0
    def save(self):
        info_filename = Util.getDepotInfoFile(self.name)
        fileh = open(info_filename, "w")
        self.info_obj = YAFIObjects.YAFIObjectDepotInfo([self.starting_cash])
        fileh.write(self.info_obj.getAsString())

        for portfolio in self.portfolios:
            portfolio.save()
예제 #3
0
파일: Util.py 프로젝트: h0r5t/YAFI
def loadDepotInfo(depot_name):
    filename = getDepotInfoFile(depot_name)
    if os.path.exists(filename):
        fileh = open(filename, "r")
        csv_dict = getDictFromCsvString(fileh.read())
        info_obj = YAFIObjects.YAFIObjectDepotInfo(csv_dict[0])
        return info_obj
    return None