initial checkin
This commit is contained in:
64
polygon-public-rest-api/pom.xml
Normal file
64
polygon-public-rest-api/pom.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.inteligr8.polygon</groupId>
|
||||
<artifactId>polygon-public-rest-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Polygon.IO ReST API for Java</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>jakarta.ws.rs</groupId>
|
||||
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||
<version>2.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-jaxb-annotations</artifactId>
|
||||
<version>2.12.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>javadoc</id>
|
||||
<phase>package</phase>
|
||||
<goals><goal>jar</goal></goals>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>inteligr8-public</id>
|
||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>inteligr8-releases</id>
|
||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>inteligr8-snapshots</id>
|
||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
@@ -0,0 +1,15 @@
|
||||
package com.inteligr8.polygon;
|
||||
|
||||
import com.inteligr8.polygon.api.StocksApiV1;
|
||||
|
||||
/**
|
||||
* This interface consolidates the JAX-RS APIs available in the Polygon.IO
|
||||
* Public ReST API.
|
||||
*
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
public interface PolygonPublicRestApi {
|
||||
|
||||
StocksApiV1 getStocksApi();
|
||||
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package com.inteligr8.polygon.api;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.inteligr8.polygon.model.StockDateSummary;
|
||||
|
||||
@Path("/v1")
|
||||
public interface StocksApiV1 {
|
||||
|
||||
@GET
|
||||
@Path("/open-close/{stocksTicker}/{date}")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public StockDateSummary getStockSummaryOnDate(
|
||||
@PathParam("stocksTicker") String stockTicker,
|
||||
@PathParam("date") @JsonFormat(pattern = "yyyy-MM-dd") LocalDate date);
|
||||
|
||||
@GET
|
||||
@Path("/open-close/{stocksTicker}/{date}")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public StockDateSummary getStockSummaryOnDate(
|
||||
@PathParam("stocksTicker") String stockTicker,
|
||||
@PathParam("date") @JsonFormat(pattern = "yyyy-MM-dd") LocalDate date,
|
||||
@QueryParam("adjusted") boolean adjusted);
|
||||
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.inteligr8.polygon.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class BaseResponse {
|
||||
|
||||
public enum Status {
|
||||
@JsonProperty("OK")
|
||||
Ok
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
private Status status;
|
||||
|
||||
|
||||
|
||||
public Status getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,117 @@
|
||||
package com.inteligr8.polygon.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StockDateSummary extends BaseResponse {
|
||||
|
||||
@JsonProperty
|
||||
private String symbol;
|
||||
|
||||
@JsonProperty
|
||||
private Double preMarket;
|
||||
|
||||
@JsonProperty
|
||||
private Double open;
|
||||
|
||||
@JsonProperty
|
||||
private Double high;
|
||||
|
||||
@JsonProperty
|
||||
private Double low;
|
||||
|
||||
@JsonProperty
|
||||
private Double close;
|
||||
|
||||
@JsonProperty
|
||||
private Long volume;
|
||||
|
||||
@JsonProperty
|
||||
private Double afterHours;
|
||||
|
||||
@JsonProperty
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate from;
|
||||
|
||||
|
||||
|
||||
public String getSymbol() {
|
||||
return this.symbol;
|
||||
}
|
||||
|
||||
public void setSymbol(String symbol) {
|
||||
this.symbol = symbol;
|
||||
}
|
||||
|
||||
public Double getPreMarket() {
|
||||
return this.preMarket;
|
||||
}
|
||||
|
||||
public void setPreMarket(Double preMarket) {
|
||||
this.preMarket = preMarket;
|
||||
}
|
||||
|
||||
public Double getOpen() {
|
||||
return this.open;
|
||||
}
|
||||
|
||||
public void setOpen(Double open) {
|
||||
this.open = open;
|
||||
}
|
||||
|
||||
public Double getHigh() {
|
||||
return this.high;
|
||||
}
|
||||
|
||||
public void setHigh(Double high) {
|
||||
this.high = high;
|
||||
}
|
||||
|
||||
public Double getLow() {
|
||||
return this.low;
|
||||
}
|
||||
|
||||
public void setLow(Double low) {
|
||||
this.low = low;
|
||||
}
|
||||
|
||||
public Double getClose() {
|
||||
return this.close;
|
||||
}
|
||||
|
||||
public void setClose(Double close) {
|
||||
this.close = close;
|
||||
}
|
||||
|
||||
public Long getVolume() {
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
public void setVolume(Long volume) {
|
||||
this.volume = volume;
|
||||
}
|
||||
|
||||
public Double getAfterHours() {
|
||||
return this.afterHours;
|
||||
}
|
||||
|
||||
public void setAfterHours(Double afterHours) {
|
||||
this.afterHours = afterHours;
|
||||
}
|
||||
|
||||
public LocalDate getFrom() {
|
||||
return this.from;
|
||||
}
|
||||
|
||||
public void setFrom(LocalDate from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user