diff --git a/scripts/max.sh b/scripts/max.sh index 3ae99c8f9..565f358ff 100644 --- a/scripts/max.sh +++ b/scripts/max.sh @@ -71,6 +71,17 @@ case "$command" in order_id=$1 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) if [[ $# < 1 ]] ; then diff --git a/scripts/maxapi.sh b/scripts/maxapi.sh index b4b23c04d..f040ebee0 100755 --- a/scripts/maxapi.sh +++ b/scripts/maxapi.sh @@ -119,6 +119,12 @@ function myTrades() 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 == "btc")'