为你的交易机器人收集信息的图书馆。与“funtime”时间序列库一起使用
funpicker的Python项目详细描述
Funpicker-一种为你的交易机器人收集价格信息的方法
Funpicker
是为获取交易所的价格信息而创建的一个funguana库这主要依赖于cryptocompare api但是,有些部分使用ccxt来提取exchange特定的信息。
这个库将使我们的应用程序高度模块化它的基本前提非常简单:
- 您可以解释要在上下文中收集哪些信息
- 您将得到包含该信息的返回信息
- 您可以使用另一个库(例如
funtime
或sql)存储您想要的内容
understandfunpicker
是围绕ccxt
和request
的牢固包装。它的工作是使普通机器人制造商更容易获得定价
是什么让funpicker
更好?
使Funpicker比所有其他平台更好的一点是,它100%依赖于使用户的流程更相似。只有几个功能可以立即从交易所获取信息,用于存储或分析:
它是位于request
和ccxt
之上的一层。我们添加了以下内容:
- 查找数据的简单方法
- 用户可以使用简单的查询选项获取具有额外粒度的数据
- 轻松访问医嘱簿信息。有一个内存队列选项来处理速率限制或者你可以让它失败而不承认它。
它是如何工作的?
通过使用一些函数,我们可以使用各种API来执行以下操作:
- 获取订单信息
- 获取定价
今后的计划是:
- 一般情绪数据
- 通用Twitter流
- 通用Reddit流
示例:
fromfunpickerimportQueuy# this is the main query object# Initialize the query class. # It has a lot of default values at the start that we could usefpq=Query()# This gets all of the minutely historical price information for bitcoin.# This should work out the boxinitial=fpq.get()
动态设置所需参数
fromfunpickerimportQuery,QueryType# Now this gets the last 30 hours of ETH to USD prices. # This is in price format and this should be return all of the compressed candlebarsfpq=Query().set_crypto("ETH").set_fiat("USD").set_exchange("binance").set_period("hour").set_limit(30).get()
可直接从交易所动态获取单一价格数据。
这个价格信息是完全的它拥有所有可直接发送到funtime
的信息。时间序列数据库
fromfunpickerimportQuery,QueryType# Same as before. Only it gets the latest price information for one period of time. # This should be within 30-40 seconds of getting posted onto the exchange according to cryptocomparefpq=Query().set_crypto("ETH").set_fiat("USD").set_exchange("binance").set_period("hour").set_limit(30).get(QueryType.price)
获取订单
作为一名数据科学家,您可能希望以数据帧格式处理数据。使用funtime
,您可以同时获得pandas.DataFrame
和dask.DataFrame
格式的时间戳信息。您将使用Converter
导入
fromfunpickerimportQuery,QueryType# Similar as before, only it gets the orderbook when returnedfpq=Query().set_crypto("ETH").set_fiat("USD").set_exchange("binance").get(QueryType.orderbook)
如何安装
这需要Internet连接。使用pip
或pipenv
,运行:
pip install funpicker
或者你可以用pipenv
来表示:
pipenv install funpicker