From 819715ae2dd76aabc1e9a6c46337d8a782f9a3d8 Mon Sep 17 00:00:00 2001
From: enoch
Date: Sat, 28 Dec 2024 16:58:26 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20xb.php?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
引入Venus链上质押利率数据,修改算法
---
xb.php | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/xb.php b/xb.php
index fd88266..7519617 100644
--- a/xb.php
+++ b/xb.php
@@ -124,17 +124,25 @@ $bnbinfo['price']=apiGet('https://binanceapi.mirrorsite.eu.org/api/v3/avgPrice?s
$bnbinfo['amount']=$detail['bnb']->totalInvestAmount;
$bnbinfo['new']=$detail['bnb']->rebateTotalAmount;
$bnbinfo['rad']=$detail['bnb']->shareRatio;
-$bnbinfo['rate']=apiGet('https://binanceapi.mirrorsite.eu.org/sapi/v1/margin/crossMarginData'.sign('coin=BNB'))[0][0]->dailyInterest;
+$bnbinfo['bn_rate']=apiGet('https://binanceapi.mirrorsite.eu.org/sapi/v1/margin/crossMarginData'.sign('coin=BNB'))[0][0]->dailyInterest;
+$bnbinfo['venus_rate']=(apiGet('https://api.venus.io/markets/?chainId=56&underlyingSymbol=BNB')[0]->result[0]->borrowApy)/36500;
+$bnbinfo['rate']=max($bnbinfo['bn_rate'],$bnbinfo['venus_rate']);
+$bnbinfo['w_rate']=min($bnbinfo['bn_rate'],$bnbinfo['venus_rate']);
$fdinfo['amount']=$detail['fdusd']->totalInvestAmount;
$fdinfo['new']=$detail['fdusd']->rebateTotalAmount;
$fdinfo['rad']=$detail['fdusd']->shareRatio;
-$fdinfo['rate']=apiGet('https://binanceapi.mirrorsite.eu.org/sapi/v1/simple-earn/flexible/list'.sign('asset=FDUSD'))[0]->rows[0]->latestAnnualPercentageRate;
-$fdinfo['rate']=round($bnbinfo['rate']/365,5);
+$fdinfo['bn_rate']=apiGet('https://binanceapi.mirrorsite.eu.org/sapi/v1/simple-earn/flexible/list'.sign('asset=FDUSD'))[0]->rows[0]->latestAnnualPercentageRate;
+$fdinfo['venus_rate']=(apiGet('https://api.venus.io/markets/?chainId=56&underlyingSymbol=FDUSD')[0]->result[0]->borrowApy)/100;
+$fdinfo['rate']=round(max($fdinfo['bn_rate'],$fdinfo['venus_rate'])/365,5);
+$fdinfo['w_rate']=round(min($fdinfo['bn_rate'],$fdinfo['venus_rate'])/365,5);
-$best=($bnbinfo['amount']*$bnbinfo['price']*$bnbinfo['rate']*$coininfo->duration)/$bnbinfo['new'];
-$worst=(($bnbinfo['amount']*$bnbinfo['price']*$bnbinfo['rate']*$coininfo->duration)/$coininfo->rebateTotalAmount)*$bnbinfo['rad']+(($fdinfo['amount']*$fdinfo['rate']*$coininfo->duration)/$coininfo->rebateTotalAmount)*$fdinfo['rad'];
+#$best=($bnbinfo['amount']*$bnbinfo['price']*$bnbinfo['rate']*$coininfo->duration)/$bnbinfo['new'];
+#$worst=(($bnbinfo['amount']*$bnbinfo['price']*$bnbinfo['rate']*$coininfo->duration)/$coininfo->rebateTotalAmount)*$bnbinfo['rad']+(($fdinfo['amount']*$fdinfo['rate']*$coininfo->duration)/$coininfo->rebateTotalAmount)*$fdinfo['rad'];
+$best=(($bnbinfo['amount']*$bnbinfo['price']*$bnbinfo['rate']*$coininfo->duration)/$coininfo->rebateTotalAmount)*$bnbinfo['rad']+(($fdinfo['amount']*$fdinfo['rate']*$coininfo->duration)/$coininfo->rebateTotalAmount)*$fdinfo['rad'];
+$worst=(($bnbinfo['amount']*$bnbinfo['price']*$bnbinfo['w_rate']*$coininfo->duration)/$coininfo->rebateTotalAmount)*$bnbinfo['rad']+(($fdinfo['amount']*$fdinfo['w_rate']*$coininfo->duration)/$coininfo->rebateTotalAmount)*$fdinfo['rad'];
+
?>
@@ -353,4 +361,5 @@ $worst=(($bnbinfo['amount']*$bnbinfo['price']*$bnbinfo['rate']*$coininfo->durati