mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 10:15:20 +00:00
exchange rate discovery object.
This commit is contained in:
parent
b21d08c0af
commit
02d8d297dc
2 changed files with 17 additions and 1 deletions
14
lib/exchange_rate.py
Normal file
14
lib/exchange_rate.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
class Exchanger:
|
||||||
|
|
||||||
|
def __init__(self, quote_currencies):
|
||||||
|
self.quote_currencies = quote_currencies
|
||||||
|
|
||||||
|
def exchange(self, btc_amount, quote_currency):
|
||||||
|
assert quote_currency in self.quote_currencies
|
||||||
|
|
||||||
|
return btc_amount * 6
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
exch = Exchanger(("EUR", "USD", "GBP"))
|
||||||
|
print exch.exchange(1, "EUR")
|
||||||
|
|
|
@ -2,6 +2,7 @@ from PyQt4.QtCore import *
|
||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
from decimal import Decimal as D
|
from decimal import Decimal as D
|
||||||
from i18n import _
|
from i18n import _
|
||||||
|
import exchange_rate
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
@ -85,6 +86,8 @@ class MiniWindow(QDialog):
|
||||||
|
|
||||||
self.btc_balance = 0
|
self.btc_balance = 0
|
||||||
self.quote_currencies = ("EUR", "USD", "GBP")
|
self.quote_currencies = ("EUR", "USD", "GBP")
|
||||||
|
self.exchanger = exchange_rate.Exchanger(self.quote_currencies)
|
||||||
|
|
||||||
self.balance_label = BalanceLabel(self.change_quote_currency)
|
self.balance_label = BalanceLabel(self.change_quote_currency)
|
||||||
self.balance_label.setObjectName("balance_label")
|
self.balance_label.setObjectName("balance_label")
|
||||||
|
|
||||||
|
@ -429,7 +432,6 @@ class MiniDriver(QObject):
|
||||||
def update_balance(self):
|
def update_balance(self):
|
||||||
conf_balance, unconf_balance = self.wallet.get_balance()
|
conf_balance, unconf_balance = self.wallet.get_balance()
|
||||||
balance = D(conf_balance + unconf_balance)
|
balance = D(conf_balance + unconf_balance)
|
||||||
balance = D("9879457356")
|
|
||||||
self.window.set_balances(balance)
|
self.window.set_balances(balance)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Reference in a new issue