From a4a3f0fbd8df381fcb23a71d3a2bb85dba981bd6 Mon Sep 17 00:00:00 2001 From: c9s Date: Sat, 13 Mar 2021 20:49:36 +0800 Subject: [PATCH] maxapi: add withdraw command --- scripts/max.sh | 26 +++++++++++++++++++++++++- scripts/maxapi.sh | 8 +++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/scripts/max.sh b/scripts/max.sh index 127672b37..651bd007d 100644 --- a/scripts/max.sh +++ b/scripts/max.sh @@ -24,7 +24,31 @@ case "$command" in submitOrder order_params ;; - withdrawal-history) + deposits) + declare -A params=() + currency=$1 + if [[ -n $currency ]] ; then + params[currency]=$currency + fi + + deposits params \ + | jq -r '.[] | [ .uuid, ((.amount | tonumber) * 10000 | floor / 10000), .currency, .state, (.created_at | strflocaltime("%Y-%m-%dT%H:%M:%S %Z")), .note ] | @tsv' \ + | column -ts $'\t' + ;; + + withdrawals) + declare -A params=() + currency=$1 + if [[ -n $currency ]] ; then + params[currency]=$currency + fi + + withdrawals params \ + | jq -r '.[] | [ .uuid, ((.amount | tonumber) * 10000 | floor / 10000), .currency, ((.fee | tonumber) * 10000 | floor / 10000), .fee_currency, .state, (.created_at | strflocaltime("%Y-%m-%dT%H:%M:%S %Z")), .note ] | @tsv' \ + | column -ts $'\t' + ;; + + withdrawals) declare -A params=() currency=$1 if [[ -n $currency ]] ; then diff --git a/scripts/maxapi.sh b/scripts/maxapi.sh index ff13ea5ab..2bb68d6f3 100755 --- a/scripts/maxapi.sh +++ b/scripts/maxapi.sh @@ -133,7 +133,13 @@ function rewards() send_auth_request "GET" "/api/v2/rewards" _params } -function withdrawalHistory() +function deposits() +{ + local -n _params=$1 + send_auth_request "GET" "/api/v2/deposits" _params +} + +function withdrawals() { local -n _params=$1 send_auth_request "GET" "/api/v2/withdrawals" _params