def depmotion(request, CurrencyTitle): CurrencyList = Currency.objects.all() cur = Currency.objects.get(title=CurrencyTitle) (TransList, TransTitle) = (None, None) user_id = request.user.id if SDKCryptoCurrency.has_key(CurrencyTitle): ##TODO avoid this TransList = list(crypton_currency_list(user_id, CurrencyTitle)) TransTitle = ( {"value": _(u"Дебит/Кредит")}, {"value": _(u"Адрес")}, {"value": _(u"Сумма")}, {"value": _(u"Дата")}, {"value": _(u"Статус")}, {"value": _(u"Подтверждения")}, {"value": _(u"Txid")}, ) elif CurrencyTitle == "UAH": TransList = list(crypton_uah_list(user_id)) TransTitle = ( {"value": _(u"Дебит/Кредит")}, {"value": _(u"Счет")}, {"value": _(u"Сумма")}, {"value": _(u"Дата")}, {"value": _(u"Статус")}, ) else: TransList = list(crypton_emoney_list(user_id, cur)) TransTitle = ( {"value": _(u"Дебит/Кредит")}, {"value": _(u"Сумма")}, {"value": _(u"Дата")}, {"value": _(u"Статус")}, ) TransListPage = None paginator = Paginator(TransList, 200) # Show 25 contacts per page page = request.GET.get("page", 1) try: TransListPage = paginator.page(page) except PageNotAnInteger: # If page is not an integer, deliver first page. TransListPage = paginator.page(1) except EmptyPage: # If page is out of range (e.g. 9999), deliver last page of results. TransListPage = paginator.page(paginator.num_pages) # balance = Balances.objects.get(account = "whole", currency = CurrencyInstance) Dict = { "paging": True, "current_trade": CurrencyTitle, "Trans": TransListPage, "TransList": TransListPage.object_list, "TransTitle": TransTitle, "CurrencyList": CurrencyList, } tmpl = loader.get_template("finance_depmotion_home.html") return http_tmpl_context(request, tmpl, Dict)
def handle(self, *args, **options): LOCK = "out_crypto" lock = None try: lock = my_lock(LOCK) for CurrencyTitle in CryptoSettings.keys(): if CurrencyTitle != "BTC": process_out(CurrencyTitle) my_release(lock) except LockBusyException as e: print "operation is locked", e.value sys.exit(0) except: print "Unexpected error:", str(sys.exc_info())
def depmotion(request, CurrencyTitle): CurrencyList = Currency.objects.all() cur = Currency.objects.get(title=CurrencyTitle) (TransList, TransTitle) = (None, None) user_id = request.user.id if SDKCryptoCurrency.has_key(CurrencyTitle): ##TODO avoid this TransList = list(crypton_currency_list(user_id, CurrencyTitle)) TransTitle = ( {"value": _(u"Дебит/Кредит")}, {"value": _(u"Адрес")}, {"value": _(u"Сумма")}, {"value": _(u"Дата")}, {"value": _(u"Статус")}, {"value": _(u"Подтверждения")}, {"value": _(u"Txid")} ) elif CurrencyTitle == "UAH": TransList = list(crypton_uah_list(user_id)) TransTitle = ({"value": _(u"Дебит/Кредит")}, {"value": _(u"Счет")}, {"value": _(u"Сумма")}, {"value": _(u"Дата")}, {"value": _(u"Статус")} ) else: TransList = list(crypton_emoney_list(user_id, cur)) TransTitle = ({"value": _(u"Дебит/Кредит")}, {"value": _(u"Сумма")}, {"value": _(u"Дата")}, {"value": _(u"Статус")} ) TransListPage = None paginator = Paginator(TransList, 200) # Show 25 contacts per page page = request.GET.get('page', 1) try: TransListPage = paginator.page(page) except PageNotAnInteger: # If page is not an integer, deliver first page. TransListPage = paginator.page(1) except EmptyPage: # If page is out of range (e.g. 9999), deliver last page of results. TransListPage = paginator.page(paginator.num_pages) # balance = Balances.objects.get(account = "whole", currency = CurrencyInstance) Dict = { "paging": True, "current_trade": CurrencyTitle, "Trans": TransListPage, "TransList": TransListPage.object_list, "TransTitle": TransTitle, "CurrencyList": CurrencyList } tmpl = loader.get_template("finance_depmotion_home.html") return http_tmpl_context(request, tmpl, Dict)
def handle(self, *args, **options): try : Time = args[0] Time = int(Time) except : Time = 0 print "process time %i" % ( Time) LOCK = "in_cryptoblck_info" LOCK = LOCK lock = None try: lock = my_lock(LOCK) for CurrencyTitle in CryptoSettings.keys(): print "start proces %s" % CurrencyTitle if CurrencyTitle !="BTC": process_in_crypto(Time, CurrencyTitle) except : print "Unexpected error:", sys.exc_info()[0] finally: my_release(lock)
#*/5 * * * * cd crypton; python ./manage_lock.py incoming_crypto_merger 1489820322 1>> incoming_crypto_merger.log 2>>incoming_crypto_merger.log #*/10 * * * * cd crypton; python ./manage_lock.py check_out_tx 1>> check_out_tx.log 2>> check_out_tx.log #*/4 * * * * cd crypton;python ./manage_lock.py global_crypto_check 1>> global_check.log 2>>global_check.log #* * * * * cd crypton;python ./manage_lock.py encrypt_pin 1>> pin_encrypting.log 2>>pin_encrypting.log #10 2 * * * cd crypton;python ./manage_lock.py backup_wallets 2>>result_back.log 2>>result_back.log commands = { #"100":("process_complexity_trans",), #"101":("incomin_btc_blockchaint_tx",), #"102":("process_monero",), #"104":("thread_etc",), #"105":("thread_eth",), #"106":("thread_blockchain",), } index = 107 for Name in CryptoSettings.keys(): print "add default %s" % Name commands[str(index)] = ("incoming_crypto", Name) index += 1 #commands[str(index)] = ("check_wallet", Name) #index +=1 api_commands = (("front_html", ), ("front_html1", ), ("front_html2", ), ("front_balance", ), ("front_deals", ), ("front_myorders", ), ("front_payapi", ), ("front_publicapi", )) """ for apicmd in api_commands: commands[str(index)] = apicmd index+=1 """