diff --git a/shipane_sdk/base_manager.py b/shipane_sdk/base_manager.py index 15d5e41..5bfb070 100644 --- a/shipane_sdk/base_manager.py +++ b/shipane_sdk/base_manager.py @@ -109,20 +109,23 @@ def purchase_new_stocks(self): self._logger.exception('[%s] 打新失败', trader.id) def repo(self): - security = '131810' - quote_df = ts.get_realtime_quotes(security) - order = { - 'action': 'SELL', - 'symbol': security, - 'type': 'LIMIT', - 'price': float(quote_df['bid'][0]), - 'amountProportion': 'ALL' - } - for trader in self._traders.values(): - try: - trader.execute(**order) - except: - self._logger.exception('[%s] 逆回购失败', trader.id) + try: + security = '131810' + quote_df = ts.get_realtime_quotes(security) + order = { + 'action': 'SELL', + 'symbol': security, + 'type': 'LIMIT', + 'price': float(quote_df['bid'][0]), + 'amountProportion': 'ALL' + } + for trader in self._traders.values(): + try: + trader.execute(**order) + except: + self._logger.exception('[%s] 逆回购失败', trader.id) + except: + self._logger.exception('逆回购失败') def purchase_convertible_bonds(self): for trader in self._traders.values(): diff --git a/shipane_sdk/client.py b/shipane_sdk/client.py index 823fd88..51c8250 100644 --- a/shipane_sdk/client.py +++ b/shipane_sdk/client.py @@ -120,6 +120,14 @@ def sell(self, client=None, timeout=None, **kwargs): kwargs['action'] = 'SELL' return self.__execute(client, timeout, **kwargs) + def buy_on_margin(self, client=None, timeout=None, **kwargs): + kwargs['action'] = 'BUY_ON_MARGIN' + return self.__execute(client, timeout, **kwargs) + + def sell_then_repay(self, client=None, timeout=None, **kwargs): + kwargs['action'] = 'SELL_THEN_REPAY' + return self.__execute(client, timeout, **kwargs) + def ipo(self, client=None, timeout=None, **kwargs): kwargs['action'] = 'IPO' return self.__execute(client, timeout, **kwargs)