<?php
class Binance
{
private $base = 'https://api.binance.com/api/';
private $api = '';
private $api_method = '';
/********** 基础信息 **********/
/**
* @title 获取所有交易对
* @description 获取币安的所有交易对
* @author 开发者
* @url /api/binance/exchangeInfo
* @method GET
*/
public function exchangeInfo() {
$this->api_method = "v3/exchangeInfo";
$this->api = $this->base . $this->api_method;
$res = $this->request($this->api);
return json_decode($res,true);
}
/**
* @title 获取某币最新币价
* @description 获取币安的某币最新价格
* @author 开发者
* @url /api/binance/get_common_symbols
* @method GET
*
* @param $symbol string 例:BTCUSDT
*/
public function getPrice($symbol) {
$param = ["symbol"=>$symbol];
$this->api_m
调用币安接口获取币种及当前价格
最新推荐文章于 2025-02-07 16:01:14 发布