与BitCoinAverage API集成的库

bitcoinaverage的Python项目详细描述


BitcoinAverage PIP库

这里我们提供两个示例-第一个示例显示如何调用函数,该函数向restful api发出http请求,另一个示例连接到一个websocket。您只需要输入您的公钥和密钥,就可以运行此示例了。

官方文件:https://apiv2.bitcoinaverage.com 关于github的更多示例:https://github.com/bitcoinaverage/api-integration-examples/

http示例

#!python

from bitcoinaverage import RestfulClient

if __name__ == '__main__':
    public_key = 'your_public_key'
    secret_key = 'your_secret_key'

    restful_client = RestfulClient(secret_key, public_key)

    ticker_global_per_symbol = restful_client.ticker_global_per_symbol('BTCUSD')
    print('Global Ticker for BTCUSD:')
    print(ticker_global_per_symbol)

WebSocket v1示例

#!python

from bitcoinaverage import TickerWebsocketClient

if __name__ == '__main__':
    public_key = 'your_public_key'
    secret_key = 'your_secret_key'

    print('Connecting to the ticker websocket...')
    ws = TickerWebsocketClient(public_key, secret_key)
    ws.ticker_data('local', 'BTCUSD')

WebSocket v2示例

版本2 WebSocket客户端分别接受加密货币列表和交换列表。 他们还使用新的优化算法,以更快的更新。

股票代码

#!python

from bitcoinaverage import TickerWebsocketClientV2

if __name__ == '__main__':
    public_key = 'your_public_key'
    secret_key = 'your_secret_key'

    print('Connecting to the ticker websocket...')
    ws = TickerWebsocketClientV2(public_key, secret_key)
    ws.ticker_data('local', ['BTCUSD', 'ETHUSD'])

交换

#!python

from bitcoinaverage import ExchangeWebsocketClientV2

if __name__ == '__main__':
    public_key = 'your_public_key'
    secret_key = 'your_secret_key'

    print('Connecting to the exchange websocket...')
    ws = ExchangeWebsocketClientV2(public_key, secret_key)
    ws.ticker_data(['bitstamp', 'gdax'])

版权区块链数据有限公司

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java ArrayOutOfBoundsException与org。日食swt。图样图像数据。布利特   java为什么Hazelcast CacheLoader类需要对所有客户端可见?   如何在java中迭代xml   java概要文件不是工件名称的一部分   java将多个Spring MVC应用程序映射到根Servlet   java SetContentView参数显示错误   java Cucumber类扩展步骤定义和挂钩   java如何动态添加JFace向导页面   amazon web services使用AWS Java SDK通过AWS API网关从S3下载文本文件   Android上的java软键盘   如何在Java中像在C#中一样创建泛型扩展方法?   使用JPA的java多列类型