diff --git a/BasicStockService.java b/BasicStockService.java new file mode 100644 index 0000000..91c73a1 --- /dev/null +++ b/BasicStockService.java @@ -0,0 +1,24 @@ +package StockServices; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.List; + +public class BasicStockService implements StockService { + @Override + public StockQuote getQuote(String symbol) { + StockQuote Symbol = new StockQuote(); + Symbol.getQuote(symbol); + return Symbol; + } + + @Override + public List getQuote(String symbol, Calendar startCalendar, Calendar endCalendar) { + StockQuote Quote = new StockQuote(); + Quote.getQuote(symbol, startCalendar, endCalendar); + List SQL = new ArrayList<>(Arrays.asList(Quote)); + return SQL; + } +} + diff --git a/StockQuote.java b/StockQuote.java new file mode 100644 index 0000000..d751210 --- /dev/null +++ b/StockQuote.java @@ -0,0 +1,19 @@ +package StockServices; + +import java.util.Calendar; +import java.util.List; + +public class StockQuote extends StockServiceFactory implements StockService { + @Override + public StockQuote getQuote(String symbol) { + return null; + } + @Override + public List getQuote(String symbol, Calendar from, Calendar until) { + return null; + } + @Override + public List getQuote(String symbol, Calendar from, Calendar until, Interval interval) { + return null; + } +} diff --git a/StockService.java b/StockService.java new file mode 100644 index 0000000..4e85912 --- /dev/null +++ b/StockService.java @@ -0,0 +1,39 @@ +package StockServices; + +import java.util.Calendar; +import java.util.List; + +public interface StockService { + /** + * Return the current price for a share of stock for the + * given symbol + * @param symbol the stock symbol of the company you want a + * quote for e.g. APPL for APPLE + * @return a BigDecimal instance + */ + StockQuote getQuote(String symbol); + /** + * Get a historical list of stock quotes for the provided + * symbol + * @param symbol the stock symbol to search for + * @param from the date of the first stock quote + * @param until the date of the last stock quote + * @return a list of StockQuote instan + ces. + * One for each day in the range specified. + */ + List getQuote(String symbol, Calendar from, Calendar until); + /** + * Get a historical list of stock quotes for the provide symbol + * This method will return one StockQuote per interval specified. + * + *@param symbol the stock symbol to search for + *@param from the date of the first stock quote + *@param until the date of the last stock quote + *@param interval ­ the number of StockQuotes to get. E.g. if Interval.DAILY was specified + *one StockQuote per day will be returned. + * + ​@return a list of StockQuote instances. One for each day in the range specified. + */ + List getQuote(String symbol, Calendar from, Calendar until, Interval interval); +} diff --git a/StockServiceFactory.java b/StockServiceFactory.java new file mode 100644 index 0000000..da73ca9 --- /dev/null +++ b/StockServiceFactory.java @@ -0,0 +1,14 @@ +package StockServices; + +import java.util.Calendar; +import java.util.List; + +public class StockServiceFactory extends BasicStockService{ + public StockServiceFactory getStockService(String symbol, Calendar fromDate, Calendar toDate){ + BasicStockService BSS = new BasicStockService(); + StockQuote SQ; + SQ = (StockQuote) BSS.getQuote(symbol, fromDate, toDate); + return SQ; + /*returs stock service*/ + } +} diff --git a/StockTest.java b/StockTest.java new file mode 100644 index 0000000..605d28a --- /dev/null +++ b/StockTest.java @@ -0,0 +1,28 @@ +package StockServices; + +public class StockTest { + + @org.junit.jupiter.api.Test + void getQuote() { + } + + @org.junit.jupiter.api.Test + void getQuote1() { + } + + @org.junit.jupiter.api.Test + void getStockService() { + } + + @org.junit.jupiter.api.Test + void getQuote2() { + } + + @org.junit.jupiter.api.Test + void getQuote3() { + } + + @org.junit.jupiter.api.Test + void main() { + } +}