-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
56 lines (45 loc) · 2.09 KB
/
test.py
File metadata and controls
56 lines (45 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
def calculate_usdt_arbitrage_potential(
selling_price: float,
buying_price: float,
cycles: int,
iterations: int,
initial_capital: float
) -> tuple:
"""
Calculate potential capital and earnings from USDT arbitrage cycles.
Args:
selling_price (float): Price at which you sell USDT (higher price).
buying_price (float): Price at which you buy USDT (lower price).
cycles (int): Number of buy/sell cycles per iteration.
iterations (int): Number of iterations to repeat cycles.
initial_capital (float): Starting capital in USD.
Returns:
tuple: (final_capital, total_earnings) both in USD.
"""
capital = initial_capital
total_earnings = 0.0
if buying_price <= 0 or selling_price <= 0:
raise ValueError("Prices must be positive numbers.")
if buying_price >= selling_price:
raise ValueError("Buying price must be less than selling price for profit.")
for iteration in range(1, iterations + 1):
for cycle in range(1, cycles + 1):
# Earnings per cycle = capital * (price difference) / buying_price
earnings = capital * (selling_price - buying_price) / buying_price
capital += earnings
total_earnings += earnings
print(f"Iteration {iteration}: Capital = ${capital:.4f}, Earnings so far = ${total_earnings:.4f}")
return capital, total_earnings
# Example usage:
if __name__ == "__main__":
selling_price = float(input("Enter selling price of USDT (higher price): "))
buying_price = float(input("Enter buying price of USDT (lower price): "))
cycles = int(input("Enter number of cycles per iteration: "))
iterations = int(input("Enter number of iterations: "))
initial_capital = float(input("Enter initial capital in USD: "))
final_capital, total_earnings = calculate_usdt_arbitrage_potential(
selling_price, buying_price, cycles, iterations, initial_capital
)
print("\n=== Final Results ===")
print(f"Final capital (capital + earnings): ${final_capital:.4f}")
print(f"Total earnings: ${total_earnings:.4f}")