-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquerystring.php
More file actions
141 lines (122 loc) · 3.02 KB
/
Copy pathquerystring.php
File metadata and controls
141 lines (122 loc) · 3.02 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
/**
* @author Ebo Eppenga
* @copyright 2022
*
* GoldStar Buy and Sell bot based on signals from for example TradeView
* or any other platform using PHP Bybit API from zhouaini528.
*
* querystring.php
* Reads and checks all query string parameters.
*
**/
// Get and validate key
$get_url_key = $_GET["key"];
$get_url_key = str_replace("_", "", $get_url_key);
if (!empty($url_key)) {
if ($get_url_key <> str_replace("_", "", $url_key)) {
doError("Error: Security key did not validate", $id, true);
}
}
// Get BUY or SELL
$command = strtoupper($_GET["action"]);
if ($command == "BUY") {
$action = "BUY";
} elseif ($command == "SELL") {
$action = "SELL";
} elseif ($command == "CHECK") {
$action = "CHECK";
} else {
doError("Error: No BUY, SELL or CHECK", $id, true);
}
// Get pair
$pair = strtoupper($_GET["pair"]);
if (empty($pair)) {
doError("Error: No pair given", $id, true);
}
// Limit order
if (isset($_GET["limit"])) {
$limit = strtoupper($_GET["limit"]);
if ($limit == "TRUE") {
$limit = true;
} else {
$limit = false;
}
}
// Override spread
if (isset($_GET["spread"])) {
$temp_spread = $_GET["spread"];
if (($temp_spread >= 0) && ($temp_spread < 5)) {
$spread = $temp_spread;
} else {
doError("Error: Spread can only be between 0% and 5%", $id, true);
}
}
// Override profit
if (isset($_GET["markup"])) {
$temp_markup = $_GET["markup"];
if (($temp_markup >= -10) && ($temp_markup < 25)) {
$markup = $temp_markup;
} else {
doError("Error: Markup can only be between -10% and 25%", $id, true);
}
}
// Get compounding base
if (isset($_GET["comp"])) {
$compounding = $_GET["comp"];
}
// Get multiplier
if (isset($_GET["mult"])) {
$temp_mult = $_GET["mult"];
if ($temp_mult > 1) {
$multiplier = $temp_mult;
} else {
doError("Error: Order value multiplier must be larger than 1", $id, true);
}
}
// Override TradingView
if (isset($_GET["tv"])) {
$tv_advice = strtoupper($_GET["tv"]);
if ($tv_advice == "TRUE") {
$tv_advice = true;
} else {
$tv_advice = false;
}
}
if ($tv_advice) {
// Get additional TradingView parameters
$tv_recomCheck = false;
// Get minimum TradingView recommendation
if (isset($_GET["tvmin"])) {
$tv_recomMin = $_GET["tvmin"];
if (($tv_recomMin < 0) && ($tv_recomMin > 1)) {
$tv_recomCheck = true;
}
}
// Get maximum TradingView recommendation
if (isset($_GET["tvmax"])) {
$tv_recomMax = $_GET["tvmax"];
if (($tv_recomMax < 0) && ($tv_recomMax > 1)) {
$tv_recomCheck = true;
}
}
// recomMin must be smaller than recomMax
if ($tv_recomMin > $tv_recomMax) {
$tv_recomCheck = true;
}
// Check if recomMin / Max are correct
if ($tv_recomCheck) {
doError("Error: recomMin/Max are not set correct", $id, true);
}
// Get TradingView periods
if (isset($_GET['tvpers'])) {
$temp_tvp = $_GET['tvpers'];
$tv_periods = explode(",",$temp_tvp);
}
} else {
//TradingView advice not active
$tv_recomMin = 0;
$tv_recomMax = 0;
$tv_periods = array();
}
?>