Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting rate for the last working day #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

matma
Copy link

@matma matma commented Feb 25, 2012

Hello,
When You have a document where a date isn't working date, You should still be able to get avg. rate for it. So I changed the code to do this.

It's an option:
NbpExchange::Config::get_rate_from_last_working_date = true

The next step is to calculate holidays (using https://github.com/alexdunae/holidays gem)

Pozdrowienia :)

@sparrovv
Copy link
Owner

I was thinking on doing this, but for my needs the previous version was enough, but I'm happy, that someone is using it:)

Basically I like this pull request, but I would encourage you to change some method naming, like:

get_rate_from_last_working_date -> rade_from_last_working_date
is_valid_date? -> valid_date? (question mark = is, at least for me)

It's more ruby style:)

cn = CurrencyNodes.new(date)
raw_rate = cn.find(symbol)
Rate.parse(self, date, raw_rate)
end

def get_valid_date(date)
while is_valid_date?( date ) == false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about changing this line to:

while not valid_date?(date)
or
while !valid_date(date)
?

@matma
Copy link
Author

matma commented Feb 26, 2012

Ok, I will change this - I'm still learning Ruby. My main language is C# so please be tolerant ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants