예제 #1
0
    def accounts(self):
        if not self._accounts:
            data = self._default_params()
            data['username'] = self.username
            resp = self._call_method(Resource.ACCOUNT_LIST, data)

            for a in resp['account_list']:
                account = Account(self)
                account.id = a['id']
                account.name = a['name']
                account.home_currency = a['homecurr']
                account.margin_rate = a['margin_rate']
                for p in a['account_property_name']:
                    account.property_names.append(p)

                self._accounts.append(account)

        return self._accounts