-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetprice
executable file
·23 lines (20 loc) · 1.01 KB
/
setprice
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
#
# Set a maker order
#
# @author webworker01
# @link https://developers.atomicdex.io/basic-docs/atomicdex-api-legacy/setprice.html
#
scriptpath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $scriptpath/main
if [[ -z $1 ]] || [[ -z $2 ]] || [[ -z $3 ]] || [[ -z $4 ]]; then
echo "Usage: setprice <sellcoin> <buycoin> <price (buycoin/sellcoin)> <volume (amount or max)>"
exit 0
fi
coin1=${1^^}
coin2=${2^^}
if [[ "$4" == "max" ]]; then
jq '.result | del(.. | .max_volume_rat?,.min_base_vol_rat?,.price_rat?,.max_base_vol_rat?)' <<< $(curl -s --url "http://127.0.0.1:7783" --data '{"method":"setprice","base":"'${coin1}'","rel":"'${coin2}'","price":"'${3}'","max":true,"userpass":"'${userpass}'"}')
else
jq '.result | del(.. | .max_volume_rat?,.min_base_vol_rat?,.price_rat?,.max_base_vol_rat?)' <<< $(curl -s --url "http://127.0.0.1:7783" --data '{"method":"setprice","base":"'${coin1}'","rel":"'${coin2}'","price":"'${3}'","volume":"'${4}'","userpass":"'${userpass}'"}')
fi