bitcoin automated trading

[Bitcoin automatic trading] Binance API development - installation and time synchronization

tradingbot 2022. 8. 29. 16:21

------------------------------------------------------------------------------------------------------------------

https://accounts.binance.com/register?ref=21391362 <- Get Discount on Binance Futures Fees With Referral Code

Referral Code : 21391362

------------------------------------------------------------------------------------------------------------------

 

Using Python, you can easily develop Binance Coin automated trading programs.

 

1. install python

2. Install the library

3. Programming

 

 

1. Install Python

https://www.python.org/downloads/release/python-379/

Download and install Python that meets the specifications.

 

Add a folder with Python and the Scripts folder to the environment variable.

 

 

2. Library installation

Create a C: \ Project \ Trader folder and go to the Trader folder.

After installing Python-Binance with the PIP command, let's create a file called test.py.

> pip install python-binace

 

 

3. Programming

Here is the Binance API documentation site: You can refer to it when programming.

https://python-binance.readthedocs.io/en/latest/overview.html

 

When calling the API, synchronize the time between the server and the PC to work without problems. Therefore, let's do programming that takes time from the Binance server.

- Input key and secret key issued by Binance in the key and Secret column

- Server access instance by calling a Client class

- Investing Get_Server_Time to bring time from the Binance server

 

I took time from the Binance server. We will synchronize the setsystemTime function in the Win32 API and sync with the PC.

 

Pypiwin32 libraries are required to call the Win32 API in Python.

> pip install pypiwin32

 

Import Win32API, Time, and DateTime and convert the time you receive from the Binance server to GMT time, call it to the setsystemTime function and insert it into an argument. At this time, the point is to be careful because it is a system function. So let's run the CMD window with Admin permissions.

full source code

https://github.com/kivy678/BitcoinTrade/blob/main/syncTime.py

 

 

------------------------------------------------------------------------------------------------------------------

https://accounts.binance.com/register?ref=21391362 <- Get Discount on Binance Futures Fees With Referral Code

Referral Code : 21391362

------------------------------------------------------------------------------------------------------------------