bitcoin automated trading

[Bitcoin Automated Trading] Calculate Binance Returns

tradingbot 2023. 9. 23. 01:29

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

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

Referral Code : 21391362

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

 

 

There are times when you wonder about the rate of return when trading coins. Let’s calculate the coins traded.

 

You can check your trade history using the get_my_trades method. The argument values are symbol, time, and quantity. At this time, the time is Unix time. Therefore, you need to convert it to UTC and then to Unix time milliseconds. And since API queries are expensive, you must use them with caution.

 

The following code receives Korea's time as a string, changes it to UTC, and then changes it to Unix time. I added the letter T to separate the date and time. Since millisenseconds are used, multiply by 1000.

 

et's call the get_my_trades method to retrieve the trade history from date 20230922 to today. The values we need to look at are quoteQty, price, and isBuyer.

 

I learned that quoteQty is a quote asset. In other words, it refers to converted USDT.

 

Here are the results: We can confirm that the results are identical to Binance’s results.

 

Because split sales are possible, the buy and sell values are added together.
The method of calculating return is ((Sell - Buy) / Buy )*100.

This is the execution result.

 

 

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

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

Referral Code : 21391362

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