forked from Petersoj/alpaca-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClockEndpoint.java
More file actions
39 lines (35 loc) · 1.26 KB
/
ClockEndpoint.java
File metadata and controls
39 lines (35 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package net.jacobpeterson.alpaca.rest.endpoint.clock;
import net.jacobpeterson.alpaca.model.endpoint.clock.Clock;
import net.jacobpeterson.alpaca.rest.AlpacaClient;
import net.jacobpeterson.alpaca.rest.AlpacaClientException;
import net.jacobpeterson.alpaca.rest.endpoint.AlpacaEndpoint;
import okhttp3.HttpUrl;
import okhttp3.Request;
/**
* {@link AlpacaEndpoint} for <a href="https://docs.alpaca.markets/api-documentation/api-v2/clock/">Clock</a>.
*/
public class ClockEndpoint extends AlpacaEndpoint {
/**
* Instantiates a new {@link ClockEndpoint}.
*
* @param alpacaClient the {@link AlpacaClient}
*/
public ClockEndpoint(AlpacaClient alpacaClient) {
super(alpacaClient, "clock");
}
/**
* Returns the market {@link Clock}.
*
* @return the market {@link Clock}
*
* @throws AlpacaClientException thrown for {@link AlpacaClientException}s
*/
public Clock get() throws AlpacaClientException {
HttpUrl.Builder urlBuilder = alpacaClient.urlBuilder()
.addPathSegment(endpointPathSegment);
Request request = alpacaClient.requestBuilder(urlBuilder.build())
.get()
.build();
return alpacaClient.requestObject(request, Clock.class);
}
}