Exemple #1
0
                    conn.get_response_body(request_id))

    def refresh(self):
        self.streaming_positios.clear()
        for conn in self.driver.connections():
            if not conn.url.startswith(
                    'https://tradefx.gaitame.com/pcweb/gneo/trade.html?'):
                continue
            #conn.click(css_selector='#home_reload')
            conn.click(
                css_selector=
                '#uforex1_id_byCurrencyPairListHome_MyTable a.btnUpdate')

    def run_job(self, state: dict):
        while state['run']:
            try:
                for conn in self.driver.connections(
                ):  # type: CustomConnection
                    self.on_positions(conn)
                    pass
            except Exception as e:
                self.logger.exception(str(e))
            gevent.sleep(1.0)


if __name__ == '__main__':
    try:
        start_engine(Gaitameweb, chrome_port=11003)
    except KeyboardInterrupt:
        pass
Exemple #2
0
        self.update_accounts([self.account])

    def on_data(self, conn: CustomConnection, data: dict):
        method = data['method']  # type: str
        params = data['params']  # type: dict

        if method == 'Network.loadingFinished':
            url = data['url']
            request_id = params['requestId']
            if url.startswith('https://triauto.invast.jp/TriAuto/user/api/getHomeRateMap.do'):
                return self.on_prices(conn.get_response_body(request_id))
            if url.startswith('https://triauto.invast.jp/TriAuto/user/api/getContainerAccountInfo.do'):
                return self.on_positions(conn.get_response_body(request_id))

    def run_job(self, state: dict):
        while state['run']:
            try:
                for conn in self.driver.connections():  # type: CustomConnection
                    if conn.url == 'https://triauto.invast.jp/TriAuto/user/index.do':
                        self.on_account(conn)
            except Exception as e:
                self.logger.exception(str(e))
            gevent.sleep(1.0)


if __name__ == '__main__':
    try:
        start_engine(Tryauto, chrome_port=11001)
    except KeyboardInterrupt:
        pass
Exemple #3
0
            return
            url = data['url']
            request_id = params['requestId']
            if url == 'https://gaikaex.net/quote.txt':
                return self.on_prices(conn.get_response_body(request_id))
            if self.currencies and url.startswith(
                    'https://gaikaex.net/servlet/lzca.pc.cht200.servlet.CHt20003?'
            ):
                return self.on_positions(conn.get_response_body(request_id))

    def run_job(self, state: dict):
        i = 0
        while state['run']:
            i += 1
            try:
                for conn in self.driver.connections():
                    self.on_prices(conn)
                    if i % 10 == 0:
                        self.on_account(conn)
                    gevent.sleep(0)
            except Exception as e:
                self.logger.exception(str(e))
            gevent.sleep(0.1)


if __name__ == '__main__':
    try:
        start_engine(Gaitamejp, chrome_port=11006)
    except KeyboardInterrupt:
        pass
Exemple #4
0
    def on_data(self, conn: CustomConnection, data: dict):
        method = data['method']  # type: str
        params = data['params']  # type: dict

        if method == 'Network.loadingFinished':
            return
            url = data['url']
            request_id = params['requestId']
            if url == 'https://gaikaex.net/quote.txt':
                return self.on_prices(conn.get_response_body(request_id))
            if self.currencies and url.startswith(
                    'https://gaikaex.net/servlet/lzca.pc.cht200.servlet.CHt20003?'
            ):
                return self.on_positions(conn.get_response_body(request_id))

    def run_job(self, state: dict):
        while state['run']:
            try:
                self.on_prices()
            except Exception as e:
                self.logger.exception(str(e))
            gevent.sleep(0.1)


if __name__ == '__main__':
    try:
        start_engine(Gmoclick, chrome_port=11005)
    except KeyboardInterrupt:
        pass
Exemple #5
0
            try:
                url = conn.request_urls[params['requestId']]
                for service, stream_url in self.STREAM_URLS.items():
                    if url.startswith(stream_url):
                        return self.on_prices(service, conn)
            except KeyError:
                pass

    def run_job(self, state: dict):
        i = 0
        while state['run']:
            i += 1
            try:
                self.on_prices()
                if i % 10 == 0:
                    for conn in self.driver.connections(
                    ):  # type: CustomConnection
                        for service, simple_url in self.SIMPLE_URLS.items():
                            if simple_url in conn.url:
                                self.on_positions(service, conn)
            except Exception as e:
                self.logger.exception(str(e))
            gevent.sleep(0.1)


if __name__ == '__main__':
    try:
        start_engine(Pfxnano, chrome_port=11000)
    except KeyboardInterrupt:
        pass