Skip to content
Open

WK2 #16

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions BasicStockService.java
Original file line number Diff line number Diff line change
@@ -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<StockQuote> getQuote(String symbol, Calendar startCalendar, Calendar endCalendar) {
StockQuote Quote = new StockQuote();
Quote.getQuote(symbol, startCalendar, endCalendar);
List<StockQuote> SQL = new ArrayList<>(Arrays.asList(Quote));
return SQL;
}
}

19 changes: 19 additions & 0 deletions StockQuote.java
Original file line number Diff line number Diff line change
@@ -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<StockQuote> getQuote(String symbol, Calendar from, Calendar until) {
return null;
}
@Override
public List<StockQuote> getQuote(String symbol, Calendar from, Calendar until, Interval interval) {
return null;
}
}
39 changes: 39 additions & 0 deletions StockService.java
Original file line number Diff line number Diff line change
@@ -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 <CODE>BigDecimal</CODE> 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<StockQuote> 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<StockQuote> getQuote(String symbol, Calendar from, Calendar until, Interval interval);
}
14 changes: 14 additions & 0 deletions StockServiceFactory.java
Original file line number Diff line number Diff line change
@@ -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*/
}
}
28 changes: 28 additions & 0 deletions StockTest.java
Original file line number Diff line number Diff line change
@@ -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() {
}
}