Skip to content

Commit 58bdaa3

Browse files
committed
Merge branch 'master' into dev
2 parents fb0f30a + 75332d9 commit 58bdaa3

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-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():

shipane_sdk/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ def sell(self, client=None, timeout=None, **kwargs):
120120
kwargs['action'] = 'SELL'
121121
return self.__execute(client, timeout, **kwargs)
122122

123+
def buy_on_margin(self, client=None, timeout=None, **kwargs):
124+
kwargs['action'] = 'BUY_ON_MARGIN'
125+
return self.__execute(client, timeout, **kwargs)
126+
127+
def sell_then_repay(self, client=None, timeout=None, **kwargs):
128+
kwargs['action'] = 'SELL_THEN_REPAY'
129+
return self.__execute(client, timeout, **kwargs)
130+
123131
def ipo(self, client=None, timeout=None, **kwargs):
124132
kwargs['action'] = 'IPO'
125133
return self.__execute(client, timeout, **kwargs)

0 commit comments

Comments
 (0)