jybtx / binance-api

Binance API 类及如何为 Laravel 使用 API

dev-master 2020-03-30 02:05 UTC

This package is auto-updated.

Last update: 2024-09-29 05:48:45 UTC


README

Binance API 类及如何为 Laravel 使用 API。

安装

$ composer require jybtx/binance-api

Laravel

  • PHP >= 7.0.0
  • Laravel >= 5.5
  • Fileinfo PHP 扩展

ServiceProvider 将自动附加

配置

config/binance.php 文件包含一组配置,你可以在那里找到默认配置。

其他

在你的 config/app.php 中,将 Jybtx\BinanceApi\BinanceServiceProvider::class 添加到 providers 数组的末尾

'providers' => [
    ...
    Jybtx\BinanceApi\BinanceServiceProvider::class,
],
'aliases'  => [
    ...
    "Binance": Jybtx\BinanceApi\BinanceAPIFacade::class,
]

发布配置

php artisan vendor:publish --provider "Jybtx\BinanceApi\BinanceServiceProvider"

php artisan vendor:publish --tag=binance

用法

use Binance;  

$result = Binance::bookPrices();

方法

行情类 API

  • buy($symbol, $quantity, $price, $type = "LIMIT")
  • sell($symbol, $quantity, $price, $type = "LIMIT")
  • cancel($symbol, $orderid)
  • orderStatus($symbol, $orderid)
  • openOrders($symbol)
  • allOrders($symbol, $limit = 500)
  • trades($symbol)
  • prices()
  • bookPrices()
  • account()
  • balances($priceData = false)
  • order($side, $symbol, $quantity, $price, $type = "LIMIT")
  • candlesticks($symbol, $interval = "5m")

参考文档

binance-api-php

贡献

你可以通过以下三种方式之一进行贡献:

  1. 使用 问题跟踪器 提交错误报告。
  2. 问题跟踪器 上回答问题或修复错误。
  3. 贡献新功能或更新 wiki。

代码贡献过程并不非常正式。你只需确保遵循 PSR-0、PSR-1 和 PSR-2 编码指南。任何新的代码贡献都必须附有适用的单元测试。

许可证

MIT