📜  doge price (1)

📅  最后修改于: 2023-12-03 15:00:31.486000             🧑  作者: Mango

Doge Price

This project is designed to provide real-time updates on the price of Dogecoin (DOGE). It uses the CoinGecko API to fetch the current market price of DOGE in various currencies.

Installation

To install the dependencies, run the following command:

pip install -r requirements.txt
Usage

To get the current price of DOGE in USD, run the following command:

python doge_price.py

This will output something like:

1 DOGE = $0.21

You can also specify a different currency using the --currency flag:

python doge_price.py --currency EUR

This will output something like:

1 DOGE = €0.18
Code

Here is the code used to fetch the current price of DOGE:

import requests

currency = "USD"
url = f"https://api.coingecko.com/api/v3/simple/price?ids=dogecoin&vs_currencies={currency}"
response = requests.get(url).json()

doge_price = response["dogecoin"][currency]

print(f"1 DOGE = ${doge_price}")

This code uses the requests library to make a GET request to the CoinGecko API. It specifies the currency (which defaults to USD) and fetches the current price of DOGE in that currency. Finally, it prints out the result in a human-readable format.