-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFXMLDocumentController.java
128 lines (84 loc) · 3.34 KB
/
FXMLDocumentController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package PriceAction101;
import static PriceAction101.Symbols.getInstance;
import static java.lang.Thread.sleep;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import org.jsoup.nodes.Document;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.json.JSONObject;
import org.json.JSONArray;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.json.JSONException;
/**
*
* @author Man Eesh
*/
public class FXMLDocumentController implements Initializable {
@FXML
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
}
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
// GetMaster.getQuoteIntraday("BHEL.NS",1); .... GET INTRADAY
/* while(true){
GetMaster.getSpike("BHEL.NS");
try{sleep(50000);}catch(Exception e){System.out.println(e);} ..... VOLUMESPIKE INDICATOR
}
*/
/* long epoch = System.currentTimeMillis()/1000;
int i = 0; ...... AUTO DOWNLOAD
while(i<=730){
System.out.println("\n\n\nDownloading...");
Download.downloadFileUnzip("CatchMarketData",Util.getCMURL(epoch - 86400*i));
i++;
}
*/
/*
Symbols s = getInstance();
System.out.println(s.toString()); ..... SYMBOLS LIST
*/
/* Symbols s = getInstance();
ArrayList<Symbol> e = s.getSymbolList();
//System.out.println(e.get(1).toString());
for (Symbol a : s.getSymbolList()) {
GetMaster.getBasic(a.toStringNSE());
}
*/
Symbols s = getInstance();
/*
while(true){
for (Iterator<Symbol> it = s.getSymbolList().iterator(); it.hasNext();) {
Symbol a = it.next();
try{ GetMaster.getSpike(a.toStringYahoo());
}catch(Exception e){it.remove();}
} }
*/
ArrayList<VolumeSpikeIndicator> threadpool = new ArrayList<>();
for (Iterator<Symbol> it = s.getSymbolList().iterator(); it.hasNext();){
threadpool.add(new VolumeSpikeIndicator(it.next()));
}
System.out.println("GOING TO START");
int a = threadpool.size();
int i;
for(i = 0 ; i<a ; i++){
try{ Thread.sleep(15);
threadpool.get(i).start();
}catch(InterruptedException e){System.out.println("Main Thread :"+ e );}
}
}
}