forex-python icon indicating copy to clipboard operation
forex-python copied to clipboard

get_rate doesnt return correct rates

Open erkan612 opened this issue 3 years ago • 0 comments

I'm trying to get rates of a day, I need to storage them in a list by 5min perioid but the problem is, even tho it takes hour-minute-second arguments, it doesnt give me the rate from the exact hour-minute-second that i want. Here's my example code:

from datetime import datetime
from forex_python.converter import CurrencyRates
c = CurrencyRates()
rates = []
for val in range(1):
    dt = datetime.strptime("2022-11-30 23:59:59", '%Y-%m-%d %H:%M:%S')
    rate = c.get_rate('USD', 'TRY', dt)
    rates.append(rate)


dt = datetime.strptime("2022-11-30 21:59:59", '%Y-%m-%d %H:%M:%S')
rate = c.get_rate('USD', 'TRY', dt)
rates.append(rate)
print(rates[1], "\n")
print(rates[0], "\n")

Doesn't matter which time i change, it always returns same value, which is 18.632710100231304

erkan612 avatar Dec 01 '22 09:12 erkan612