コード例 #1
0
ファイル: wallet.py プロジェクト: lungyoungyu/predictious-bot
 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']
コード例 #2
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']
コード例 #3
0
 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()
コード例 #4
0
 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()
コード例 #5
0
    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
コード例 #6
0
    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