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
;;
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)
market=$1
side=$2
@ -83,7 +107,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,33 @@ 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 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
}