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

Docs don't show how to use the forex.Quote #5

Open
jrmiller82 opened this issue Jul 8, 2018 · 2 comments
Open

Docs don't show how to use the forex.Quote #5

jrmiller82 opened this issue Jul 8, 2018 · 2 comments

Comments

@jrmiller82
Copy link

I can't get the forex.Quote("EURUSD") function to work. Am I not specifying the symbol correctly?

@jrmiller82
Copy link
Author

Maybe some lines in the documentation that the symbols are like EURUSD=X.

@ackleymi
Copy link
Contributor

Hey @jrmiller82, check out https://godoc.org/github.com/piquette/finance-go/forex for the exposed functions in the forex package. They are:

  • forex.Get(SYMBOL) for single forex quotes
  • forex.List(SYMBOLS) for multiple forex quotes
  • forex.ListP(PARAMS) to inject a cancellable context in the request

List returns a forex.Iter struct that can be used like-

symbols := []string{"GBPUSD=X", "AUDUSD=X"}
iter := forex.List(symbols)
for iter.Next() {
        pairQuote := iter.ForexPair()
	fmt.Println(pairQuote)
}
if iter.Err() != nil {
	fmt.Println(iter.Err())
}

The forex symbols can be found at https://finance.yahoo.com/currencies. But you're right, I need to include some more information.

Make sure you're using the tip of master, it is stable. Use go get -v -u github.com/piquette/finance-go to update or dep ensure -update if you're using dep.

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

No branches or pull requests

2 participants