Compare commits
No commits in common. "10493f4bcd9983f4d76d99fa0911144337d6def4" and "0f62e2ffbd6c3402f07b75e8b1d2b5c1841f8f98" have entirely different histories.
10493f4bcd
...
0f62e2ffbd
@ -60,7 +60,7 @@ select(.status==\"open\") |
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
cat CCXT_ORDERS_*${CURRENCY} >CCXT_ORDERS 2>/dev/null
|
cat CCXT_ORDERS_*${CURRENCY} >CCXT_ORDERS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,7 @@ function order {
|
|||||||
local f_amount=$2 # amount in $CURRENCY / if crypto_amount:XXX then amount in crypto
|
local f_amount=$2 # amount in $CURRENCY / if crypto_amount:XXX then amount in crypto
|
||||||
local f_side=$3 # buy/sell long/short
|
local f_side=$3 # buy/sell long/short
|
||||||
local f_price=$4 # price for limit order - if not given do market order
|
local f_price=$4 # price for limit order - if not given do market order
|
||||||
local f_stoploss=$5
|
local f_params f_type
|
||||||
local f_takeprofit=$6
|
|
||||||
local f_params="params={"
|
|
||||||
local f_type
|
|
||||||
|
|
||||||
|
|
||||||
### validity checks ###
|
### validity checks ###
|
||||||
@ -81,24 +78,14 @@ function order {
|
|||||||
f_ccxt "$STOCK_EXCHANGE.setLeverage($LEVERAGE, '$f_symbol')" || return 1
|
f_ccxt "$STOCK_EXCHANGE.setLeverage($LEVERAGE, '$f_symbol')" || return 1
|
||||||
|
|
||||||
# define margibn mode isolated/cross
|
# define margibn mode isolated/cross
|
||||||
f_params="${f_params}'marginMode': '$MARGIN_MODE', "
|
f_params="params={'marginMode': '$MARGIN_MODE'}"
|
||||||
|
|
||||||
else
|
else
|
||||||
# short/sell not possible in spot market
|
# short/sell not possible in spot market
|
||||||
[[ $f_side =~ ^sell$ ]] || return 1
|
[[ $f_side =~ ^sell$ ]] || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add stoploos and take profit if available
|
|
||||||
[ -n "$f_stoploss" ] && f_params="${f_params}'stopLossPrice': '$f_stoploss', "
|
|
||||||
[ -n "$f_takeprofit" ] && f_params="${f_params}'takeProfitPrice': '$f_takeprofit', "
|
|
||||||
|
|
||||||
# end up params syntax with "}"
|
|
||||||
f_params="${f_params}}"
|
|
||||||
|
|
||||||
# do the order
|
# do the order
|
||||||
local f_order="symbol='${f_symbol}', type='$f_type', price=$f_price, amount='${f_amount}', side='${f_side}', ${f_params}"
|
f_ccxt "print($STOCK_EXCHANGE.createOrder(symbol='${f_symbol}', type='$f_type', price=$f_price, amount='${f_amount}', side='${f_side}', ${f_params}))" || return 1
|
||||||
echo "$f_order" | notify.sh -s "ORDER"
|
|
||||||
f_ccxt "print($STOCK_EXCHANGE.createOrder(${f_order}))" || return 1
|
|
||||||
|
|
||||||
# refresh positions
|
# refresh positions
|
||||||
get_positions
|
get_positions
|
||||||
|
Loading…
Reference in New Issue
Block a user