[Bitcoin Automated Trading] Automatically trade all coins using Binance RSI
------------------------------------------------------------------------------------------------------------------
https://accounts.binance.com/register?ref=21391362 <- Get Discount on Binance Futures Fees With Referral Code
Referral Code : 21391362
------------------------------------------------------------------------------------------------------------------
Using what we have learned so far, we will create automatic trading of all coins listed on Binance using RSI.
It is the same as the automatic trading algorithm using RSI created previously. However, because it deals with all coins, the coin information must be stored and managed separately. You can save it using a file or database. I will manage the information by saving it in the file sqlite3.
1. reset
The get_exchange_info method is called to store the minimum requirement information when trading coins, and the saved information is called and used when trading coins.

There are a huge number of coins that can be traded on Binance. Among them, unnecessary coins must be excluded. Since I plan to only trade USDT, I will exclude coins other than USDT and also exclude leveraged coins. We also exclude stablecoins because there is no need to buy or sell other stablecoins.
Some coins have been delisted and cannot be traded. The status says 'BREAK', but these coins are not tradable and must be excluded. Only coins with the value 'TRADING' in status are added.

2. RSI Scheduler
ind the RSI of all coins saved in 1. Let's use the formula we learned previously to calculate RSI.

The RSI calculation numbers were conservative. The window value was set to 21 based on 1-hour bars. (windows default 14)

Run the scheduler so that RSI is calculated every minute.

3. buy logic
Since the price and unit of quantity are different for each coin, you must obtain the minimum required quantity when purchasing. You learned earlier how to find the minimum required quantity. Just find the min_notional value and the current coin price and divide them.
Trading with a maker has the great advantage of saving commissions, but it has the disadvantage of having to continuously check the order status when an order is received, and having to manage all orders when multiple coins are ordered. So I buy at market price.
When the purchase is completed, a flag value is given so that the coin can proceed to the sell logic.

Since coin prices change every second, if the price drops the minimum required quantity will be higher. Then, the purchase quantity is adjusted to prevent the purchase from failing due to insufficient minimum required quantity. You can increase the total quantity or finely adjust it using setp_size.

4. sell logic
Obtain the entire quantity of the coin in your current wallet and sell it at the market price.
When the sale is completed, a flag value is given so that the coin can proceed to the purchase logic again.


5. main logic
heck the RSI of all coins and proceed with buy/sell logic according to conditions.

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