This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onBindViewHolder(@NonNull stockIndexViewHolder stockIndexViewHolder, int i) { | |
String[] arrayIndexName = {"S&P/ASX 200 Index","S&P/ASX 50 Index"}; | |
Company index = stockIndexesArrayList.get(i); | |
stockIndexViewHolder.candleStickChart.setHighlightPerDragEnabled(true); | |
stockIndexViewHolder.candleStickChart.setDrawBorders(true); | |
stockIndexViewHolder.candleStickChart.setBorderColor(Color.LTGRAY); | |
YAxis yAxis = stockIndexViewHolder.candleStickChart.getAxisLeft(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LoadChartClass { | |
public LoadChartClass(){} | |
public Stock loadAnyChart(Company equity, String equityName){ | |
ArrayList<DailyPrice> indexDailyPrices = equity.getCompanyStockPrices(); | |
Table table = Table.instantiate("x"); | |
List<DataEntry> data = new ArrayList<>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DailyPrice { | |
private String dailyDate; | |
private double dailyOpen; | |
private double dailyHigh; | |
private double dailyLow; | |
private double dailyClose; | |
private int dailyVolume; | |
public DailyPrice(String dailyDate, double dailyOpen, double dailyHigh, double dailyLow, double dailyClose, int dailyVolume) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void getStockPricesOnline(final String companyCode){ | |
Thread thread = new Thread(new Runnable() { | |
@Override | |
public void run() { | |
String inputLine; | |
String result; | |
boolean successful = false; | |
while(!successful){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Meta Data": { | |
"1. Information": "Daily Prices (open, high, low, close) and Volumes", | |
"2. Symbol": "ASX:CBA", | |
"3. Last Refreshed": "2019-10-16", | |
"4. Output Size": "Compact", | |
"5. Time Zone": "US/Eastern" | |
}, | |
"Time Series (Daily)": { | |
"2019-10-16": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let companies = ["A2M","CBA","AHG","ABC","CCL"] | |
for company in companies{ | |
let jsonUrlStringPrice = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=ASX:"+company+"&outputsize=100&apikey=demo" | |
//API key need to be claim in AlphaVantage | |
URLSession.shared.dataTask(with: url){ (data, response, err) in | |
guard let data = data else {return} | |
do{ | |
let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as AnyObject |