-
Notifications
You must be signed in to change notification settings - Fork 1
/
VolumeSpikeIndicator.java
109 lines (70 loc) · 2.97 KB
/
VolumeSpikeIndicator.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
/*
* 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 java.net.ConnectException;
import java.util.Iterator;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Temporary class for spawning and testing threads.
* The run() method contains testing code snippets.
*
* @author Man Eesh
*/
public class VolumeSpikeIndicator extends Thread{
private Symbol s;
private Intraday newday;
private int intervalMins;
/**
* Initializes Symbol Object of Class Runner.
* @param s
*/
public VolumeSpikeIndicator(Symbol s){
// newday = new Intraday(s.toStringYahoo());
this.s = s;
}
@Override
public void run() {
if(newday==null){
try{
newday = new Intraday(s.toStringYahoo());
}catch(Exception g){System.out.println(" REMOVED : "+s.toStringNSE());
return;}
}
Thread.currentThread().setName(s.toStringNSE());
// System.out.println(s.toStringNSE());
while(true) {
// for (Iterator<Symbol> it = this.s.getSymbolList().iterator(); it.hasNext();) {
// Symbol a = it.next();
try{
// GetMaster.getSpike(s.toStringYahoo());
// GetMaster.getBasic(s.toString());
int av = newday.getAV();
int recentVolume = newday.getRecentVolume();
System.out.println(s.toStringNSE());
if(recentVolume > 1.5*av){
System.out.println("-------------------------\n\n SPIKE AT : "
+ s.toStringYahoo()
+ Util.getTimeReadable(newday.getMins()
.get(newday.recent).getTimestamp() )
+"\n\n-------------------------" );
}
Thread.sleep(0xc350);
}
catch(InterruptedException e){break;}
catch(Exception f){System.out.println(" REMOVED B : " +
s.toStringNSE());
return;
}
}
/*
try {
Thread.sleep(200);
} catch (InterruptedException e) {
break;
}*/
}
}