Skip to content

Conversation

@markusvanlaak
Copy link
Contributor

removed max=100 as it overwrites the max value when calling GetPriceHistory

markusvanlaak and others added 3 commits April 12, 2020 09:25
removed max=100 as it overwrites the max value when calling GetPriceHistory
@sklinkert
Copy link
Owner

Thanks for looking into that! I guess we can remove the max=1 completely because it'd override the max setting here https://github.com/sklinkert/igmarkets/pull/3/files#diff-8e05d2c8a06fada86cee4628e78ce189R537 wdyt?

Copy link
Contributor Author

@markusvanlaak markusvanlaak left a comment

Choose a reason for hiding this comment

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

Added some comments. Regards

toStr := to.Format("2006-01-02T15:04:05")
limitStr = fmt.Sprintf("&from=%s&to=%s", fromStr, toStr)
} else if max > 0 {
limitStr = fmt.Sprintf("&max=%d", max)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

max is set only when "to" or "from" has no time.Time value.

GetPriceHistory requires time.Time so it will never set "max" in the "else if" to 1.
Setting max is required to not get the default of i think 10.

Copy link
Owner

Choose a reason for hiding this comment

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

What I mean is: If max > 0, we set max twice. In page and in limitStr. This is wrong IMO because both are used to assemble the URL. I think we need to removed it from page and leave limitStr empty if max is zero.

Copy link
Owner

@sklinkert sklinkert left a comment

Choose a reason for hiding this comment

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

Looks better :-) Can we please remove fmt.Println() as it was used for debugging (I guess)?

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.

2 participants