maxapi: add withdraw command

This commit is contained in:
c9s 2021-03-13 20:49:36 +08:00
parent 710df930a4
commit a4a3f0fbd8
2 changed files with 32 additions and 2 deletions

View File

@ -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

View File

@ -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