Skip to content

Commit 6f06f82

Browse files
committed
Handle empty portfolio case for Guorn
1 parent e2553fd commit 6f06f82

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

shipane_sdk/guorn/client.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ def query_portfolio(self):
6262

6363
df = pd.DataFrame()
6464
sheet_data = instruction['data']['sheet_data']
65-
for row in sheet_data['row']:
66-
df[row['name']] = pd.Series(row['data'][1])
67-
meas_data = sheet_data['meas_data']
68-
for index, col in enumerate(sheet_data['col']):
69-
df[col['name']] = pd.Series(meas_data[index])
65+
if sheet_data is not None:
66+
for row in sheet_data['row']:
67+
df[row['name']] = pd.Series(row['data'][1])
68+
meas_data = sheet_data['meas_data']
69+
for index, col in enumerate(sheet_data['col']):
70+
df[col['name']] = pd.Series(meas_data[index])
7071

7172
portfolio = Portfolio(total_value=1.0)
7273
for index, row in df.iterrows():

0 commit comments

Comments
 (0)