Skip to content

Commit 52b9491

Browse files
committed
Handle exception for repo
1 parent 240b2bd commit 52b9491

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

shipane_sdk/base_manager.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,23 @@ def purchase_new_stocks(self):
109109
self._logger.exception('[%s] 打新失败', trader.id)
110110

111111
def repo(self):
112-
security = '131810'
113-
quote_df = ts.get_realtime_quotes(security)
114-
order = {
115-
'action': 'SELL',
116-
'symbol': security,
117-
'type': 'LIMIT',
118-
'price': float(quote_df['bid'][0]),
119-
'amountProportion': 'ALL'
120-
}
121-
for trader in self._traders.values():
122-
try:
123-
trader.execute(**order)
124-
except:
125-
self._logger.exception('[%s] 逆回购失败', trader.id)
112+
try:
113+
security = '131810'
114+
quote_df = ts.get_realtime_quotes(security)
115+
order = {
116+
'action': 'SELL',
117+
'symbol': security,
118+
'type': 'LIMIT',
119+
'price': float(quote_df['bid'][0]),
120+
'amountProportion': 'ALL'
121+
}
122+
for trader in self._traders.values():
123+
try:
124+
trader.execute(**order)
125+
except:
126+
self._logger.exception('[%s] 逆回购失败', trader.id)
127+
except:
128+
self._logger.exception('逆回购失败')
126129

127130
def purchase_convertible_bonds(self):
128131
for trader in self._traders.values():

0 commit comments

Comments
 (0)