add rewards commands

This commit is contained in:
c9s 2021-01-15 11:10:43 +08:00
parent 4ba510a799
commit fd6301b780
2 changed files with 17 additions and 0 deletions

View File

@ -72,6 +72,17 @@ case "$command" in
cancelOrder $order_id cancelOrder $order_id
;; ;;
rewards)
declare -A rewards_params=()
currency=$1
if [[ -n $currency ]] ; then
rewards_params[currency]=$currency
fi
# rewards rewards_params | jq -r '.[] | "\(.type)\t\((.amount | tonumber) * 1000 | floor / 1000)\t\(.currency) \(.state) \(.created_at | strflocaltime("%Y-%m-%dT%H:%M:%S %Z"))"'
rewards rewards_params | jq -r '.[] | [ .type, ((.amount | tonumber) * 10000 | floor / 10000), .currency, .state, (.created_at | strflocaltime("%Y-%m-%dT%H:%M:%S %Z")) ] | @tsv' \
| column -ts $'\t'
;;
trades) trades)
if [[ $# < 1 ]] ; then if [[ $# < 1 ]] ; then
echo "$0 trades [market]" echo "$0 trades [market]"

View File

@ -119,6 +119,12 @@ function myTrades()
send_auth_request "GET" "/api/v2/trades/my" params send_auth_request "GET" "/api/v2/trades/my" params
} }
function rewards()
{
local -n params=$1
send_auth_request "GET" "/api/v2/rewards" params
}
# me | jq '.accounts[] | select(.currency == "usdt")' # me | jq '.accounts[] | select(.currency == "usdt")'
# me | jq '.accounts[] | select(.currency == "btc")' # me | jq '.accounts[] | select(.currency == "btc")'