Skip to content

Commit

Permalink
Merge pull request #1087 from yutiansut/master
Browse files Browse the repository at this point in the history
update fix bug for portfolio
  • Loading branch information
yutiansut authored Apr 2, 2019
2 parents 15a4382 + 302dfb4 commit 8a6a9a8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions QUANTAXIS/QAARP/QAPortfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def add_account(self, account):
account.user_cookie = self.user_cookie
self.cash.append(self.cash_available - account.init_cash)
self.account_list.append(account.account_cookie)
account.save()
return account
else:
pass
Expand All @@ -217,7 +218,8 @@ def drop_account(self, account_cookie):

if account_cookie in self.account_list:
res = self.account_list.remove(account_cookie)
self.cash.append(self.cash[-1] + res.init_cash)
self.cash.append(
self.cash[-1] + self.get_account_by_cookie(res).init_cash)
return True
else:
raise RuntimeError(
Expand Down Expand Up @@ -296,7 +298,7 @@ def get_account_by_cookie(self, cookie):
'''
try:
return QA_Account(
account_cookie=account_cookie,
account_cookie=cookie,
user_cookie=self.user_cookie,
portfolio_cookie=self.portfolio_cookie,
auto_reload=True
Expand Down Expand Up @@ -388,7 +390,6 @@ def receive_deal(self):
def table(self):
return pd.concat([acc.table for acc in self.accounts.values()], axis=1)


@property
def portfolioView(self):
return []
Expand Down

0 comments on commit 8a6a9a8

Please sign in to comment.