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

ctx.pricing.candles returning illegal character error #12

Open
yohanesyuen opened this issue Jun 18, 2018 · 0 comments
Open

ctx.pricing.candles returning illegal character error #12

yohanesyuen opened this issue Jun 18, 2018 · 0 comments

Comments

@yohanesyuen
Copy link

I was trying to testout PricingContext.candles, however, I noticed that it did not include the account id in the url. Require assistance.

Below is my stack trace.

	at com.oanda.v20.Context.execute(Context.java:198)
	at com.oanda.v20.pricing.PricingContext.candles(PricingContext.java:229)
	at com.oanda.v20.pricing.PricingContext.candles(PricingContext.java:206)
	at Summary.main(Summary.java:29)
Caused by: java.net.URISyntaxException: Illegal character in path at index 45: https://api-fxpractice.oanda.com/v3/accounts/{accountID}/instruments/EUR_USD/candles
	at java.net.URI$Parser.fail(URI.java:2848)
	at java.net.URI$Parser.checkChars(URI.java:3021)
	at java.net.URI$Parser.parseHierarchical(URI.java:3105)
	at java.net.URI$Parser.parse(URI.java:3053)
	at java.net.URI.<init>(URI.java:588)
	at org.apache.http.client.utils.URIBuilder.<init>(URIBuilder.java:80)
	at com.oanda.v20.Context.execute(Context.java:196)
	... 3 more

Code attached below also.

import com.oanda.v20.Context;
import com.oanda.v20.ContextBuilder;
import com.oanda.v20.account.AccountID;
import com.oanda.v20.account.AccountSummary;
import com.oanda.v20.pricing.PricingCandlesResponse;
import com.oanda.v20.primitives.AcceptDatetimeFormat;
import com.oanda.v20.primitives.InstrumentName;

public class Summary {

	@SuppressWarnings("deprecation")
	public static void main(String[] args) {
		final String uri = Config.getBaseUri();
		final String Token = Config.getToken();
		ContextBuilder ctxBuilder = new ContextBuilder(uri);
		ctxBuilder.setToken(Token);
		ctxBuilder.setApplication("");
		Context ctx = ctxBuilder.build();
		AccountID accID = new AccountID(Config.getAccountNumber());

		try {
			PricingCandlesResponse candles= ctx.pricing.candles(new InstrumentName("EUR_USD"));
			System.out.println(candles);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
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

1 participant