當前位置: 首頁>>代碼示例>>Python>>正文


Python client.Client方法代碼示例

本文整理匯總了Python中binance.client.Client方法的典型用法代碼示例。如果您正苦於以下問題:Python client.Client方法的具體用法?Python client.Client怎麽用?Python client.Client使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在binance.client的用法示例。


在下文中一共展示了client.Client方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: binance2btrx

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def binance2btrx (_data):
    '''
    Converts Binance data structure into Bittrex's model.
    '''

    new_data={}

    new_data['MarketName'] = str(_data['symbol'])
    new_data['Ask'] = float(_data['askPrice'])
    new_data['BaseVolume'] = float(_data['quoteVolume'])
    new_data['Bid'] = float(_data['bidPrice'])
    new_data['High'] = float(_data['highPrice'])
    new_data['Last'] = float(_data['lastPrice'])
    new_data['Low'] = float(_data['lowPrice'])
    new_data['Volume'] = float(_data['volume'])
    new_data['Count'] = float(_data['count'])

    return new_data 
開發者ID:ivopetiz,項目名稱:algotrading,代碼行數:20,代碼來源:aux.py

示例2: client

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def client(self):
        if not self._client:
            self._client = Client(self.__key, self.__secret)

        return self._client 
開發者ID:iilunin,項目名稱:crypto-bot,代碼行數:7,代碼來源:FXConnector.py

示例3: __init__

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def __init__(self, client: Client):
        Thread.__init__(self)
        Logger.__init__(self)


        self.client = client
        self.stop = False

        self.ticker_websocket: WebSocketClientProtocol = None
        self.user_webscoket: WebSocketClientProtocol = None

        self.ticker_ws_future = None
        self.user_ws_future = None
        self.mngmt_future = None

        self.connection_key = None
        self.user_info_cb = None

        self.ticker_cb = None
        self.symbols = None

        if not BinanceWebsocket.__EVENT_LOOP:
            self.loop = asyncio.get_event_loop()
            BinanceWebsocket.__EVENT_LOOP = self.loop
        else:
            self.loop = BinanceWebsocket.__EVENT_LOOP

        self.time = None

        self.name = 'Binance WebSocket Thread' 
開發者ID:iilunin,項目名稱:crypto-bot,代碼行數:32,代碼來源:BinanceWebsocket.py

示例4: __init__

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def __init__(self, key=None, secret=None):
        super().__init__()
        self.__key = key
        self.__secret = secret
        self._client = None #Client(key, secret)
        self.bs: BinanceWebsocket = None

        # self.connection = None
        self.ticker_connection = None
        self.user_data_connection = None 
開發者ID:iilunin,項目名稱:crypto-bot,代碼行數:12,代碼來源:FXConnector.py

示例5: __init__

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def __init__(self, key=None, secret=None):
        super().__init__()
        self.__key = key
        self.__secret = secret
        self.client = Client(key, secret)
        self.bs = BinanceSocketManager(self.client)
        # self.connection = None
        self.ticker_connection = None
        self.user_data_connection = None 
開發者ID:iilunin,項目名稱:crypto-bot,代碼行數:11,代碼來源:OLDFXConnector.py

示例6: listen_symbols

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def listen_symbols(self, symbols, on_ticker_received, user_data_handler):
        # self.client = Client(self.__key, self.__secret)
        self.bs = BinanceSocketManager(self.client)
        # self.connection = self.bs.start_multiplex_socket(['{}@trade'.format(s.lower()) for s in symbols],
        #                                                  socket_handler)

        self.bs.start_ticker_socket(on_ticker_received)
        # self.ticker_connection = self.bs.start_multiplex_socket(['{}@ticker'.format(s.lower()) for s in symbols],
        #                                                         on_ticker_received)
        self.user_data_connection = self.bs.start_user_socket(user_data_handler)
        self.logInfo('Ticker and User WS initialized')
        self.bs.name = 'Binance WS' 
開發者ID:iilunin,項目名稱:crypto-bot,代碼行數:14,代碼來源:OLDFXConnector.py

示例7: get_markets_list

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def get_markets_list(base='BTC', exchange='bittrex'):
    '''
    Gets all coins from a certain market.

    Args:
    - base: if you want just one market. Ex: BTC.
        Empty for all markets.

    Returns:
    - list of markets.
    - False if unsupported exchange.
    '''

    ret = False

    if exchange=='bittrex':
        try:
            bt = Bittrex('', '')
            log("[INFO] Connected to Bittrex." , 1)
            ret = [i['MarketName'] for i in bt.get_markets()['result'] if i['MarketName'].startswith(base)]
        except Exception as e:
            log("[ERROR] Connecting to Bittrex..." , 0)
    
    elif exchange=='binance':
        try:
            bnb = Binance('','')
            log("[INFO] Connected to Binance." , 1)
            ret = [i['symbol'] for i in bnb.get_all_tickers() if i['symbol'].endswith(base)]
        except Exception as e:
            log("[ERROR] Connecting to Binance..." , 0)
    return ret 
開發者ID:ivopetiz,項目名稱:algotrading,代碼行數:33,代碼來源:aux.py

示例8: __init__

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def __init__(self, api_key, api_secret):
        self.client = Client(api_key, api_secret) 
開發者ID:XiaoboHe,項目名稱:XTrader,代碼行數:4,代碼來源:xrobot.py

示例9: __init__

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def __init__(self, key, secret):
        self.logger = Logger(__name__)

        try:
            self.client = Client(key, secret)
        except Exception as e:
            self.logger.log(e)
            raise ExchangeException(self.__class__.__name__, e) 
開發者ID:msantl,項目名稱:cryptofolio,代碼行數:10,代碼來源:Binance.py

示例10: __init__

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def __init__(self, binance_client: BinanceClient):
        self._binance_client: BinanceClient = binance_client
        self._current_listen_key = None
        self._listen_for_user_stream_task = None
        self._last_recv_time: float = 0
        super().__init__() 
開發者ID:CoinAlpha,項目名稱:hummingbot,代碼行數:8,代碼來源:binance_api_user_stream_data_source.py

示例11: __init__

# 需要導入模塊: from binance import client [as 別名]
# 或者: from binance.client import Client [as 別名]
def __init__(self,
                 data_source_type: UserStreamTrackerDataSourceType = UserStreamTrackerDataSourceType.EXCHANGE_API,
                 binance_client: Optional[BinanceClient] = None):
        super().__init__(data_source_type=data_source_type)
        self._binance_client: BinanceClient = binance_client
        self._ev_loop: asyncio.events.AbstractEventLoop = asyncio.get_event_loop()
        self._data_source: Optional[UserStreamTrackerDataSource] = None
        self._user_stream_tracking_task: Optional[asyncio.Task] = None 
開發者ID:CoinAlpha,項目名稱:hummingbot,代碼行數:10,代碼來源:binance_user_stream_tracker.py


注:本文中的binance.client.Client方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。