Пример #1
0
def currencySearch(search):
    dollerTuple = twder.now_all()[search]
    #reply = '{}\n{}即期賣出價:{}'.format(dollerTuple[0],search,dollerTuple[4])
    reply = '{}\n{}\n現金買入價:{}\n現金賣出價:{}\n即期買入價:{}\n即期賣出價:{}'.format(
        dollerTuple[0], search, dollerTuple[1], dollerTuple[2], dollerTuple[3],
        dollerTuple[4])
    return reply
Пример #2
0
def get_currency_list():
    currency_list = twder.now_all()
    currency_list = list(currency_list.values())
    currencies = []
    for i in range(len(currency_list)):
        currencies.append(currency_list[i][4])
    return currencies
Пример #3
0
 def test_now_all(self):
     for k, v in twder.now_all().items():
         self.assertIsInstance(k, str)
         self.assertIsInstance(v, tuple)
         self._check_rate_value(v[1])
         self._check_rate_value(v[2])
         self._check_rate_value(v[3])
         self._check_rate_value(v[4])
def cache_now_all():
    twder_now_all_key = 'twder.now_all'
    now_all_str = redis_cache.get_val(twder_now_all_key)
    if now_all_str is None:
        now_all = twder.now_all()
        now_all_str = json.dumps(now_all)
        # 10 minutes
        redis_cache.set_val(twder_now_all_key, 60 * 10, now_all_str)

    return json.loads(now_all_str)
Пример #5
0
def currencySearch(search):
    # result = twder.now(userInput)
    # text = ''
    # # text += '時間:{}\n現金買入:{}\n現金賣出:{}\n即期買入:{}\n即期賣出:{}\n'.format(result[0], result[1], result[2], result[3],result[4])
    # text += '時間:{}\n即期買入:{}\n即期賣出:{}\n'.format(result[0], result[3], result[4])
    # return text

    dollorTuple = twder.now_all()[search]
    reply = '日期:{}\n即期賣出:{}\n即期買入:{}'.format(dollorTuple[0], dollorTuple[4],
                                             dollorTuple[3])
    return reply
Пример #6
0
 def test_now_all(self):
     twder.now_all()
Пример #7
0
def currencySearch(search):
    dollarTuple = twder.now_all()[search]
    reply = '{}\n{} 的即期賣出價: {}'.format(dollarTuple[0], search, dollarTuple[4])
    return reply
Пример #8
0
def currencySearch(search):
    DollarList = twder.now_all()[search]
    reply = '{}\n{}的極其賣出價:{}'.format(DollarList[0], search, DollarList[4])
    return reply
Пример #9
0
def currencysearch(search):
	dollarTuple = twder.now_all()[search]