Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sinall committed Jul 7, 2018
2 parents fb0f30a + 75332d9 commit 58bdaa3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
31 changes: 17 additions & 14 deletions shipane_sdk/base_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
8 changes: 8 additions & 0 deletions shipane_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 58bdaa3

Please sign in to comment.