bug fixes

This commit is contained in:
Nicolás Sánchez 2025-01-09 12:12:41 -03:00
parent e7374b1586
commit 8e999d5049
3 changed files with 39 additions and 3 deletions

View File

@ -165,7 +165,7 @@ class earner:
elif str(self.connector)=="kucoin": elif str(self.connector)=="kucoin":
position = self.connector.get_position(self.currency) position = self.connector.get_position(self.currency)
if "Error" not in position: if "Error" not in position:
redemption = self.connector.redeem_product(position["orderId"],amount=amount) redemption = self.connector.redeem_product(position["positionId"],amount=amount)
else: else:
print(f"{str(self.connector)} - Position not found!") print(f"{str(self.connector)} - Position not found!")
self.write_to_log("Position not found! " + str(position)) self.write_to_log("Position not found! " + str(position))
@ -173,6 +173,7 @@ class earner:
elif str(self.connector)=="okx": elif str(self.connector)=="okx":
redemption_step = self.connector.redeem_product(self.currency, amount=amount) redemption_step = self.connector.redeem_product(self.currency, amount=amount)
if "Success" in redemption_step: if "Success" in redemption_step:
time.sleep(1) #Breathing room
funding_balance = self.connector.get_funding_balance(self.currency) funding_balance = self.connector.get_funding_balance(self.currency)
transfer_step = self.connector.transfer_to_trading(self.currency, funding_balance[self.currency]) transfer_step = self.connector.transfer_to_trading(self.currency, funding_balance[self.currency])
if "Success" in transfer_step: if "Success" in transfer_step:

View File

@ -207,8 +207,16 @@ class gateio_earn:
return {"Error": "To be implemented"} return {"Error": "To be implemented"}
def get_rewards_history(self, type="ALL", **kwargs): def get_rewards_history(self, coin):
return {"Error": "To be implemented"} url = f"/earn/uni/interests/{coin}"
headers = {"Accept": "application/json", "Content-Type": "application/json"}
sign_headers = self.gen_sign("GET", self.prefix+url)
headers.update(sign_headers)
response = requests.get(self.host+self.prefix+url, headers=headers)
if response.status_code == 200:
return response.json()
else:
return {"Error": response.text}
def get_subscription_preview(self, product_id, amount, **kwargs): def get_subscription_preview(self, product_id, amount, **kwargs):

27
profits.py Normal file
View File

@ -0,0 +1,27 @@
from libraries.wrappers import earn_binance
from libraries.wrappers import earn_okx
from libraries.wrappers import earn_gateio
from libraries.balance_accounts import balance_accounts
from decimal import Decimal
binance = earn_binance.binance_earn()
gateio = earn_gateio.gateio_earn()
okx = earn_okx.okx_earn()
print("Profits OKX:")
total_rewards = Decimal(0)
rewards = okx.get_lending_history("USDT")
for item in rewards["data"]:
total_rewards += Decimal(item["earnings"])
print(total_rewards)
print("Profits Gate.io:")
print(gateio.get_rewards_history("USDT")["interest"])
print("Profits Binance:")
total_rewards = Decimal(0)
rewards = binance.get_rewards_history()
for item in rewards["rows"]:
total_rewards += Decimal(item["rewards"])
print(total_rewards)