-
Notifications
You must be signed in to change notification settings - Fork 3
/
shellogre.sh
161 lines (109 loc) · 3.76 KB
/
shellogre.sh
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/sh
## Set key and secret.
KEY=ENTER_API_KEY_HERE
SECRET=ENTER_API_SECRET_HERE
## Print selection menu.
printf "\n"
showMenu(){
echo "===================================="
echo " ShellOgre "
echo "===================================="
echo "[1] Get BTC Balance."
echo "[2] Get XMR Balance."
echo "[3] Buy XMR with BTC"
echo "[4] Buy BTC with XMR"
echo "[5] Exit"
echo "===================================="
printf "\n"
printf "\n"
read -p "Please Select A Number: " mc
return $mc
}
## Execute the selection input.
while [[ "$m" != "5" ]]
do
if [[ "$m" == "1" ]]; then
## Get BTC Balance.
printf "\n"
printf "\n"
echo Your BTC balance is:
curl -s --request POST \
--url https://tradeogre.com/api/v1/account/balance \
--user $KEY:$SECRET \
--form currency=BTC | jq '.balance' | tr '"' ' '
printf "\n"
printf "\n"
echo Your available BTC balance is:
curl -s --request POST \
--url https://tradeogre.com/api/v1/account/balance \
--user $KEY:$SECRET \
--form currency=BTC | jq '.available' | tr '"' ' '
printf "\n"
printf "\n"
elif [[ "$m" == "2" ]]; then
## Get XMR Balance.
printf "\n"
printf "\n"
echo Your XMR balance is:
curl -s --request POST \
--url https://tradeogre.com/api/v1/account/balance \
--user $KEY:$SECRET \
--form currency=XMR | jq '.balance' | tr '"' ' '
printf "\n"
printf "\n"
echo Your available XMR balance is:
curl -s --request POST \
--url https://tradeogre.com/api/v1/account/balance \
--user $KEY:$SECRET \
--form currency=XMR | jq '.available' | tr '"' ' '
printf "\n"
printf "\n"
elif [[ "$m" == "3" ]]; then
## Buy XMR with BTC
BTCXMR=$(curl -s --request GET \
--url https://tradeogre.com/api/v1/ticker/BTC-XMR | jq '.price' | tr -d '"')
XMRUSD=$(curl -s -X GET "https://api.coingecko.com/api/v3/simple/price?ids=monero&vs_currencies=usd" -H "accept: application/json" | jq '.monero.usd')
CURRENTBTC=$(curl -s --request POST \
--url https://tradeogre.com/api/v1/account/balance \
--user $KEY:$SECRET \
--form currency=BTC | jq '.available' | tr -d '"')
echo Current XMR Price is 1 XMR = "$BTCXMR" BTC, worth $XMRUSD USD. &&
echo How many BTC would you like to trade for XMR? &&
echo Your current balance is $CURRENTBTC BTC.
printf "\n"
read howmanybtc
curl --request POST \
--url https://tradeogre.com/api/v1/order/buy \
--user $KEY:$SECRET \
--form market=BTC-XMR \
--form quantity=$howmanybtc \
--form price=$BTCXMR
printf "\n"
printf "\n"
elif [[ "$m" == "4" ]]; then
## Buy BTC with XMR
XMRBTC=$(curl -s --request GET \
--url https://tradeogre.com/api/v1/ticker/BTC-XMR | jq '.bid' | tr -d '"')
BTCUSD=$(curl -s -X GET "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd" -H "accept: application/json" | jq '.bitcoin.usd')
CURRENTXMR=$(curl -s --request POST \
--url https://tradeogre.com/api/v1/account/balance \
--user $KEY:$SECRET \
--form currency=XMR | jq '.available' | tr -d '"')
echo Current BTC Price is 1 BTC = "$XMRBTC" XMR, worth $BTCUSD USD. &&
echo How many XMR would you like to trade for BTC? &&
echo Your current balance is $CURRENTXMR XMR.
printf "\n"
read howmanyxmr
curl --request POST \
--url https://tradeogre.com/api/v1/order/buy \
--user $KEY:$SECRET \
--form market=XMR-BTC \
--form quantity=$howmanyxmr \
--form price=$XMRBTC
printf "\n"
printf "\n"
fi
showMenu
m=$?
done
exit 0;