简体   繁体   English

从 Opensea API 中的 opensea current_price 计算显示的 eth 价格

[英]Calculate displayed eth price from opensea current_price in Opensea API

I'm trying to scrape prices from Opensea website.我正在尝试从 Opensea 网站上获取价格。 I managed to get datas from the API, but now i'm stuck as the stated "current_price" in the datas completely differs from what is displayed on the website.我设法从 API 获取数据,但现在我被卡住了,因为数据中所述的“current_price”与网站上显示的完全不同。 for exemple: "current_price":"48070000000000000000.00000000","current_bounty":"480700000000000000","bounty_multiple":"0.01", when the price is actually 58, doesnt seem to make much sense.例如:“current_price”:“480700000000000000000.00000000”,“current_bounty”:“480700000000000000”,“bounty_multiple”:“0.01”,当价格实际上是58时,似乎没有多大意义。 Hereinafter the code I use.以下是我使用的代码。 Regards问候

    import requests
    from bs4 import BeautifulSoup as bs
    import web3

    for tokenid in range(7028, 7029):
        i = str(tokenid)
        url = "https://api.opensea.io/api/v1/asset/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/" + i + "/"

        response = requests.request("GET", url)

        print(response.text)

something like that:类似的东西:

import requests

for tokenid in range(7000, 7029):
    i = str(tokenid)
    url = "https://api.opensea.io/api/v1/asset/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/" + i + "/"
    response = requests.request("GET", url)
    print(response.json()["orders"][0]["current_price"])

> output
46700000000000000000.00000000
46700000000000000000.00000000
46700000000000000000.00000000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM