Comments (10)
Yes available as of a week or two ago you can do this:
$prevDay = $api->prevDay("BNBBTC");
print_r($prevDay);
echo "BNB price change since yesterday: ".$prevDay['priceChangePercent']."%".PHP_EOL;
echo "BNB volume: {$prevDay['quoteVolume']} BTC";
Array
(
[symbol] => BNBBTC
[priceChange] => 0.00000288
[priceChangePercent] => 0.908
[weightedAvgPrice] => 0.00031564
[prevClosePrice] => 0.00031715
[lastPrice] => 0.00032005
[lastQty] => 34.00000000
[bidPrice] => 0.00031999
[bidQty] => 50.00000000
[askPrice] => 0.00032109
[askQty] => 20.00000000
[openPrice] => 0.00031717
[highPrice] => 0.00032700
[lowPrice] => 0.00030110
[volume] => 2985069.00000000
[quoteVolume] => 942.20144118
[openTime] => 1513752888817
[closeTime] => 1513839288817
[firstId] => 2851228
[lastId] => 2900234
[count] => 49007
)
BNB price change since yesterday: 0.908%
BNB volume: 942.20144118 BTC
from php-binance-api.
That is what Quote Volume is? I see that but it doesn't seem to match up with what I am seeing from the binance exchange. I am looking at VXG where current volume is 459607 but quote volume is showing 27266.37230013 Maybe i don't quite understand.
from php-binance-api.
Quote volume is supposed to be in the base pair, so in this case BTC. If you were getting quoteVolume on the ETH side, it would tell you how much volume worth of ETH
The easiest solution is probably to take the volume number, and multiply this by the btc price. This would give you the current BTC value for that asset no matter what pair you're on
$ticker = $api->prices();
$btcvolume = $ticker['BNBBTC'] * $prevDay['volume'];
echo "Volume in BTC: {$btcvolume}".PHP_EOL;
from php-binance-api.
Complete example
$ticker = $api->prices();
print_r($ticker); // List prices of all symbols
echo "Price of BNB: {$ticker['BNBBTC']} BTC.".PHP_EOL;
$prevDay = $api->prevDay('BNBBTC');
print_r($prevDay);
echo "BNB price change since yesterday: ".$prevDay['priceChangePercent']."%".PHP_EOL;
echo "BNB volume: {$prevDay['quoteVolume']} BTC".PHP_EOL;
$btcvolume = $ticker['BNBBTC'] * $prevDay['volume'];
echo "Volume in BTC: {$btcvolume}".PHP_EOL;
from php-binance-api.
Thanks for your example. However, I am not sure this is what I am looking for. I am trying to get the Volume of a specific ticker for the given moment... So say right now current volume is.... My goal is trying to find tickers that currently have a spike in volume.. Hopefully this makes sense.
from php-binance-api.
This is one way to check the volume over the past 5 minutes
You can make your own alert if it increases +10% or more
// Periods: 1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M
binance.websockets.candlesticks(['BNBBTC'], "5m", function(candlesticks) {
let { e:eventType, E:eventTime, s:symbol, k:ticks } = candlesticks;
let { o:open, h:high, l:low, c:close, v:volume, n:trades, i:interval, x:isFinal, q:quoteVolume, V:buyVolume, Q:quoteBuyVolume } = ticks;
/*console.log(symbol+" "+interval+" candlestick update");
console.log("open: "+open);
console.log("high: "+high);
console.log("low: "+low);
console.log("close: "+close);*/
console.log(symbol+" "+interval+" volume: "+volume);
});
from php-binance-api.
Any chance to show this with php?
from php-binance-api.
Oops
$api->chart(["BNBBTC","BTCUSDT"], "5m", function($api, $symbol, $chart) {
echo "{$symbol} chart update\n";
$last_update = array_pop($chart);
print_r($last_update);
$volume = $last_update['volume'];
echo "{$symbol} volume: {$volume}\n";
});
For this to work with more than one symbol, make sure you are using the latest version
from php-binance-api.
Is there a way to get this data without using websockets? This script I am using isn't async. I am just trying to find a way to get this value. I think I would have to re-write my entire script to get data from this..
from php-binance-api.
//Periods: 1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M
$ticks = $api->candlesticks("BNBBTC", "5m");
$last_update = array_pop($ticks);
print_r($last_update);
$volume = $last_update['volume'];
echo "volume: {$volume}\n";
from php-binance-api.
Related Issues (20)
- The problem of buying a large number of wallets HOT 1
- Too much request weight used; current limit is 1200 request weight per 1 MINUTE.
- Spot Order with all the balance
- I need to use this API in laravel
- signedRequest error: API Key not set!
- How to hide warning of config file
- I have a problem MIN_NOTIONAL HOT 2
- How do I know if someone's API is correct or not?
- how to solve Curl error: HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1) HOT 1
- How to create User Data Stream for multiple binance accounts using php-binance-api HOT 2
- php8.1 Call to undefined function GuzzleHttp\Psr7\uri_for() HOT 2
- Can this be used to build a website like binance.com?
- How to get depthCache information without using WebSocket, is that possible?
- bug: Signature for this request is not valid.
- websockets are not working HOT 1
- CURL ERROR
- Curl error: SSL: no alternative certificate subject name matches target host name 'api.binance.com'
- Undefined array key "minQty" HOT 1
- FIXED minQty filter
- The websocket does not show. This is mistake?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-binance-api.