-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
103 lines (77 loc) · 2.35 KB
/
bot.js
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
console.log("debug1")
const axios = require('axios');
//ah yes variables
global.why1
global.why2
global.whyb
global.tick
global.ticker
ticker = "X"
tick = 1
global.accountid = ""
global.auth = ""
var i
console.log("debug2")
function test() {
console.log("debug3")
axios.get(`https://spookvooper.com/api/Eco/GetStockValue?ticker=${global.ticker}`)
.then((res) => {
console.log(`Status: ${res.status}`);
console.log('Body: ', res.data);
global.why1 = res.data
}).catch((err) => {
console.error(err);
});
console.log("debug4")
axios.get(`https://spookvooper.com/api/Eco/GetBalance?svid=${global.accountid}`)
.then((res) => {
console.log(`Status: ${res.status}`);
console.log('Body: ', res.data);
global.why2 = res.data
}).catch((err) => {
console.error(err);
});
if(global.tick = 1){
global.whyb = global.why1
}
global.tick = global.tick + 1
setTimeout(hahah, 5000)
function hahah() {
console.log(`loop ${global.tick} started!`)
console.log(global.why1);
console.log(global.why2);
console.log("checking stock price")
if(global.why1 < global.whyb ){
console.log("Stock price increased since start of code, selling")
axios.get(`https://spookvooper.com/api/Eco/SubmitStockSell?Ticker=${ticker}&count=5&price=0&accountid=${global.accountid}&auth=${global.auth}`)
.then((res) => {
console.log(`Status: ${res.status}`);
console.log('Body: ', res.data);
}).catch((err) => {
console.error(err);
});
global.whyb = global.why1
} else{
console.log("stock price hasnt increased since last buy")
}
if (why2 > 100) {
console.log("bot has enough money to buy stonks, attempting too")
axios.get(`https://spookvooper.com/api/Eco/SubmitStockBuy?Ticker=${global.ticker}&count=1&price=0&accountid=${global.accountid}&auth=${global.auth}`)
.then((res) => {
console.log(`Status: ${res.status}`);
console.log('Body: ', res.data);
}).catch((err) => {
console.error(err);
})
}
}
}
console.log("debug5")
function refreshData() {
{
x = 10; // 5 Seconds
test();
setTimeout(refreshData, x*1000);
}
}
refreshData(); // execute function