maxapi: add bash version withdrawal history command

This commit is contained in:
c9s 2021-03-09 13:19:08 +08:00
parent 00109eb464
commit 710df930a4
2 changed files with 25 additions and 7 deletions

View File

@ -24,6 +24,18 @@ case "$command" in
submitOrder order_params
;;
withdrawal-history)
declare -A params=()
currency=$1
if [[ -n $currency ]] ; then
params[currency]=$currency
fi
withdrawalHistory 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'
;;
limit)
market=$1
side=$2
@ -83,7 +95,7 @@ case "$command" in
rewards rewards_params | jq -r '.[] | [ .uuid, .type, ((.amount | tonumber) * 10000 | floor / 10000), .currency, .state, (.created_at | strflocaltime("%Y-%m-%dT%H:%M:%S %Z")), .note ] | @tsv' \
| column -ts $'\t'
;;
trades)
if [[ $# < 1 ]] ; then
echo "$0 trades [market]"

View File

@ -116,21 +116,27 @@ function cancelOrder()
function myOrders()
{
local -n params=$1
send_auth_request "GET" "/api/v2/orders" params
local -n _params=$1
send_auth_request "GET" "/api/v2/orders" _params
}
function myTrades()
{
local -n params=$1
send_auth_request "GET" "/api/v2/trades/my" params
local -n _params=$1
send_auth_request "GET" "/api/v2/trades/my" _params
}
function rewards()
{
local -n params=$1
send_auth_request "GET" "/api/v2/rewards" params
local -n _params=$1
send_auth_request "GET" "/api/v2/rewards" _params
}
function withdrawalHistory()
{
local -n _params=$1
send_auth_request "GET" "/api/v2/withdrawals" _params
}