From fe25e38c938e280c4287f64149c90db94d6404d1 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 2 Dec 2020 09:40:27 +0800 Subject: [PATCH] add timestamp to trades layout --- scripts/max.sh | 12 +++++++++++- scripts/maxapi.sh | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/max.sh b/scripts/max.sh index 11966d410..9da72aec6 100644 --- a/scripts/max.sh +++ b/scripts/max.sh @@ -60,6 +60,16 @@ case "$command" in orders_params[market]=$market myOrders orders_params | jq -r '.[] | "\(.id) \(.market) \(.side) \(.price) \t \(.volume) \(.state)"' ;; + + cancel) + if [[ $# < 1 ]] ; then + echo "$0 cancel [oid]" + exit + fi + + order_id=$1 + cancelOrder $order_id + ;; trades) if [[ $# < 1 ]] ; then @@ -70,6 +80,6 @@ case "$command" in market=$1 declare -A trades_params=() trades_params[market]=$market - myTrades trades_params | jq -r '.[] | "\(.id) \(.market) \(.side) \(.price) \t \(.volume) fee = \(.fee) \(.fee_currency)"' + myTrades trades_params | jq -r '.[] | "\(.id) \(.market) \(.side) \(.price) \t \(.volume) \t fee = \( .fee | tonumber * 1000 | floor / 1000 ) \(.fee_currency)\t\( .created_at | strflocaltime("%Y-%m-%dT%H:%M:%S %Z") )"' ;; esac diff --git a/scripts/maxapi.sh b/scripts/maxapi.sh index 7b8de1d2e..b4b23c04d 100755 --- a/scripts/maxapi.sh +++ b/scripts/maxapi.sh @@ -99,6 +99,13 @@ function submitOrder() send_auth_request "POST" "/api/v2/orders" params } +function cancelOrder() +{ + declare -A params=() + params[id]=$1 + send_auth_request "POST" "/api/v2/order/delete" params +} + function myOrders() { local -n params=$1