コード例 #1
0
    def __init__(self, APIKey='', Secret=''):
        super().__init__(APIKey, Secret)
        """
            For API details see https://docs.poloniex.com
        """
        self._BASE_URL = 'https://poloniex.com/'
        self._precision = 8
        self._tick_intervals = {
            '300': 300 / 60,
            '900': 900 / 60,
            '1800': 1800 / 60,
            '7200': 7200 / 60,
            '14400': 14400 / 60,
            '86400': 86400 / 60,
        }
        self._thread_pool = QThreadPool()
        self._thread_pool.start(CTWorker(self.ws_init))

        self._ws = None
        self._ws_heartbeat = None
        self._implements = {
            'ws_24hour_market_moves',
            'ws_account_balances',
            'ws_all_markets_best_bid_ask',
            'ws_order_book',
        }

        self._currency_id_map = {}
        self._currency_pair_map = {}
コード例 #2
0
    def __init__(self,
                 CTMain=None,
                 exchange=None,
                 market_symbol=None,
                 base_curr=None,
                 curr_curr=None,
                 depth=None):
        super().__init__()
        self._CTMain = CTMain
        self._exchange = exchange
        self._market_symbol = market_symbol
        self._base_curr = base_curr
        self._curr_curr = curr_curr
        self._depth = depth

        self._order_book = {}
        self._tableWidget = QTableWidget()
        self._tableWidget.setRowCount(2 * self._depth)
        self._tableWidget.setColumnCount(4)
        self._tableWidget.verticalHeader().hide()

        self._layout = QVBoxLayout()
        self._layout.addWidget(self._tableWidget)
        self.setLayout(self._layout)

        self._re_load_seconds = 1
        self._re_draw_seconds = 0.3
        self._thread_pool = QThreadPool()
        order_book_reloader = CTWorker(self.load_order_book_thread)
        self._thread_pool.start(order_book_reloader)

        self._timer_painter = QTimer(self)
        self._timer_painter.start(self._re_draw_seconds * 1000)
        self._timer_painter.timeout.connect(self.refresh_order_book)
コード例 #3
0
    def __init__(self, APIKey='', Secret='', PassPhrase=''):
        super().__init__(APIKey, Secret, PassPhrase)
        """
            For API details see https://docs.kucoin.com/
        """
        self._BASE_URL = 'https://openapi-v2.kucoin.com'
        self._exchangeInfo = None
        self._tick_intervals = {
            '1min': 1,
            '3min': 3,
            '5min': 5,
            '15min': 15,
            '30min': 30,
            '1hour': 60,
            '2hour': 2 * 60,
            '4hour': 4 * 60,
            '6hour': 6 * 60,
            '8hour': 8 * 60,
            '12hour': 12 * 60,
            '1day': 24 * 60,
            '1week': 7 * 24 * 60
        }
        self._ws = None
        self._ws_token = None
        self._ws_heartbeat = None

        self._thread_pool = QThreadPool()
        self._thread_pool.start(CTWorker(self.ws_init))

        self._implements = {
            'ws_24hour_market_moves',
            'ws_all_markets_best_bid_ask',
        }
コード例 #4
0
    def __init__(self, CTMain, exchange, code_base, code_curr, market_symbol):
        super().__init__()
        self._CTMain = CTMain
        self._re_draw_seconds = 0.3
        self._re_load_seconds = 1
        self._thread_pool = QThreadPool()
        self.update_market(exchange, code_base, code_curr, market_symbol)

        self._table_widget = QTableWidget()
        self._layout = QVBoxLayout()
        self._layout.addWidget(self._table_widget)
        self.setLayout(self._layout)

        self._timer_painter = QTimer(self)
        self._timer_painter.start(self._re_draw_seconds * 1000)
        self._timer_painter.timeout.connect(self.re_draw)

        # generic thread using signal
        trade_reloader = CTWorker(self.re_load_recent_trades_thread)
        self._thread_pool.start(trade_reloader)
コード例 #5
0
    def __init__(self, APIKey='', Secret=''):
        super().__init__(APIKey, Secret)
        """
            https://github.com/binance-exchange/binance-official-api-docs
            https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md
            https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md
        """
        self._BASE_URL = 'https://api.binance.com'
        self._exchangeInfo = None
        self._tick_intervals = {
            '1m': 1,
            '3m': 3,
            '5m': 5,
            '15m': 15,
            '30m': 30,
            '1h': 60,
            '2h': 2 * 60,
            '4h': 4 * 60,
            '6h': 6 * 60,
            '8h': 8 * 60,
            '12h': 12 * 60,
            '1d': 24 * 60,
            '3d': 3 * 24 * 60,
            '1w': 7 * 24 * 60,
            '1M': 30 * 24 * 60
        }
        try:
            self._timestamp_correction = int(
                self.public_get_server_time()) - int(time.time() * 1000)
        except Exception as e:
            self._timestamp_correction = 0
        self.public_update_exchange_info()
        self._thread_pool = QThreadPool()
        self._thread_pool.start(CTWorker(self.ws_init))

        self._ws = None
        self._implements = {
            'ws_24hour_market_moves',
            'ws_all_markets_best_bid_ask',
        }