0% found this document useful (0 votes)
15 views2 pages

CryptoCurrency Trading Guide - Python and Binance API

This document is a guide for cryptocurrency trading using Python and the Binance API. It includes instructions for installing the necessary library, connecting to the Binance client, retrieving transaction data, viewing account assets, and creating orders. The document also provides code snippets for various operations such as fetching recent trades and order history.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

CryptoCurrency Trading Guide - Python and Binance API

This document is a guide for cryptocurrency trading using Python and the Binance API. It includes instructions for installing the necessary library, connecting to the Binance client, retrieving transaction data, viewing account assets, and creating orders. The document also provides code snippets for various operations such as fetching recent trades and order history.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

November 22, 2021 Binance Template - Jupyter Notebook

Cryptocurrency Trading Guide - Python and Binance


API
Reference:
Unable to access the content of the provided link for translation.
binance.readthedocs.io/en/latest/overview.html

Install the library

pip install python-binance

Import

from secrets import api_key, api_secret


Remember to edit in the libraries on your computer if you encounter the Binance error.
from binance.client import Clientchange to binance_mod if there was an error in your usage
from binance import BinanceSocketManagerchange to binance_mod if there was an error in you

Connect with your customer

client=Client(api_key, api_secret)

Get the transactions of a currency

client.get_recent_trades(symbol='BNBBRL')
print(transacoes_btc[-1])

Get the data from your account

account=client.get_account()
for item in account:
# print(item)

localhost:8888/notebooks/Downloads/BinanceTrade/Template Binance.ipynb# 1/2


22/11/2021 Binance Template - Jupyter Notebook

View your current assets

forativoinconta
if float(asset["free"]) > 0:
print(active)

Order and Transaction History

client.get_all_orders(symbol='BNBBRL', limit=10)
print(orders)
client.get_my_trades(symbol='BNBBRL')
print(trades)

Create an order

from binance.enums import *switch to binance_mod if you encountered an error using your library
order=client.create_order(
BNBBRL
side=SIDE_SELL
type=ORDER_TYPE_MARKET,
quantity=0.01
print(order)

Get data from a pair of assets

client.get_symbol_info('BNBBRL')
print(info)

localhost:8888/notebooks/Downloads/BinanceTrade/Template Binance.ipynb# 2/2

You might also like