コード例 #1
0
 def __init__(self, **kwargs):
     try:
         self._logger = logger
     except NameError:
         import logging
         self._logger = logging.getLogger()
     self._client = shipane_sdk.Client(self._logger, **kwargs)
     self._client_param = kwargs.get('client')
     self._order_id_map = dict()
     self._expire_before = datetime.datetime.combine(
         datetime.date.today(), datetime.time.min)
コード例 #2
0
 def __init__(self, logger, **kwargs):
     TraderBase.__init__(self)
     self._logger = logger
     self._client = shipane_sdk.Client(self._logger, **kwargs)
     self._client_param = kwargs.get('client', '')
     self._auto_restart_shipane = kwargs.get('auto_restart_shipane', False)
     self._col_names = kwargs.get('col_names',
                                  get_shipane_deault_col_name())
     try:
         self._col_names['证券名称']
     except:
         self._col_names['证券名称'] = u'证券名称'
コード例 #3
0
 def handle_data(self, context, data):
     hour = context.current_dt.hour
     minute = context.current_dt.minute
     if not [hour, minute] in self.times:
         return
     try:
         import shipane_sdk
     except:
         pass
     shipane = shipane_sdk.Client(g.log_type(self.memo), key=self.key, host=self.host, port=self.port,
                                  show_info=False)
     for client_param in self.clients:
         shipane.purchase_new_stocks(client_param)
コード例 #4
0
#我是a,我下面有n个账户,每个账户总资产都不一样,每个账户达到的预警线也不一样,到达预警需要一个通知,
#单票限制,因为每个账户总资产不一样,所以单票持仓一个预警可以根据资产总值来设置一个比例

import logging

import shipane_sdk

logging.basicConfig(level=logging.DEBUG)

client = shipane_sdk.Client(host='localhost', port=8888, key='')
account_info = client.get_account('account:227500000140')
cash = client.get_positions('account:227500000140')
account_cash = {}
#cash={}
account_cash['positions'] = 'Empty DataFrame'
#account_cash['Columns']='[��ϸ, ֤ȯ����, ֤ȯ����, ��Ʊ���, �������, ��������, ӯ��, �ɱ���, ӯ����(%), �м�, ��ֵ, �г�����, �����г�, �ɶ��ʻ�, ʵ������, ��Ѷ, ���붳��, ��������]'
account_cash['Index'] = ''
account_cash['sub_accounts'] = ''
print(cash['sub_accounts'])
print(cash['sub_accounts'])
コード例 #5
0
 def setUp(self):
     self.client = shipane_sdk.Client(host='192.168.1.102')