示例#1
0
    def __buy(self, code, quantity, actual_price, limit=None):
        """
        买入函数
        :param code: 股票代码,字符串
        :param quantity: 数量, 字符串
        """

        available_fund = self.getMoney()
        #if highest:
        #    actual_price=highest
        final_quantity = self._get_valid_buy_quantity(available_fund,
                                                      actual_price, quantity)
        if self.debug: print('final_buy_quantity=', final_quantity)
        if final_quantity:
            setEditText(self.__buy_sell_hwnds[0][0], code)
            time.sleep(0.2)
            setEditText(self.__buy_sell_hwnds[3][0], str(final_quantity))
            time.sleep(0.2)
            if limit:
                highest = limit[0]
                setEditText(self.__buy_sell_hwnds[1][0], str(highest))
                time.sleep(0.2)
            else:
                setEditText(self.__buy_sell_hwnds[1][0], str(actual_price))
            click(self.__buy_sell_hwnds[5][0])
            if self.debug: print('buy_quantity=', final_quantity)
            if self.debug: print(datetime.datetime.now())
            time.sleep(0.2)
示例#2
0
 def __buy(self, code, quantity,actual_price,limit=None):
     """
     买入函数
     :param code: 股票代码,字符串
     :param quantity: 数量, 字符串
     """
     
     available_fund=self.getMoney()
     #if highest:
     #    actual_price=highest
     final_quantity=self._get_valid_buy_quantity(available_fund, actual_price, quantity)
     if self.debug: print('final_buy_quantity=',final_quantity)
     if final_quantity:
         setEditText(self.__buy_sell_hwnds[0][0], code)
         time.sleep(0.2)
         setEditText(self.__buy_sell_hwnds[3][0], str(final_quantity))
         time.sleep(0.2)
         if limit:
             highest=limit[0]
             setEditText(self.__buy_sell_hwnds[1][0], str(highest))
             time.sleep(0.2)
         else:
             highest=limit[0]
             setEditText(self.__buy_sell_hwnds[1][0], str(actual_price))
         click(self.__buy_sell_hwnds[5][0])
         if self.debug: print('buy_quantity=',final_quantity)
         if self.debug: print(datetime.datetime.now())
         time.sleep(0.2)
示例#3
0
 def clickRefreshButton(self, t=0.3):
     """点击刷新按钮
     """
     #clickWindow(self.__menu_hwnds[0][0], self.__button['refresh'])
     #self.getMoney()
     """点击'关联同一只股票'按钮
     """
     click(self.__buy_sell_hwnds[49][0])
     time.sleep(t)
示例#4
0
 def clickRefreshButton(self, t=0.3):
     """点击刷新按钮
     """
     #clickWindow(self.__menu_hwnds[0][0], self.__button['refresh'])
     #self.getMoney()
     """点击'关联同一只股票'按钮
     """
     click(self.__buy_sell_hwnds[49][0])
     time.sleep(t)
示例#5
0
 def __buy0(self, code, quantity, new_stock_order_hwnd):
     """
     买入函数
     :param code: 股票代码,字符串
     :param quantity: 数量, 字符串
     """
     setEditText(self.__buy_sell_hwnds[0][0], code)
     time.sleep(0.2)
     if quantity != '0':
         setEditText(self.__buy_sell_hwnds[3][0], quantity)
         time.sleep(0.2)
     click(self.__buy_sell_hwnds[5][0])
     time.sleep(0.2)
示例#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
示例#7
0
 def __buy0(self, code, quantity,new_stock_order_hwnd):
     """
     买入函数
     :param code: 股票代码,字符串
     :param quantity: 数量, 字符串
     """
     setEditText(self.__buy_sell_hwnds[0][0], code)
     time.sleep(0.2)
     if quantity != '0':
         setEditText(self.__buy_sell_hwnds[3][0], quantity)
         time.sleep(0.2)
     click(self.__buy_sell_hwnds[5][0])
     time.sleep(0.2)
示例#8
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
示例#9
0
 def __buy(self, code, quantity):
     """买函数
     :param code: 代码, 字符串
     :param quantity: 数量, 字符串
     """
     click(self.__buy_sell_hwnds[2][0])
     time.sleep(0.2)
     setEditText(self.__buy_sell_hwnds[2][0], code)
     time.sleep(0.2)
     if quantity != '0':
         setEditText(self.__buy_sell_hwnds[7][0], quantity)
         time.sleep(0.2)
     click(self.__buy_sell_hwnds[8][0])
     time.sleep(1)
示例#10
0
 def __buy(self, code, quantity):
     """买函数
     :param code: 代码, 字符串
     :param quantity: 数量, 字符串
     """
     click(self.__buy_sell_hwnds[2][0])
     time.sleep(0.2)
     setEditText(self.__buy_sell_hwnds[2][0], code)
     time.sleep(0.2)
     if quantity != '0':
         setEditText(self.__buy_sell_hwnds[7][0], quantity)
         time.sleep(0.2)
     click(self.__buy_sell_hwnds[8][0])
     time.sleep(1)
示例#11
0
 def __sell(self, code, quantity):
     """
     卖函数
     :param code: 股票代码, 字符串
     :param quantity: 数量, 字符串
     """
     click(self.__buy_sell_hwnds[11][0])
     time.sleep(0.2)
     setEditText(self.__buy_sell_hwnds[11][0], code)
     time.sleep(0.2)
     if quantity != '0':
         setEditText(self.__buy_sell_hwnds[16][0], quantity)
         time.sleep(0.2)
     click(self.__buy_sell_hwnds[17][0])
     time.sleep(1)
示例#12
0
 def __sell(self, code, quantity):
     """
     卖函数
     :param code: 股票代码, 字符串
     :param quantity: 数量, 字符串
     """
     click(self.__buy_sell_hwnds[11][0])
     time.sleep(0.2)
     setEditText(self.__buy_sell_hwnds[11][0], code)
     time.sleep(0.2)
     if quantity != '0':
         setEditText(self.__buy_sell_hwnds[16][0], quantity)
         time.sleep(0.2)
     click(self.__buy_sell_hwnds[17][0])
     time.sleep(1)
示例#13
0
 def __sell(self, code, quantity, actual_price, limit=None):
     """
     卖出函数
     :param code: 股票代码, 字符串
     :param quantity: 数量, 字符串
     """
     quantity = self._get_valid_sell_quantity(code, quantity)
     if quantity:
         setEditText(self.__buy_sell_hwnds[24][0], code)
         time.sleep(0.2)
         setEditText(self.__buy_sell_hwnds[27][0], str(quantity))
         time.sleep(0.2)
         if limit:
             lowest = limit[1]
             setEditText(self.__buy_sell_hwnds[25][0], str(lowest))
             time.sleep(0.2)
         else:
             setEditText(self.__buy_sell_hwnds[25][0], str(actual_price))
             time.sleep(0.2)
         click(self.__buy_sell_hwnds[29][0])
         if self.debug: print('sell_quantity=', quantity)
         if self.debug: print(datetime.datetime.now())
         time.sleep(0.2)
示例#14
0
 def __sell(self, code, quantity,actual_price,limit=None):
     """
     卖出函数
     :param code: 股票代码, 字符串
     :param quantity: 数量, 字符串
     """
     quantity=self._get_valid_sell_quantity(code, quantity)
     if quantity:
         setEditText(self.__buy_sell_hwnds[24][0], code)
         time.sleep(0.2)
         setEditText(self.__buy_sell_hwnds[27][0], str(quantity))
         time.sleep(0.2)
         if limit:
             lowest=limit[1]
             setEditText(self.__buy_sell_hwnds[25][0], str(lowest))
             time.sleep(0.2)
         else:
             setEditText(self.__buy_sell_hwnds[25][0], str(actual_price))
             time.sleep(0.2)
         click(self.__buy_sell_hwnds[29][0])
         if self.debug: print('sell_quantity=',quantity)
         if self.debug: print(datetime.datetime.now())
         time.sleep(0.2)
示例#15
0
 def clickRefreshButton(self, t=0.5):
     """
     点击刷新按钮
     """
     click(self.__buy_sell_hwnds[46][0])
     time.sleep(t)
示例#16
0
 def clickRefreshButton(self, t=0.5):
     """
     点击刷新按钮
     """
     click(self.__buy_sell_hwnds[46][0])
     time.sleep(t)