Exemplo n.º 1
0
 def order(self, code, direction, quantity,actual_price,limit_price=None):
     """
     下单函数
     :param code: 股票代码, 字符串
     :param direction: 买卖方向
     :param quantity: 数量, 字符串,数量为‘0’时,由交易软件指定数量
     :param actual_price: 数量, 字符串,数量为‘0’时,由交易软件指定数量
     :param limit_price: [涨停价,跌停价]
     """
     #highest=None
     #lowest=None
     #if limit_price and len(limit_price)>=2:
     #    highest=limit_price[0]
     #    lowest=limit_price[1]
     # restoreFocusWindow(self.__top_hwnd)
     pre_position = self.getPositionDict()
     trade_num = quantity
     if direction == 'B':
         self.__buy(code, quantity,actual_price,limit_price)
     if direction == 'S':
         trade_num = -1*quantity
         self.__sell(code, quantity,actual_price,limit_price)
     #if self.debug: print('self.__top_hwnd=',self.__top_hwnd)
     closePopupWindows(self.__top_hwnd)
     post_position = self.getPositionDict()
     pos_chg = self.getPostionChange(pre_position,post_position)
     if self.debug: print('pos_chg=',pos_chg)
     self.trade_confirm(code, trade_num, pos_chg)
Exemplo n.º 2
0
 def order(self, code, direction, quantity, actual_price, limit_price=None):
     """
     下单函数
     :param code: 股票代码, 字符串
     :param direction: 买卖方向
     :param quantity: 数量, 字符串,数量为‘0’时,由交易软件指定数量
     :param actual_price: 数量, 字符串,数量为‘0’时,由交易软件指定数量
     :param limit_price: [涨停价,跌停价]
     """
     #highest=None
     #lowest=None
     #if limit_price and len(limit_price)>=2:
     #    highest=limit_price[0]
     #    lowest=limit_price[1]
     # restoreFocusWindow(self.__top_hwnd)
     pre_position = self.getPositionDict()
     if quantity <= 0:  #invalid quantity
         if self.debug: print('Please input valid quantity!')
         return
     trade_num = quantity
     if direction == 'B':
         self.__buy(code, quantity, actual_price, limit_price)
     if direction == 'S':
         trade_num = -1 * quantity
         self.__sell(code, quantity, actual_price, limit_price)
     #if self.debug: print('self.__top_hwnd=',self.__top_hwnd)
     closePopupWindows(self.__top_hwnd)
     post_position = self.getPositionDict()
     pos_chg = self.getPostionChange(pre_position, post_position)
     if self.debug: print('pos_chg=', pos_chg)
     self.trade_confirm(code, trade_num, pos_chg)
Exemplo n.º 3
0
 def order(self, code, direction, quantity):
     """
     下单函数
     :param code: 股票代码, 字符串
     :param direction: 买卖方向, 字符串
     :param quantity: 买卖数量, 字符串
     """
     # restoreFocusWindow(self.__top_hwnd)
     if direction == 'B':
         self.__buy(code, quantity)
     if direction == 'S':
         self.__sell(code, quantity)
     closePopupWindows(self.__top_hwnd)
Exemplo n.º 4
0
 def _new_stock_order(self):
     """
     新股申购
     :param code: 股票代码,字符串
     :param quantity: 数量, 字符串
     """
     if self.new_stock_order_hwnd:
         click(self.new_stock_order_hwnd)
         time.sleep(0.1)
         closePopupWindows(self.new_stock_order_hwnd, wantedText='确认')
     else:
         pass
     return
Exemplo n.º 5
0
 def order(self, code, direction, quantity):
     """
     下单函数
     :param code: 股票代码, 字符串
     :param direction: 买卖方向, 字符串
     :param quantity: 买卖数量, 字符串
     """
     # restoreFocusWindow(self.__top_hwnd)
     if direction == 'B':
         self.__buy(code, quantity)
     if direction == 'S':
         self.__sell(code, quantity)
     closePopupWindows(self.__top_hwnd)
Exemplo n.º 6
0
 def _new_stock_order(self):
     """
     新股申购
     :param code: 股票代码,字符串
     :param quantity: 数量, 字符串
     """
     if self.new_stock_order_hwnd:
         click(self.new_stock_order_hwnd)
         time.sleep(0.1)
         closePopupWindows(self.new_stock_order_hwnd,wantedText='确认')
     else:
         pass
     return