Skip to content

Commit cf3e0b0

Browse files
author
方佳
committed
Merge branch 'main_260117_merge' into 'main'
feat: Add footprint interface See merge request webull/webull-openapi-java-sdk!10
2 parents e650042 + 86d8870 commit cf3e0b0

10 files changed

Lines changed: 186 additions & 4 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<groupId>com.webull.openapi</groupId>
2222
<artifactId>webull-openapi-java-sdk-parent</artifactId>
2323
<packaging>pom</packaging>
24-
<version>1.0.7</version>
24+
<version>1.0.8</version>
2525

2626
<name>webull-openapi-java-sdk-parent</name>
2727
<url>https://github.com/webull-inc/webull-openapi-java-sdk/</url>

webull-openapi-java-sdk-samples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<parent>
2020
<groupId>com.webull.openapi</groupId>
2121
<artifactId>webull-openapi-java-sdk-parent</artifactId>
22-
<version>1.0.7</version>
22+
<version>1.0.8</version>
2323
</parent>
2424
<modelVersion>4.0.0</modelVersion>
2525

webull-openapi-java-sdk-samples/src/main/java/com/webull/openapi/samples/data/DataClient.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ public static void main(String[] args) {
8585
Tick tick = dataClient.getTicks("AAPL", Category.US_STOCK.name(), 100, tradingSessions);
8686
logger.info("Tick: {}", tick);
8787

88+
List<FootprintResponse> footprint = dataClient.getFootprint(symbols, Category.US_STOCK.name(), Timespan.S5.name(), 200, null, null);
89+
logger.info("Footprint: {}", footprint);
90+
8891
DepthOfBook futureDepth = dataClient.getFuturesDepth("SILZ5", Category.US_FUTURES.name(), "1");
8992
logger.info("Futures depth: {}", futureDepth);
9093

@@ -109,6 +112,9 @@ public static void main(String[] args) {
109112
List<FuturesInstrument> futuresInstrumentsByCode = dataClient.getFuturesInstrumentsByCode("ES", Category.US_FUTURES.name(), ContractType.MONTHLY.name());
110113
logger.info("Futures Instruments By Code: {}", futuresInstrumentsByCode);
111114

115+
List<FootprintResponse> futuresFootprint = dataClient.getFuturesFootprint(futuresSymbols, Category.US_FUTURES.name(), Timespan.S5.name(), 200, null, null);
116+
logger.info("FuturesFootprint: {}", futuresFootprint);
117+
112118
// // get end of day market
113119
// List<EodBars> eodBars = IDataClient.getEodBars(instrumentIds, "2023-01-01", 10);
114120
// logger.info("Eod bars: {}", eodBars);

webull-openapi-java-sdk/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.webull.openapi</groupId>
99
<artifactId>webull-openapi-java-sdk-parent</artifactId>
10-
<version>1.0.7</version>
10+
<version>1.0.8</version>
1111
</parent>
1212

1313
<artifactId>webull-openapi-java-sdk</artifactId>

webull-openapi-java-sdk/src/main/java/com/webull/openapi/core/common/dict/Timespan.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
public enum Timespan {
1919

20+
S5,
21+
22+
S15,
23+
2024
/** 1 minute k */
2125
M1,
2226

webull-openapi-java-sdk/src/main/java/com/webull/openapi/core/config/ProjectReaderHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private ProjectReaderHelper() {
2424

2525
private static final String APPLICATION_VERSION = "application.version";
2626

27-
private static final String DEFAULT_APPLICATION_VERSION = "1.0.7";
27+
private static final String DEFAULT_APPLICATION_VERSION = "1.0.8";
2828

2929
private static final String APPLICATION_NAME = "application.name";
3030

webull-openapi-java-sdk/src/main/java/com/webull/openapi/data/DataClient.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,27 @@ public Tick getTicks(String symbol, String category, int count, List<String> tra
218218
return apiClient.request(request).responseType(new TypeToken<Tick>() {}.getType()).doAction();
219219
}
220220

221+
@Override
222+
public List<FootprintResponse> getFootprint(Set<String> symbols, String category, String timespan, int count, Boolean realTimeRequired, String tradingSessions) {
223+
Assert.notEmpty(ArgNames.SYMBOLS, symbols);
224+
Assert.notBlank(ArgNames.CATEGORY, category);
225+
Assert.notBlank(ArgNames.TIMESPAN, timespan);
226+
HttpRequest request = new HttpRequest("/openapi/market-data/stock/footprint", Versions.V2, HttpMethod.GET);
227+
Map<String, Object> params = new HashMap<>();
228+
params.put(ArgNames.SYMBOLS, String.join(",", symbols));
229+
params.put(ArgNames.CATEGORY, category);
230+
params.put(ArgNames.TIMESPAN, timespan);
231+
params.put(ArgNames.COUNT, count);
232+
if(Objects.nonNull(realTimeRequired)){
233+
params.put(ArgNames.REAL_TIME_REQUIRED, realTimeRequired);
234+
}
235+
if(StringUtils.isNotEmpty(tradingSessions)){
236+
params.put(ArgNames.TRADING_SESSIONS, tradingSessions);
237+
}
238+
request.setQuery(params);
239+
return apiClient.request(request).responseType(new TypeToken<List<FootprintResponse>>() {}.getType()).doAction();
240+
}
241+
221242
@Override
222243
public List<NBar> getFuturesBars(List<String> symbols, String category, String timespan, int count, Boolean realTimeRequired) {
223244
Assert.notEmpty(ArgNames.SYMBOLS, symbols);
@@ -319,6 +340,27 @@ public List<FuturesInstrument> getFuturesInstrumentsByCode(String code, String c
319340
return apiClient.request(request).responseType(new TypeToken<List<FuturesInstrument>>() {}.getType()).doAction();
320341
}
321342

343+
@Override
344+
public List<FootprintResponse> getFuturesFootprint(Set<String> symbols, String category, String timespan, int count, Boolean realTimeRequired, String tradingSessions) {
345+
Assert.notEmpty(ArgNames.SYMBOLS, symbols);
346+
Assert.notBlank(ArgNames.CATEGORY, category);
347+
Assert.notBlank(ArgNames.TIMESPAN, timespan);
348+
HttpRequest request = new HttpRequest("/openapi/market-data/futures/footprint", Versions.V2, HttpMethod.GET);
349+
Map<String, Object> params = new HashMap<>();
350+
params.put(ArgNames.SYMBOLS, String.join(",", symbols));
351+
params.put(ArgNames.CATEGORY, category);
352+
params.put(ArgNames.TIMESPAN, timespan);
353+
params.put(ArgNames.COUNT, count);
354+
if(Objects.nonNull(realTimeRequired)){
355+
params.put(ArgNames.REAL_TIME_REQUIRED, realTimeRequired);
356+
}
357+
if(StringUtils.isNotEmpty(tradingSessions)){
358+
params.put(ArgNames.TRADING_SESSIONS, tradingSessions);
359+
}
360+
request.setQuery(params);
361+
return apiClient.request(request).responseType(new TypeToken<List<FootprintResponse>>() {}.getType()).doAction();
362+
}
363+
322364
@Override
323365
public List<Snapshot> getCryptoSnapshots(Set<String> symbols, String category) {
324366
Assert.notEmpty(ArgNames.SYMBOLS, symbols);

webull-openapi-java-sdk/src/main/java/com/webull/openapi/data/quotes/api/IDataClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ default Tick getTicks(String symbol, String category) {
6363

6464
Tick getTicks(String symbol, String category, int count, List<String> tradingSessions);
6565

66+
List<FootprintResponse> getFootprint(Set<String> symbols, String category, String timespan, int count, Boolean realTimeRequired, String tradingSessions);
67+
6668
List<NBar> getFuturesBars(List<String> symbols, String category, String timespan, int count, Boolean realTimeRequired);
6769

6870
DepthOfBook getFuturesDepth(String symbol, String category, String depth);
@@ -77,6 +79,8 @@ default Tick getTicks(String symbol, String category) {
7779

7880
List<FuturesInstrument> getFuturesInstrumentsByCode(String code, String category, String contractType);
7981

82+
List<FootprintResponse> getFuturesFootprint(Set<String> symbols, String category, String timespan, int count, Boolean realTimeRequired, String tradingSessions);
83+
8084
List<Snapshot> getCryptoSnapshots(Set<String> symbols, String category);
8185

8286
List<NBar> getCryptoBars(Set<String> symbols, String category, String timespan, int count, Boolean realTimeRequired);
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package com.webull.openapi.data.quotes.domain;
2+
3+
import java.util.Map;
4+
5+
public class Footprint {
6+
7+
private String time;
8+
9+
private String tradingSession;
10+
11+
private String total;
12+
13+
private String delta;
14+
15+
private String buyTotal;
16+
17+
private String sellTotal;
18+
19+
private Map<String, String> buyDetail;
20+
21+
private Map<String, String> sellDetail;
22+
23+
public String getTime() {
24+
return time;
25+
}
26+
27+
public void setTime(String time) {
28+
this.time = time;
29+
}
30+
31+
public String getTradingSession() {
32+
return tradingSession;
33+
}
34+
35+
public void setTradingSession(String tradingSession) {
36+
this.tradingSession = tradingSession;
37+
}
38+
39+
public String getTotal() {
40+
return total;
41+
}
42+
43+
public void setTotal(String total) {
44+
this.total = total;
45+
}
46+
47+
public String getDelta() {
48+
return delta;
49+
}
50+
51+
public void setDelta(String delta) {
52+
this.delta = delta;
53+
}
54+
55+
public String getBuyTotal() {
56+
return buyTotal;
57+
}
58+
59+
public void setBuyTotal(String buyTotal) {
60+
this.buyTotal = buyTotal;
61+
}
62+
63+
public String getSellTotal() {
64+
return sellTotal;
65+
}
66+
67+
public void setSellTotal(String sellTotal) {
68+
this.sellTotal = sellTotal;
69+
}
70+
71+
public Map<String, String> getBuyDetail() {
72+
return buyDetail;
73+
}
74+
75+
public void setBuyDetail(Map<String, String> buyDetail) {
76+
this.buyDetail = buyDetail;
77+
}
78+
79+
public Map<String, String> getSellDetail() {
80+
return sellDetail;
81+
}
82+
83+
public void setSellDetail(Map<String, String> sellDetail) {
84+
this.sellDetail = sellDetail;
85+
}
86+
87+
@Override
88+
public String toString() {
89+
return "Footprint{" +
90+
"time='" + time + '\'' +
91+
", tradingSession='" + tradingSession + '\'' +
92+
", total='" + total + '\'' +
93+
", delta='" + delta + '\'' +
94+
", buyTotal='" + buyTotal + '\'' +
95+
", sellTotal='" + sellTotal + '\'' +
96+
", buyDetail=" + buyDetail +
97+
", sellDetail=" + sellDetail +
98+
'}';
99+
}
100+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.webull.openapi.data.quotes.domain;
2+
3+
4+
import java.util.List;
5+
6+
public class FootprintResponse extends QuotesBasic{
7+
8+
private List<Footprint> result;
9+
10+
public List<Footprint> getResult() {
11+
return result;
12+
}
13+
14+
public void setResult(List<Footprint> result) {
15+
this.result = result;
16+
}
17+
18+
@Override
19+
public String toString() {
20+
return "FootprintResponse{" +
21+
"symbol='" + symbol + '\'' +
22+
", instrumentId='" + instrumentId + '\'' +
23+
", result=" + result +
24+
'}';
25+
}
26+
}

0 commit comments

Comments
 (0)