Esempio n. 1
0
 def __init__(self):
     j = httphandler.getWallet()
     self.totalFunds = j['TotalFunds']
     self.availableFunds = j['AvailableFunds']
     self.shares = {}
     for con in j['Shares']:
         self.shares[con['ContractId']] = con['Quantity']
 def __init__(self):
     j = httphandler.getWallet()
     self.totalFunds = j['TotalFunds']
     self.availableFunds = j['AvailableFunds']
     self.shares = {}
     for con in j['Shares']:
         self.shares[con['ContractId']] = con['Quantity']
 def setRefresh(self, item, duration):
     if item == "Wallet":
         self.Jwallet = httphandler.getWallet()
     elif item == "Contracts":
         self.Jcontracts = httphandler.getContracts()
     elif item == "Transaction":
         self.Jtransaction = httphandler.getTransaction()
     elif item == "Orders":
         self.Jorders = httphandler.getOrders()
     threading.Timer(duration, self.setRefresh, [item, duration]).start()
 def setRefresh(self, item, duration):
     if item == 'Wallet':
         self.Jwallet = httphandler.getWallet()
     elif item == 'Contracts':
         self.Jcontracts = httphandler.getContracts()
     elif item == 'Transaction':
         self.Jtransaction = httphandler.getTransaction()
     elif item == 'Orders':
         self.Jorders = httphandler.getOrders()
     threading.Timer(duration, self.setRefresh, [item, duration]).start()
    def __new__(self):
        if not self._instance:
            self.Jwallet = httphandler.getWallet()
            self.Jcontracts = httphandler.getContracts()
            self.Jtransaction = httphandler.getTransaction()
            self.Jorders = httphandler.getOrders()
            self.dict = {}
            self.timeStamp = time.time()
            for con in self.Jcontracts:
                self.dict[con["Id"]] = con

            self._instance = super(CachedJSON, self).__new__(self)
        return self._instance
    def __new__(self):
        if not self._instance:
            self.Jwallet = httphandler.getWallet()
            self.Jcontracts = httphandler.getContracts()
            self.Jtransaction = httphandler.getTransaction()
            self.Jorders = httphandler.getOrders()
            self.dict = {}
            self.timeStamp = time.time()
            for con in self.Jcontracts:
                self.dict[con['Id']] = con

            self._instance = super(CachedJSON, self).__new__(self)
        return self._instance