使用BSCSCAN API从交易数据中检索硬币基价(或数量)
我正在尝试编写一个应用程序,以根据我使用BSCSCAN API做出的掉期来跟踪我的收益/损失。我可以轻松地检索我使用BSCSCAN“帐户”模块API端点之一进行的所有交换(准确地说是通过地址获取'BEP-20代币传输事件'列表)。这是身体反应的一个例子:
{
"status": "1",
"message": "OK",
"result": [{
"blockNumber": "2304192",
"timeStamp": "1605585978",
"hash": "0x7a5abf86c82d3f97a40dd841a9f2089fbe3ac1332157c01bd1a1d89f575c45fc",
"nonce": "57",
"blockHash": "0x703438fd8ba435996895a6b9b711934cc590c3e9297a7066419aa88dd9d83acc",
"from": "0x641414e2a04c8f8ebbf49ed47cc87dccba42bf07",
"contractAddress": "0xc9849e6fdb743d08faee3e34dd2d1bc69ea11a51",
"to": "0x7bb89460599dbf32ee3aa50798bbceae2a5f7f6a",
"value": "27605634758857128698365",
"tokenName": "Bunny Token",
"tokenSymbol": "BUNNY",
"tokenDecimal": "18",
"transactionIndex": "2",
"gas": "5000000",
"gasPrice": "20000000000",
"gasUsed": "2312130",
"cumulativeGasUsed": "2475576",
"input": "deprecated",
"confirmations": "8172919"
}
]
}
因此值输入(“值”:“ 2760563475857128698365”)给出了基础硬币“货币”中的值该交易。我已经查看了其他BSCSCAN API,但找不到任何可以帮助我检索给定交易的硬币的价格。
有谁知道使用BSCCAN API根据交易数据来检索硬币(或购买数量)的价格?
tia
I'm trying to write an app to track my gains/losses for tax purposes based on the swaps I've made using Bscscan APIs. I can easily retrieve all the swaps I've made using one of BscScan "accounts" module api endpoint (Get a list of 'BEP-20 Token Transfer Events' by Address to be exact). Here's an example of the body response:
{
"status": "1",
"message": "OK",
"result": [{
"blockNumber": "2304192",
"timeStamp": "1605585978",
"hash": "0x7a5abf86c82d3f97a40dd841a9f2089fbe3ac1332157c01bd1a1d89f575c45fc",
"nonce": "57",
"blockHash": "0x703438fd8ba435996895a6b9b711934cc590c3e9297a7066419aa88dd9d83acc",
"from": "0x641414e2a04c8f8ebbf49ed47cc87dccba42bf07",
"contractAddress": "0xc9849e6fdb743d08faee3e34dd2d1bc69ea11a51",
"to": "0x7bb89460599dbf32ee3aa50798bbceae2a5f7f6a",
"value": "27605634758857128698365",
"tokenName": "Bunny Token",
"tokenSymbol": "BUNNY",
"tokenDecimal": "18",
"transactionIndex": "2",
"gas": "5000000",
"gasPrice": "20000000000",
"gasUsed": "2312130",
"cumulativeGasUsed": "2475576",
"input": "deprecated",
"confirmations": "8172919"
}
]
}
So the value input ("value": "27605634758857128698365") gives the value in the underlying coin "currency" - in this case "Bunny Token" - but without knowing the quantity of that coin bought, I can't determine the cost basis of that transaction. I've looked at other bscscan APIs but I couldn't find any that would could help me retrieve the price of the coin for a given transaction.
Does anyone know if there's a way to retrieve the price of a coin (or the quantity bought) based on the transaction data using bsccan api?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论