当前位置: 首页>>代码示例>>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;未经允许,请勿转载。