Skip to content

Commit 5fdf219

Browse files
committed
feat:add option interface and domain name
1 parent 99c4023 commit 5fdf219

19 files changed

Lines changed: 777 additions & 19 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Webull OpenAPI Java SDK
22

3-
Note: This is the new version of the Webull SDK, currently applicable only to Webull Hong Kong, Webull US, Webull JP, Webull SG, Webull AU, or Webull TH customers.
3+
Note: This is the new version of the Webull SDK, currently applicable only to Webull Hong Kong, Webull US, Webull JP, Webull SG, Webull TH, Webull AU, Webull MY, or Webull UK customers.
44

55
Webull OpenAPI aims to provide quantitative trading investors with convenient, fast and secure services. Webull aims to help every quant traders achieve flexible and changeable trading or market strategies.
66

@@ -26,6 +26,8 @@ Subscription to real-time information: Subscribe to order status changes, market
2626
| Webull SG | https://www.webull.com.sg/open-api-management |
2727
| Webull TH | https://www.webull.co.th/open-api-management |
2828
| Webull AU | https://www.webull.com.au/open-api-management |
29+
| Webull MY | https://www.webull.com.my/open-api-management |
30+
| Webull UK | https://www.webull-uk.com/open-api-management |
2931

3032
- Requires JDK 8 and above.
3133

@@ -49,3 +51,5 @@ The bottom layer of Webull OpenAPI provides three protocols, HTTP / GRPC / MQTT,
4951
| Webull SG | https://developer.webull.com.sg/apis/docs |
5052
| Webull TH | https://developer.webull.co.th/apis/docs |
5153
| Webull AU | https://developer.webull.com.au/apis/docs |
54+
| Webull MY | https://developer.webull.com.my/apis/docs |
55+
| Webull UK | https://developer.webull-uk.com/apis/docs |

‎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.1.10</version>
24+
<version>1.1.11</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.1.10</version>
22+
<version>1.1.11</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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ public static void main(String[] args) {
147147
NoiiSnapshot closeSnapshot = dataClient.getNoiiSnapshot("AAPL", Category.US_STOCK.name(), "PRE_CLOSE");
148148
logger.info("NOII closing snapshot: {}", closeSnapshot);
149149

150+
Set<String> optionSymbols = new HashSet<>();
151+
optionSymbols.add("AAPL260522C00300000");
152+
List<OptionSnapshot> optionSnapshots = dataClient.getOptionSnapshots(optionSymbols, Category.US_OPTION.name());
153+
logger.info("Option Snapshots: {}", optionSnapshots);
154+
155+
List<OptionBars> optionBars = dataClient.getOptionBars(new ArrayList<>(optionSymbols), Category.US_OPTION.name(), Timespan.M1.name(), 10, false);
156+
logger.info("Option Bars: {}", optionBars);
157+
158+
OptionTick OptionTicks = dataClient.getOptionTicks("AAPL260522C00300000", Category.US_OPTION.name(), 30);
159+
logger.info("Option Ticks: {}", OptionTicks);
160+
161+
150162
// // get end of day market
151163
// List<EodBars> eodBars = IDataClient.getEodBars(instrumentIds, "2023-01-01", 10);
152164
// 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.1.10</version>
10+
<version>1.1.11</version>
1111
</parent>
1212

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

‎webull-openapi-java-sdk/src/main/java/com/webull/openapi/core/common/ApiModule.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ public enum ApiModule {
2222
* api
2323
*/
2424
API(DefaultHost.API_US, DefaultHost.API_HK, DefaultHost.API_JP, DefaultHost.API_SG,
25-
DefaultHost.API_TH,DefaultHost.API_AU),
25+
DefaultHost.API_TH, DefaultHost.API_AU, DefaultHost.API_MY, DefaultHost.API_UK),
2626
/**
2727
* quotes api
2828
*/
2929
QUOTES(DefaultHost.QUOTES_US, DefaultHost.QUOTES_HK, DefaultHost.QUOTES_JP, DefaultHost.QUOTES_SG,
30-
DefaultHost.QUOTES_TH,DefaultHost.QUOTES_AU),
30+
DefaultHost.QUOTES_TH, DefaultHost.QUOTES_AU, DefaultHost.QUOTES_MY, DefaultHost.QUOTES_UK),
3131
/**
3232
* events api
3333
*/
3434
EVENTS(DefaultHost.EVENTS_US, DefaultHost.EVENTS_HK, DefaultHost.EVENTS_JP, DefaultHost.EVENTS_SG,
35-
DefaultHost.EVENTS_TH,DefaultHost.EVENTS_AU),
35+
DefaultHost.EVENTS_TH, DefaultHost.EVENTS_AU, DefaultHost.EVENTS_MY, DefaultHost.EVENTS_UK),
3636
;
3737

3838
private final EnumMap<Region, String> hosts;

‎webull-openapi-java-sdk/src/main/java/com/webull/openapi/core/common/DefaultHost.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ private DefaultHost() {}
4343
public static final String QUOTES_AU = "data-api.webull.com.au";
4444
public static final String EVENTS_AU = "events-api.webull.com.au";
4545

46+
public static final String API_MY = "api.webull.com.my";
47+
public static final String QUOTES_MY = "data-api.webull.com.my";
48+
public static final String EVENTS_MY = "events-api.webull.com.my";
49+
50+
public static final String API_UK = "api.webull-uk.com";
51+
public static final String QUOTES_UK = "data-api.webull-uk.com";
52+
public static final String EVENTS_UK = "events-api.webull-uk.com";
53+
4654
public static final String API_HK_SANDBOX = "api.sandbox.webull.hk";
4755
public static final String EVENTS_HK_SANDBOX = "events-api.sandbox.webull.hk";
4856

‎webull-openapi-java-sdk/src/main/java/com/webull/openapi/core/common/Region.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
public enum Region {
2121

22-
us, hk, jp, sg, th, au;
22+
us, hk, jp, sg, th, au, my, uk;
2323

2424
public static Optional<Region> of(String name) {
2525
for (Region region : Region.values()) {

‎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.1.10";
27+
private static final String DEFAULT_APPLICATION_VERSION = "1.1.11";
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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,51 @@ public Tick getFutureTicks(String symbol, String category, int count) {
322322
return apiClient.request(request).responseType(new TypeToken<Tick>() {}.getType()).doAction();
323323
}
324324

325+
@Override
326+
public List<OptionBars> getOptionBars(List<String> symbols, String category, String timespan, int count, Boolean realTimeRequired) {
327+
Assert.notEmpty(ArgNames.SYMBOLS, symbols);
328+
Assert.notBlank(ArgNames.CATEGORY, category);
329+
Assert.notBlank(ArgNames.TIMESPAN, timespan);
330+
HttpRequest request = new HttpRequest("/openapi/market-data/option/bars", Versions.V2, HttpMethod.GET);
331+
Map<String, Object> params = new HashMap<>();
332+
params.put(ArgNames.SYMBOLS, String.join(",", symbols));
333+
params.put(ArgNames.CATEGORY, category);
334+
params.put(ArgNames.TIMESPAN, timespan);
335+
params.put(ArgNames.COUNT, count);
336+
if(Objects.nonNull(realTimeRequired)){
337+
params.put(ArgNames.REAL_TIME_REQUIRED, realTimeRequired);
338+
}
339+
request.setQuery(params);
340+
addCustomHeaders(request);
341+
return apiClient.request(request).responseType(new TypeToken<List<OptionBars>>() {}.getType()).doAction();
342+
}
343+
344+
@Override
345+
public OptionTick getOptionTicks(String symbol, String category, int count) {
346+
Assert.notBlank(Arrays.asList(ArgNames.SYMBOL, ArgNames.CATEGORY), symbol, category);
347+
HttpRequest request = new HttpRequest("/openapi/market-data/option/tick", Versions.V2, HttpMethod.GET);
348+
Map<String, Object> params = new HashMap<>();
349+
params.put(ArgNames.SYMBOL, symbol);
350+
params.put(ArgNames.CATEGORY, category);
351+
params.put(ArgNames.COUNT, count);
352+
request.setQuery(params);
353+
addCustomHeaders(request);
354+
return apiClient.request(request).responseType(new TypeToken<OptionTick>() {}.getType()).doAction();
355+
}
356+
357+
@Override
358+
public List<OptionSnapshot> getOptionSnapshots(Set<String> symbols, String category) {
359+
Assert.notEmpty(ArgNames.SYMBOLS, symbols);
360+
Assert.notBlank(ArgNames.CATEGORY, category);
361+
HttpRequest request = new HttpRequest("/openapi/market-data/option/snapshot", Versions.V2, HttpMethod.GET);
362+
Map<String, Object> params = new HashMap<>();
363+
params.put(ArgNames.SYMBOLS, String.join(",", symbols));
364+
params.put(ArgNames.CATEGORY, category);
365+
request.setQuery(params);
366+
addCustomHeaders(request);
367+
return apiClient.request(request).responseType(new TypeToken<List<OptionSnapshot>>() {}.getType()).doAction();
368+
}
369+
325370
@Override
326371
@Deprecated
327372
public List<FuturesProduct> getFuturesProducts(String category) {

0 commit comments

Comments
 (0)