Check balance via API at Binance — Python
Let’s say you wanna make periodic updates with your balance to your email or even to some telegram group. Or you made some script and before making trade yes is cool to have available balance at your broker in these case Binance.
Binance Python package!
Python-binance is the right package needed for this action. After these there is a straight forward way to grab your balance. Load your API credentials and call client.get_account()
After your balance is loaded it will show you, even those tokens that has a 0 balance at your account. That is pretty annoying so for prettify these let’s put data to DataFrame and remove those that has 0 vales.
Advice. Rounding from these case is usless for trading as it won’t work properly. For better rounding please see these.
Conclusion
These are one of the first steps to do before you make any trades at Binance or any other platform whatsoever with your script. To have balance in your local currency as SUM of all tokens you must multiply tokens by the current rate. After SUM all tokens and you will get value in USD, EUR or whatever you prefer.
Как конвертировать публичные ключи Bitcoin-PUBKEY HEX в Bitcoin-адрес Base58 и проверить баланс на наличие монет BTC
Результат проверки Python-скрипта bitcoin-checker.py
Так же мы научимся конвертировать публичный ключ Биткоина PUBKEY (HEX) в Биткойн Адрес (Base58) всю эту большую работу делает Python-скрипт pubtoaddr.py
В итоге мы с особой легкостью будем проверять баланс Биткоина, сканируя Блокчейн в терминале Google Colab [TerminalGoogleColab]
Ранее я записывал видеоинструкцию: «TERMINAL в Google Colab создаем все удобства для работ в GITHUB»
Давайте перейдем в репозиторию «CryptoDeepTools» и разберем в детали работу Bash-скрипта:getbalance.sh
Commands:
Файлы Код нашего Bash-скрипта: getbalance.sh
Утилита grep собирает все публичные ключи в один общий файл: pubkeyall.json
Утилита sort сортирует и удаляет дубли отбирает уникальные публичные ключи и результат сохраняет в файл: pubkey.json
Утилита rm удаляет pubkeyall.json
Утилита sed стирает префикс PUBKEY =
Запускаем Python-скрипт pubtoaddr.py конвертируем из файла pubkey.json где хранятся наши публичные ключи Биткоина PUBKEY (HEX) в файл addresses.json результат сохранится как Биткойн Адреса (Base58)
Мы получили файл addresses.json теперь проверим баланс монет Биткоина используя для этого Python-скрипт bitcoin-checker.py
Запускаем Python-скрипт: python2 bitcoin-checker.py
В итоге результат сохранится в файле: balance.json
Файл: balance.json
How to Convert Bitcoin-PUBKEY HEX Public Keys to Base58 Bitcoin Address and Check Balance for BTC Coins
The result of checking the Python script bitcoin-checker.py
We will also learn how to convert the public key of Bitcoin PUBKEY (HEX) to Bitcoin Address (Base58) All this big work is done by the Python script pubtoaddr.py
As a result, we will check the balance of Bitcoin with particular ease by scanning the Blockchain in the Google Colab terminal [TerminalGoogleColab]
Earlier I recorded a video tutorial: “TERMINAL in Google Colab creating all the conveniences for working in GITHUB”
Let’s go to the “CryptoDeepTools” repository and take a closer look at how the Bash script works: getbalance.sh
Commands:
Teams Files Our Bash script code: getbalance.sh
The utility grep collects all public keys into one common file: pubkeyall.json
The utility sort sorts and removes duplicates, selects unique public keys and saves the result to a file: pubkey.json
The utility rm removes pubkeyall.json
The utility sed erases the prefix PUBKEY =
We run the Python script pubtoaddr.py and convert from the file pubkey.json where our public Bitcoin keys are stored PUBKEY (HEX) to the file addresses.json the result will be saved as Bitcoin Addresses (Base58)
We have received the file addresses.json , now we will check the balance of Bitcoin coins using the bitcoin-checker.py Python script for this
Run Python script : python2 bitcoin-checker.py
As a result, the result will be saved in a file: balance.json
File: balance.json
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Python Bitcoin Balance checker. This is a simple program that can Find the Total balance of a certain BTC address/wallet
License
RezSat/Bitcoin-Address-Balance-Checker
Name already in use
- Local
- Codespaces
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more about the CLI.
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Bitcoin- Address/Wallet Balance-Checker
Python Bitcoin Balance checker. This is a simple program that can Find the Total balance of a certain BTC address/wallet
How to run
[#] Recomended to use Python 3.6 << I tested on this python version only
1] pip install -r requirements.txt or pip3 install -r requirements.txt
2] python3 balancechecker.py or python balancechecker.py or py -3 balancechecker.py
3] Enter a BTC address
About
Python Bitcoin Balance checker. This is a simple program that can Find the Total balance of a certain BTC address/wallet