Code Monkey home page Code Monkey logo

Comments (18)

carllewis1980 avatar carllewis1980 commented on May 28, 2024 1

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 28, 2024

Composer should have installed the necessary dependencies for you

try this from inside your project directory
composer install ratchet/pawl

or if that doesn't work

composer install ratchet/pawl --save

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 28, 2024

If you get stuck start over in a new project directory

composer require "jaggedsoft/php-binance-api @dev"

then make your bot.php file and verify it works

require 'vendor/autoload.php';
$api = new Binance\API("<api key>","<secret>");

$ticker = $api->prices();
print_r($ticker); // List prices of all symbols
echo "Price of BNB: {$ticker['BNBBTC']} BTC.".PHP_EOL;

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 28, 2024

btw, the javascript version of this library is much easier to use if you are comfortable with that
https://github.com/jaggedsoft/node-binance-api/

from php-binance-api.

carllewis1980 avatar carllewis1980 commented on May 28, 2024

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 28, 2024

'git' is not recognized as an internal or external command,

You need to install git

from php-binance-api.

carllewis1980 avatar carllewis1980 commented on May 28, 2024

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 28, 2024

Normally it's installed when you install composer

https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
For me on linux it is sudo apt-get install git-all

For windows and mac instructions they explain it in the link

from php-binance-api.

carllewis1980 avatar carllewis1980 commented on May 28, 2024

from php-binance-api.

carllewis1980 avatar carllewis1980 commented on May 28, 2024

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 28, 2024

Try composer require "jaggedsoft/php-binance-api" from your project directory
If you have trouble after try this
composer require "jaggedsoft/php-binance-api @dev"

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 28, 2024

There is another PHP API that you may have better luck with
https://github.com/larislackers/php-binance

Or you can try setting up a $5 VPS (vultr, digitalocean, etc) running debian linux and deploy your bot there, that is what I do

from php-binance-api.

carllewis1980 avatar carllewis1980 commented on May 28, 2024

from php-binance-api.

carllewis1980 avatar carllewis1980 commented on May 28, 2024

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 28, 2024

Simple example

$api->trades(["BTCUSDT"], function($api, $symbol, $trades) {
	echo "BTCUSDT: \${$trades['price']}".PHP_EOL;
});

Access a variable outside the function (keep a global $ticker object)

$ticker = [];
$api->trades(["BTCUSDT"], function($api, $symbol, $trades) {
	global $ticker;
	$ticker[$symbol] = $trades['price'];
	echo "BTCUSDT: \${$ticker[$symbol]}".PHP_EOL;
});

from php-binance-api.

carllewis1980 avatar carllewis1980 commented on May 28, 2024

from php-binance-api.

carllewis1980 avatar carllewis1980 commented on May 28, 2024

from php-binance-api.

carllewis1980 avatar carllewis1980 commented on May 28, 2024

from php-binance-api.

Related Issues (20)

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.