본문 바로가기

bitcoin automated trading

[Bitcoin automatic trading] Automatically buy and sell coins with Binance API

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

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

Referral Code : 21391362

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

 

 

1. Get the Minimum Required Quantity Value

Let’s automatically trade with the Binance API. Unlike stocks, the advantage of coins is that they are expensive, so you can buy them by dividing them with decimals, so you can buy and sell bitcoins with little money. However, there is a minimum required quantity for each exchange coin when trading. This will bring the minimum required value.

 

Use the get_simbol_info method to get coin information.

LOT_SIZE minQty Minimum required quantity for sale
maxQty Maximum required quantity at the time of sale
MIN_NOTIONAL minNotional Minimum Required Price

 

In Python 1e-05 is 0.00001 . The minimum required purchase quantity is 0.00001, and the minimum purchase price must be 10 USDT.

 

 

2. Spot trading API

Let's program the actual number of copies. There are 3 APIs related to purchase. Since buying and selling are opposite concepts, we will proceed with only buying.

 

order_market places an order at the market price.

symbol Coin name
side BUY/SELL
quantity sale quantity

 

If the purchase was successful at the market price, you can check it on the actual website.

 

order_limit places an order at the limit price.

symbol Coin name
side BUY/SELL
quantity sale quantity
price limits
timeInForce GTC/IOC/FOK

 

It triggers the order_oco_buy trigger, which submits a buy order when the specified price is reached.

symbol Coin name
quantity sale quantity
price total purchase price
stopPrice Trigger limit (places order)
stopLimitPrice buy limit
stopLimitTimeInForce GTC/FOK/IOC

 

full source code

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

 

 

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

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

Referral Code : 21391362

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