Git Product home page Git Product logo

php-binance's Introduction

Larislackers-BinanceApi

Larislackers-BinanceApi is a Binance.com API wrapper for PHP. Moreover, the API wrapper supports all available functionality given from Binance along with sockets.

All requests are following the HTTP/1.1 protocol and all responses are returned as a PSR-7 ResponseInterface.

Tests are available after providing your key and secret in the corresponding class.

Install

composer require larislackers/php-binance

Usage

Information on how to obtain your API key and secret from Binance can be found here.

First things first, in order to use the API wrapper you should initialize it with the aforementioned key and secret like this:

$bac = new BinanceApiContainer('<your_key>', '<your_secret>');

Then, use the initiated object/var like this:

// Get all orders for a symbol (BNB/BTC pair).
$orders = $bac->getOrderBook(['symbol' => 'BNBBTC']);
var_dump($orders->getBody()->getContents());

You may find the rest of the supported commands inside the BinanceApiContainer.

Notes

All parameters required for each function must be in array format. More information can be found in the comments (phpdoc) and the links to the corresponding functions documented at Binance.

Avoid to use hardcoded values; enums are available (for intervals, types, sides, etc) for consistency and compliance with the Binance API.

You should use your own logger (like Sentry) and catch BinanceApiException for exceptions returned from Binance API and LarislackersException for exceptions returned from Websockets.

Don't reinvent the wheel by trying to cache results in a request lifecycle with static classes. Use a framework that supports caching (like Laravel), an extension (like Memcached) or using files. Additional information can be found here.

More information on how to use the library can be found here.

See the official API documentation for more information about the endpoints and responses.

License

Larislackers-BinanceApi is open-sourced software licensed under the MIT license

Donations/Support

If you find this library to your liking and enjoy using it, please consider a donation to one of the following addresses:

  • BTC: 13rSaL7ze89Pz28fNR9cNCnNVNvLWR3eFt
  • ETH: 0x03d4566d13ca7c7b30c39666b1f21ff97bee3f97
  • XMR: 49hxHRNwLSdQcXuCcac3ySMnAEuH4BhLWR8NddjHi6QBJHNvj1LqcSg2X8qpTQgsE1brzt37W6dLiiSN6uCj1CwyUPNr8R5

php-binance's People

Contributors

mastercoding avatar ppapadatis avatar

Watchers

 avatar

Forkers

tpsfintech

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.