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

Update igmarkets.go #3

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

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

@@ -537,7 +537,7 @@ func (ig *IGMarkets) GetPriceHistory(epic, resolution string, max int, from, to
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.

None yet

2 participants