bbgo_origin/scripts/max.sh

76 lines
1.6 KiB
Bash
Raw Normal View History

2020-12-01 12:01:50 +00:00
#!/bin/bash
source scripts/maxapi.sh
command=$1
shift
case "$command" in
market)
market=$1
side=$2
volume=$3
if [[ $# < 3 ]] ; then
echo "$0 market [market] [side] [volume]"
exit
fi
declare -A order_params=()
order_params[market]=$market
order_params[side]=$side
order_params[volume]=$volume
order_params[ord_type]="market"
submitOrder order_params
;;
limit)
market=$1
side=$2
price=$3
volume=$4
2020-12-01 12:03:54 +00:00
if [[ $# < 4 ]] ; then
echo "$0 limit [market] [side] [price] [volume]"
exit
fi
2020-12-01 12:01:50 +00:00
declare -A order_params=()
order_params[market]=$market
order_params[side]=$side
order_params[price]=$price
order_params[volume]=$volume
order_params[ord_type]="limit"
submitOrder order_params
;;
me)
me
;;
2020-12-01 12:07:13 +00:00
# open orders
open)
2020-12-01 12:03:54 +00:00
if [[ $# < 1 ]] ; then
2020-12-01 12:07:13 +00:00
echo "$0 open [market]"
2020-12-01 12:03:54 +00:00
exit
fi
2020-12-01 12:01:50 +00:00
market=$1
declare -A orders_params=()
orders_params[market]=$market
2020-12-01 12:16:40 +00:00
myOrders orders_params | jq -r '.[] | "\(.id) \(.market) \(.side) \(.price) \t \(.volume) \(.state)"'
2020-12-01 12:01:50 +00:00
;;
trades)
2020-12-01 12:03:54 +00:00
if [[ $# < 1 ]] ; then
echo "$0 trades [market]"
exit
fi
2020-12-01 12:01:50 +00:00
market=$1
declare -A trades_params=()
trades_params[market]=$market
2020-12-01 12:16:40 +00:00
myTrades trades_params | jq -r '.[] | "\(.id) \(.market) \(.side) \(.price) \t \(.volume) fee = \(.fee) \(.fee_currency)"'
2020-12-01 12:01:50 +00:00
;;
esac