33import com .google .api .client .util .Lists ;
44import com .webull .openapi .common .dict .Category ;
55import com .webull .openapi .common .dict .Timespan ;
6+ import com .webull .openapi .common .dict .TradingSession ;
7+ import com .webull .openapi .common .dict .YesOrNo ;
68import com .webull .openapi .example .config .Env ;
79import com .webull .openapi .execption .ClientException ;
810import com .webull .openapi .execption .ServerException ;
1719import com .webull .openapi .quotes .domain .Tick ;
1820import com .webull .openapi .serialize .JsonSerializer ;
1921
22+ import java .util .ArrayList ;
2023import java .util .HashSet ;
2124import java .util .List ;
2225import java .util .Set ;
@@ -39,6 +42,12 @@ public static void main(String[] args) {
3942 symbols .add ("AAPL" );
4043 symbols .add ("TSLA" );
4144
45+ List <String > tradingSessions = new ArrayList <>();
46+ tradingSessions .add (TradingSession .PRE .name ());
47+ tradingSessions .add (TradingSession .RTH .name ());
48+ tradingSessions .add (TradingSession .ATH .name ());
49+ tradingSessions .add (TradingSession .OVN .name ());
50+
4251 List <Instrument > instruments = quotesApiClient .getInstruments (symbols , Category .US_STOCK .name ());
4352 logger .info ("Instruments: {}" , JsonSerializer .toJson (instruments ));
4453
@@ -50,6 +59,14 @@ public static void main(String[] args) {
5059 BatchBarResponse batchBars = quotesApiClient .getBatchBars (Lists .newArrayList (symbols ), Category .US_STOCK .name (), Timespan .M1 .name (), 2 );
5160 logger .info ("Batch bars: {}" , JsonSerializer .toJson (batchBars ));
5261
62+ // get bars. Only supports HK.
63+ bars = quotesApiClient .getBars (symbol , Category .US_STOCK .name (), Timespan .M5 .name (), 10 , YesOrNo .N .name () , tradingSessions );
64+ logger .info ("Bars: {}" , JsonSerializer .toJson (bars ));
65+
66+ // get bars with symbols. Only supports HK.
67+ batchBars = quotesApiClient .getBatchBars (Lists .newArrayList (symbols ), Category .US_STOCK .name (), Timespan .M15 .name (), 2 , YesOrNo .N .name () , tradingSessions );
68+ logger .info ("Batch bars: {}" , JsonSerializer .toJson (batchBars ));
69+
5370 // get quote
5471 Quote quote = quotesApiClient .getQuote (symbol , Category .US_STOCK .name ());
5572 logger .info ("Quote: {}" , JsonSerializer .toJson (quote ));
0 commit comments