Ejemplo n.º 1
0
 def kutGetEstFundings_fast(self,ccy):
   key = 'kutEstFundings_'+ccy
   estFundings = cl.cache('r', key)
   if estFundings is None:
     estFundings = cl.kutGetEstFundings(self.api,ccy)
     cl.cache('w',key,estFundings)
   return estFundings
Ejemplo n.º 2
0
 def transferOutWithLock(self,fut):
   key = 'transferOutLock'
   transferOutLock = cl.cache('r', key)
   if transferOutLock is None:
     transferOutLock = threading.Lock()
     cl.cache('w', key, transferOutLock)
   with transferOutLock:
     while True:
       try:
         fut.futuresPrivate_post_transfer_out({'currency': 'USDT', 'amount': str(self.amount)})
         break
       except:
         print("[DEBUG: Error from KuCoin's private_post_transfer_out! ....]")
         time.sleep(5)
     time.sleep(KUT_REBAL_SLEEP)
Ejemplo n.º 3
0
 def accountsSubTransferWithLock(self, direction, accountType,subAccountType):
   key='accountsSubTransferLock'
   accountsSubTransferLock = cl.cache('r', key)
   if accountsSubTransferLock is None:
     accountsSubTransferLock = threading.Lock()
     cl.cache('w',key,accountsSubTransferLock)
   with accountsSubTransferLock:      
     while True:
       try:
         result = self.main_main.private_post_accounts_sub_transfer({'clientOid': uuid.uuid4().hex, 'currency': 'USDT', 'direction': direction, 'amount': str(self.amount),
                                                                     'accountType': accountType, 'subAccountType': subAccountType, 'subUserId': self.sub_id})
         break
       except:
         print("[DEBUG: Error from KuCoin's private_post_accounts_sub_transfer!]")
         time.sleep(5)
     time.sleep(KUT_REBAL_SLEEP)
     return result
Ejemplo n.º 4
0
def isLT(name,ccy,n,benchmark):
  myList=cl.cache('r', name + '_' + ccy)
  if len(myList)<n:
    return False
  else:
    return max(myList[-n:])<benchmark
Ejemplo n.º 5
0
def paramSave(name,ccy,param):
  key=name+'_'+ccy
  myList=cl.cache('r',key)
  if myList is None: myList=[]
  myList.append(param)
  cl.cache('w',key,myList)