Merge pull request #154 from c9s/feature/shell-maxapi-withdraw-deposit

feature: add withdraw deposit commands to shell version maxapi
This commit is contained in:
Yo-An Lin 2021-03-15 09:01:10 +08:00 committed by GitHub
commit 99fe8b07f1
2 changed files with 43 additions and 7 deletions

View File

@ -24,6 +24,30 @@ case "$command" in
submitOrder order_params submitOrder order_params
;; ;;
deposits)
declare -A params=()
currency=$1
if [[ -n $currency ]] ; then
params[currency]=$currency
fi
deposits params \
| jq -r '.[] | [ .uuid, .txid, ((.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, .txid, ((.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) limit)
market=$1 market=$1
side=$2 side=$2

View File

@ -116,21 +116,33 @@ function cancelOrder()
function myOrders() function myOrders()
{ {
local -n params=$1 local -n _params=$1
send_auth_request "GET" "/api/v2/orders" params send_auth_request "GET" "/api/v2/orders" _params
} }
function myTrades() function myTrades()
{ {
local -n params=$1 local -n _params=$1
send_auth_request "GET" "/api/v2/trades/my" params send_auth_request "GET" "/api/v2/trades/my" _params
} }
function rewards() function rewards()
{ {
local -n params=$1 local -n _params=$1
send_auth_request "GET" "/api/v2/rewards" params send_auth_request "GET" "/api/v2/rewards" _params
}
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
} }