NEW! Новый релиз 12.0.0 уже доступен! Подробности в Центре заботы

coins

0

Описание

Your total cryptocurrency wealth

Языки

PHP

  • Makefile
Сообщить о нарушении
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
2 года назад
README.md

Coins

Your total cryptocurrency wealth

Tests

Acquire the token

Go to the CoinMarketCap, register and get your token. Free plan will be more than enough for this script.

Setup

You'll need the

intl
extension and the
php
itself; in most cases it will be in your distro repository. Do something like this (Arch Linux example):

sudo pacman -Sy php php-intl

Don't forget to uncomment

extension=intl
in
/etc/php/php.ini

Create config file:

; ~/.config/coins/coins.conf
;
; Settings
; ----------------------------
token = your_api_token_from_coinmarketcap
url = https://pro-api.coinmarketcap.com/v2/cryptocurrency/quotes/latest
locale = en_US
currency = USD
; Assets
; ----------------------------
; Format is:
; [id] symbol = your amount of coins
[1] BTC = 0.042
[74] DOGE = 42.42
[5994] SHIB = 420000
[825] USDT = 2.99
[8544] FCL = 900
[5016] INNBC = 4000.00

Get & run the project:

git clone --branch main https://github.com/hexhat/coins.git && cd coins
php bin/coins.php --help

Or download the

.phar
file from release section:

chmod +x coins.phar
./coins.phar

Where to get the cryptocurrency
id
and the
symbol
?

I don't know lol. I was too lazy to read the whole API docs; I'll do it later 😉

As a temporary measure you can acquire all the data with

curl
and manually search id/symbol in the returned json:

curl -H "X-CMC_PRO_API_KEY: your_api_token_from_coinmarketcap" \
-H "Accept: application/json" \
-d "start=1&limit=5000&convert=USD" \
-G https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.