def handle(self, *args, **options):
     for   CurrencyTitle  in ('LTC', 'DOGE', 'NVC', 'DRK', 'RMS', 'CLR', 'PPC'):
         Crypton = CryptoAccount(CurrencyTitle, "trade_stock")
         CurIns = Currency.objects.get(title = CurrencyTitle)
     
         bulk_add = []
         Addresses = {}
             
         for i in xrange(1,50):
                 FreeAccount = PoolAccounts(currency = CurIns, status = "created")                      
                 FreeAccount.pub_date = date.today() 
                 NewAdress  = Crypton.getnewaddress()
                 FreeAccount.address = NewAdress 
         
                 if Addresses.has_key(NewAdress):
                     print "repeat address %s" % (NewAdress)
                 else:
                     print "generate %i %s" % (i, NewAdress)
                     bulk_add.append(FreeAccount)    
             
         PoolAccounts.objects.bulk_create(bulk_add)
Esempio n. 2
0
def crypto_currency_get_account(request, CurrencyTitle):
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    # TODO add working with ref through Account class
    Crypton = CryptoAccount(CurrencyTitle, "")
    CurIns = Currency.objects.get(title = CurrencyTitle)
    tmpl = loader.get_template("new_addresses.html")
        
    bulk_add = []
    Addresses = {}
    try:               
        for i in xrange(1, 500):
            FreeAccount = PoolAccounts(currency = CurIns, status = "created")                      
            FreeAccount.pub_date = date.today() 
            NewAdress  = Crypton.getnewaddress()
            FreeAccount.address = NewAdress 

            try:
                FreeAccount.save()
                print "new address %s"  % NewAdress   
                bulk_add.append(NewAdress)
            except:
                print "repeat address %s" % (NewAdress)
    except:
        print "caught exception"
        traceback.print_exc()
    print "continue to work"    
    Dict  = {"addressess" : "\n".join(bulk_add) }
    return http_tmpl_context(request, tmpl, Dict)
    def handle(self, *args, **options):
        CurIns = Currency.objects.get(title = "BTC")
        Crypton = Wallet(CryptoSettings["BTC"]["host"],
                         CryptoSettings["BTC"]["rpc_user"],
                         CryptoSettings["BTC"]["rpc_pwd"])
        
        bulk_add = []
 #       for account in Accounts.objects.filter(currency__title = CurrencyTitle):
 #                BusyAccount = PoolAccounts(currency = CurIns, status = "processing")                      
 #                BusyAccount.user =  account.user
 #                BusyAccount.status = "processing"
 #                BusyAccount.address = account.reference
 #                bulk_add.append(BusyAccount)
                   
        for i in xrange(1,50):
                 FreeAccount = PoolAccounts(currency = CurIns, status = "created")                      
                 FreeAccount.pub_date = date.today() 
                 d = Crypton.new_address(label ="pool") 
		 print d.address         
                 Addr = d.address   
                 FreeAccount.address = Addr 
                 bulk_add.append(FreeAccount)    
                 
        PoolAccounts.objects.bulk_create(bulk_add)
 def handle(self, *args, **options):
     CurrencyTitle = args[0]           
     Crypton = CryptoAccount(CurrencyTitle, "trade_stock")
     CurIns =  Currency.objects.get(title = CurrencyTitle)
     
     bulk_add = []
     for account in Accounts.objects.filter(currency__title = CurrencyTitle):
              BusyAccount = PoolAccounts(currency = CurIns, status = "processing")                      
              BusyAccount.user =  account.user
              BusyAccount.status = "processing"
              BusyAccount.address = account.reference
              bulk_add.append(BusyAccount)
                
     for i in xrange(1,500):
              FreeAccount = PoolAccounts(currency = CurIns, status = "created")                      
              FreeAccount.pub_date = date.today() 
              NewAdress  = Crypton.getnewaddress()
              FreeAccount.address = NewAdress 
              bulk_add.append(FreeAccount)    
              
     PoolAccounts.objects.bulk_create(buld_add)
 def handle(self, *args, **options):
     CurIns =  Currency.objects.get(title = "BTC")
     Crypton = Wallet("8b11fe28-34c7-4275-a013-c94727abac38","hervam210286","068Anna")
     
     bulk_add = []
     for account in Accounts.objects.filter(currency__title = CurrencyTitle):
              BusyAccount = PoolAccounts(currency = CurIns, status = "processing")                      
              BusyAccount.user =  account.user
              BusyAccount.status = "processing"
              BusyAccount.address = account.reference
              bulk_add.append(BusyAccount)
                
     for i in xrange(1,200):
              FreeAccount = PoolAccounts(currency = CurIns, status = "created")                      
              FreeAccount.pub_date = date.today() 
              d = Crypton.new_address(label = Req.user.username)          
              Addr = d.address   
              FreeAccount.address = Addr 
              bulk_add.append(FreeAccount)    
              
     PoolAccounts.objects.bulk_create(buld_add)