波纹管提取器
grapple的Python项目详细描述
抓斗通过WebSocket直接从Rippled中提取完整的Ripple分类账。它查询当前分类帐索引的Rippled,然后向后移动,直到到达Genesis分类帐,记录找到的每个事务。
可以从本地或远程涟漪实例收集数据。如果您有一个运行的本地涟漪实例已经下载了全部或大部分分类账,我强烈建议您进行本地数据收集。从Ripple的公共WebSocket获取数据非常慢!
格斗还重新采样每个货币对的价格时间序列,以创建“开放-高-低-关闭”时间序列。这些重新取样的数据集可用于统计测试、技术市场分析或简单地绘制图表。
捐款:
Bitcoin: 1NUqhGjJEedXxUSxJThfDAHzF2mFosk3fo Ripple: ~tinybike (rLvcQ6ctvr12aQq29AcZT6JMWH7iZ8esHS)
安装
安装抓斗的最简单方法是使用pip:
pip install grapple
grapple的设计目的是使用config.py中的连接信息与postgresql集成。默认情况下,它假设您的数据库位于localhost(127.0.0.1)上,并且您的数据库的名称、密码、用户名和都是“抓斗”。
(虽然这肯定不是一个安全的设置,但对于通过pip安装grapple并且不希望编辑其源代码的人来说,这可能会很方便。)
用法
抓斗可用作python模块:
fromgrappleimportGrapplegrapple=Grapple()grapple.download()
抓斗构造函数接受以下关键字参数:
- socket_url (str):
- rippled websocket URL (default=”ws://127.0.0.1:6006/”)
- full (bool):
- True if downloading the full ledger (starting from the current ledger and walking back to the genesis ledger). False if the download should stop at the last current ledger (i.e., the last time grapple was run). (default=True)
- genesis (int):
- Genesis block index and download halting point. (default=152370)
- quiet (bool):
- If True, suppress console output. (default=True)
- resampling_frequencies (tuple):
- Resampling frequencies, using pandas frequency codes. If None, then resampling is disabled. (default=(‘D’,) or daily)
它也可以作为脚本运行:
python grapple.py [-flags]
可选标志:
-w, --websocket [websocket url]: Specify the rippled websocket url. (default=ws://127.0.0.1:6006/) -p, --public: Use Ripple Labs' public websocket, wss://s1.ripple.com:51233. -f, --full: Download the full Ripple ledger. Automatic on your first run. -g, --genesis [ledger index]: Genesis ledger index and download halting point. -q, --quiet: Suppress command line output.
测试
单元测试在test/目录中。目前覆盖范围有限,但进展缓慢!
注意:默认情况下,将禁用需要本地涟漪和/或Postgres数据库连接的测试。有关详细信息,请参见test/test_grapple.py。