Updated 3 years ago
1. Setup
Let's first get the API and secret key by logging into the Binance app.
apikey = 'FAB9XUbxVcjsJbeVStMBjRQybGZXhR8Io8qNzX8DAmyv7RLiGBEvTIaF0DQJIioq'
secret = 'yI4XL05lYRyJMF2CnGM4WjgBTZyrdsnO4T5cdo7LufIg5db6Rte2keGGp9SEobcA'
#!pip install python-binance mplfinance
Collecting mplfinance
Downloading mplfinance-0.12.7a17-py3-none-any.whl (62 kB)
Requirement already satisfied: pandas in c:\users\asus\anaconda3\lib\site-packages (from mplfinance) (1.1.5)
Requirement already satisfied: matplotlib in c:\users\asus\anaconda3\lib\site-packages (from mplfinance) (3.3.2)
Collecting python-binance
Downloading python_binance-1.0.14-py2.py3-none-any.whl (63 kB)
Requirement already satisfied: ujson in c:\users\asus\anaconda3\lib\site-packages (from python-binance) (4.0.1)
Requirement already satisfied: requests in c:\users\asus\anaconda3\lib\site-packages (from python-binance) (2.25.1)
Requirement already satisfied: six in c:\users\asus\anaconda3\lib\site-packages (from python-binance) (1.15.0)
Collecting aiohttp
Downloading aiohttp-3.7.4.post0-cp37-cp37m-win_amd64.whl (630 kB)
Requirement already satisfied: attrs>=17.3.0 in c:\users\asus\anaconda3\lib\site-packages (from aiohttp->python-binance) (20.3.0)
Requirement already satisfied: chardet<5.0,>=2.0 in c:\users\asus\anaconda3\lib\site-packages (from aiohttp->python-binance) (4.0.0)
Requirement already satisfied: typing-extensions>=3.6.5 in c:\users\asus\anaconda3\lib\site-packages (from aiohttp->python-binance) (3.7.4.3)
Collecting async-timeout<4.0,>=3.0
Downloading async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting multidict<7.0,>=4.5
Downloading multidict-5.1.0-cp37-cp37m-win_amd64.whl (48 kB)
Collecting yarl<2.0,>=1.0
Downloading yarl-1.6.3-cp37-cp37m-win_amd64.whl (124 kB)
Requirement already satisfied: idna>=2.0 in c:\users\asus\anaconda3\lib\site-packages (from yarl<2.0,>=1.0->aiohttp->python-binance) (2.10)
Collecting dateparser
Downloading dateparser-1.0.0-py2.py3-none-any.whl (279 kB)
Requirement already satisfied: python-dateutil in c:\users\asus\anaconda3\lib\site-packages (from dateparser->python-binance) (2.8.1)
Requirement already satisfied: regex!=2019.02.19 in c:\users\asus\anaconda3\lib\site-packages (from dateparser->python-binance) (2020.11.13)
Requirement already satisfied: pytz in c:\users\asus\anaconda3\lib\site-packages (from dateparser->python-binance) (2020.5)
Requirement already satisfied: numpy>=1.15 in c:\users\asus\anaconda3\lib\site-packages (from matplotlib->mplfinance) (1.19.4)
Requirement already satisfied: certifi>=2020.06.20 in c:\users\asus\anaconda3\lib\site-packages (from matplotlib->mplfinance) (2021.5.30)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\asus\anaconda3\lib\site-packages (from matplotlib->mplfinance) (1.3.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in c:\users\asus\anaconda3\lib\site-packages (from matplotlib->mplfinance) (2.4.7)
Requirement already satisfied: cycler>=0.10 in c:\users\asus\anaconda3\lib\site-packages (from matplotlib->mplfinance) (0.10.0)
Requirement already satisfied: pillow>=6.2.0 in c:\users\asus\anaconda3\lib\site-packages (from matplotlib->mplfinance) (8.0.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\asus\anaconda3\lib\site-packages (from requests->python-binance) (1.26.2)
Collecting tzlocal
Downloading tzlocal-3.0-py3-none-any.whl (16 kB)
Collecting backports.zoneinfo
Downloading backports.zoneinfo-0.2.1-cp37-cp37m-win_amd64.whl (38 kB)
Collecting tzdata
Downloading tzdata-2021.1-py2.py3-none-any.whl (338 kB)
Collecting websockets
Downloading websockets-10.0-cp37-cp37m-win_amd64.whl (95 kB)
Installing collected packages: tzdata, multidict, backports.zoneinfo, yarl, tzlocal, async-timeout, websockets, dateparser, aiohttp, python-binance, mplfinance
Successfully installed aiohttp-3.7.4.post0 async-timeout-3.0.1 backports.zoneinfo-0.2.1 dateparser-1.0.0 mplfinance-0.12.7a17 multidict-5.1.0 python-binance-1.0.14 tzdata-2021.1 tzlocal-3.0 websockets-10.0 yarl-1.6.3
from binance import Client, ThreadedWebsocketManager, ThreadedDepthCacheManager
import pandas as pd