-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmock
35 lines (27 loc) · 1.77 KB
/
mock
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
#!/usr/bin/env bashs
function trade {
price=$((10))
timeStamp=$(date +%s)
#tradeUrl=http://192.168.99.100/orderbook
tradeUrl=http://blackwheel.io/orderbook
for i in {1..500}; do
# sleep 1
if [[ $[i % 5] == 0 && $[i % 3] == 0 ]]; then
price=$((price + 10))
curl -s -H "Content-Type: application/json" -X POST -d '{"uuid": '"$i"',"ticker":"STOCK","orders": [{"bid": '"$price"', "actor": "Bob", "timecreated": '"$((timeStamp))"''"$((i))"', "intent": "BUY", "shares": 100, "state": "OPEN", "ticker": "STOCK", "kind": "LIMIT"}]}' $tradeUrl > /dev/null &
# echo " " $i " Bid " $price
elif [[ $[i % 5] == 0 ]]; then
price=$((price - 5))
curl -s -H "Content-Type: application/json" -X POST -d '{"uuid": '"$i"',"ticker":"STOCK","orders": [{"ask": '"$price"', "actor": "Tim", "timecreated": '"$((timeStamp))"''"$((i))"', "intent": "SELL", "shares": 100, "state": "OPEN", "ticker": "STOCK", "kind": "LIMIT"}]}' $tradeUrl > /dev/null &
# echo " " $i " Ask " $price
elif [[ $[i % 3] == 0 ]]; then
price=$((price - 1))
curl -s -H "Content-Type: application/json" -X POST -d '{"uuid": '"$i"',"ticker":"STOCK","orders": [{"bid": '"$price"', "actor": "Bob", "timecreated": '"$((timeStamp))"''"$((i))"', "intent": "BUY", "shares": 100, "state": "OPEN", "ticker": "STOCK", "kind": "LIMIT"}]}' $tradeUrl > /dev/null &
# echo " " $i " Bid " $price
else
price=$((price + 1))
curl -s -H "Content-Type: application/json" -X POST -d '{"uuid": '"$i"',"ticker":"STOCK","orders": [{"ask": '"$price"', "actor": "Tim", "timecreated": '"$((timeStamp))"''"$((i))"', "intent": "SELL", "shares": 100, "state": "OPEN", "ticker": "STOCK", "kind": "LIMIT"}]}' $tradeUrl > /dev/null &
# echo " " $i " Ask " $price
fi
done
}