Compare commits

...

3 Commits

Author SHA1 Message Date
Nicolás Sánchez 595dbcdb54 fixed OKX not subscribing 2025-11-20 09:31:32 -03:00
Nicolás Sánchez e6d4578807 added okx rate debug log entry 2025-11-18 16:38:25 -03:00
Nicolás Sánchez 23d09487d8 if clause corrected 2025-10-11 10:09:19 -03:00
3 changed files with 5 additions and 3 deletions

View File

@ -251,7 +251,7 @@ class earner:
earning_delta = target_earning_amount - Decimal(self.earning_balance) earning_delta = target_earning_amount - Decimal(self.earning_balance)
if earning_delta>Decimal(self.step_size) and time.time()-self.last_subscription_time>self.time_between_subscriptions: if earning_delta>Decimal(self.step_size) and time.time()-self.last_subscription_time>self.time_between_subscriptions:
self.subscribe(earning_delta) self.subscribe(earning_delta)
if earning_delta<-Decimal(self.step_size) and time.time()-self.last_redemption_time>self.time_between_redemptions: elif earning_delta<-Decimal(self.step_size) and time.time()-self.last_redemption_time>self.time_between_redemptions:
self.redeem(-earning_delta) self.redeem(-earning_delta)
#print(f"{str(self.connector)} - Difference: {earning_delta}") #print(f"{str(self.connector)} - Difference: {earning_delta}")
else: else:

View File

@ -177,7 +177,7 @@ class okx_earn:
"amount": response["data"][0]["amt"] "amount": response["data"][0]["amt"]
} }
else: else:
return {"Error": response} return {"Error": response, "Rate": str(rate)}
def redeem_product(self, coin, amount): def redeem_product(self, coin, amount):
@ -207,6 +207,8 @@ class okx_earn:
Returns the 24hs average lending rate Returns the 24hs average lending rate
''' '''
rate = self.earning_api.get_public_borrow_info(coin) rate = self.earning_api.get_public_borrow_info(coin)
if rate["data"][0]["avgRate"]=='0':
return str(rate["data"][0]["estRate"])
return str(rate["data"][0]["avgRate"]) return str(rate["data"][0]["avgRate"])

View File

@ -483,7 +483,7 @@ signal.signal(signal.SIGTERM, shutdown_handler)
if __name__=="__main__": if __name__=="__main__":
version = "2025.10.11" version = "2025.11.20"
start_time = time.time() start_time = time.time()
with open("config.json") as f: with open("config.json") as f: