xrplwin/xrpl-orderbook-reader 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xrplwin/xrpl-orderbook-reader

最新稳定版本:v1.0.5

Composer 安装命令:

composer require xrplwin/xrpl-orderbook-reader

包简介

This repository takes XRPL Orderbook (book_offers) datasets and requested volume to exchange and calculates the effective exchange rates based on the requested and available liquidity.

README 文档

README

CI workflow GitHub license Total Downloads

XRPL Orderbook Reader for PHP

This repository takes XRPL Orderbook (book_offers) datasets and requested volume to exchange and calculates the effective exchange rates based on the requested and available liquidity.

Optionally certain checks can be specified (eg. book_offers on the other side of the book) to warn for limited (percentage) liquidity on the requested side, and possibly other side of the order book.

This is PHP port of https://github.com/XRPL-Labs/XRPL-Orderbook-Reader by Wietse Wind (@XRPL Labs)

Note

This package is provided as is, please test it yourself first.
Found a bug? Report issue here

Requirements

Installation

To install run

composer require xrplwin/xrpl-orderbook-reader

Usage

use \XRPLWin\XRPL\Client;

$xrplwinapiclient = new Client([]);
$lc = new LiquidityCheck([
  # Trade:
  'from' => [
    'currency' => 'XRP'
  ],
  'amount' => 10,
  'to' => [
    'currency' => 'USD',
    'issuer' => 'rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq'
  ],  
],
[
  # Options:
  //'rates' => 'to',
  //'maxSpreadPercentage' => 4,
  //'maxSlippagePercentage' => 3,
  //'maxSlippagePercentageReverse' => 3,
  //'maxBookLines' => 500,
  'includeBookData' => true //default false
], $xrplwinapiclient);

try {
  $Liquidity = $lc->get();
} catch (\Throwable) {
  //Unable to connect to provided XRPL server...
  $Liquidity = [
    'rate' => null,
    'safe' => false,
    'errors' => ['CONNECT_ERROR']
  ];
}

print_r($Liquidity); 
/**
 * [
 *   'rate' => NUMBER,
 *   'safe' => BOOLEAN,
 *   'errors' => ARRAY,
 *   'books' => ARRAY
 * ]
 **/

Running tests

Run all tests in "tests" directory.

composer test

or

./vendor/bin/phpunit --testdox

Sample

See sample.php

统计信息

  • 总下载量: 120
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固