BITPANDA(-PRO) now ONETRADING
This commit is contained in:
parent
2236ac65f7
commit
2f41d7cd19
@ -1,14 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function bitpanda-api-call {
|
function onetrading-api-call {
|
||||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||||
local method=$1
|
local method=$1
|
||||||
local call=$2
|
local call=$2
|
||||||
local params=$3
|
local params=$3
|
||||||
|
|
||||||
if [ -s /dabo/.bitpanda-secrets ]
|
if [ -s /dabo/.onetrading-secrets ]
|
||||||
then
|
then
|
||||||
. /dabo/.bitpanda-secrets
|
. /dabo/.onetrading-secrets
|
||||||
else
|
else
|
||||||
g_echo_error "No secrets file found"
|
g_echo_error "No secrets file found"
|
||||||
return 1
|
return 1
|
||||||
@ -17,8 +17,6 @@ function bitpanda-api-call {
|
|||||||
echo "${call}" | egrep -q "/account/" && local f_token="-H 'Authorization: Bearer ${API_TOKEN}'"
|
echo "${call}" | egrep -q "/account/" && local f_token="-H 'Authorization: Bearer ${API_TOKEN}'"
|
||||||
echo "curl -s -X ${method} --url https://api.onetrading.com/${call} $f_token -H 'Accept: application/json' ${params}" >${g_tmp}/API_CMD
|
echo "curl -s -X ${method} --url https://api.onetrading.com/${call} $f_token -H 'Accept: application/json' ${params}" >${g_tmp}/API_CMD
|
||||||
echo "curl -s -X ${method} --url https://api.onetrading.com/${call} -H 'Accept: application/json'" >${g_tmp}/API_CMD_WO_KEY
|
echo "curl -s -X ${method} --url https://api.onetrading.com/${call} -H 'Accept: application/json'" >${g_tmp}/API_CMD_WO_KEY
|
||||||
#echo "curl -s -X ${method} --url https://api.exchange.bitpanda.com/${call} $f_token -H 'Accept: application/json' ${params}" >${g_tmp}/API_CMD
|
|
||||||
#echo "curl -s -X ${method} --url https://api.exchange.bitpanda.com/${call} -H 'Accept: application/json'" >${g_tmp}/API_CMD_WO_KEY
|
|
||||||
g_runcmd g_retrycmd sh ${g_tmp}/API_CMD >${g_tmp}/API_CMD_OUT 2>&1
|
g_runcmd g_retrycmd sh ${g_tmp}/API_CMD >${g_tmp}/API_CMD_OUT 2>&1
|
||||||
|
|
||||||
if egrep -q -i '^{"code":|error' ${g_tmp}/API_CMD_OUT
|
if egrep -q -i '^{"code":|error' ${g_tmp}/API_CMD_OUT
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function bitpanda_get_token_info {
|
function onetrading_get_token_info {
|
||||||
|
|
||||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||||
|
|
||||||
@ -7,16 +7,16 @@ function bitpanda_get_token_info {
|
|||||||
f_QUANTITY=$3
|
f_QUANTITY=$3
|
||||||
|
|
||||||
# cleanup cache
|
# cleanup cache
|
||||||
[ -s BITPANDA_TOKEN_INFO_CMD_OUT ] && find BITPANDA_TOKEN_INFO_CMD_OUT -mmin +60 -or -empty -delete
|
[ -s ONETRADING_TOKEN_INFO_CMD_OUT ] && find ONETRADING_TOKEN_INFO_CMD_OUT -mmin +60 -or -empty -delete
|
||||||
if ! [ -s BITPANDA_TOKEN_INFO_CMD_OUT ]
|
if ! [ -s ONETRADING_TOKEN_INFO_CMD_OUT ]
|
||||||
then
|
then
|
||||||
bitpanda-api-call GET public/v1/instruments >BITPANDA_TOKEN_INFO_CMD_OUT
|
onetrading-api-call GET public/v1/instruments >ONETRADING_TOKEN_INFO_CMD_OUT
|
||||||
cat ${g_tmp}/API_CMD_OUT >BITPANDA_TOKEN_INFO_CMD_OUT
|
cat ${g_tmp}/API_CMD_OUT >ONETRADING_TOKEN_INFO_CMD_OUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local f_ASSET_PRECISION=$(cat BITPANDA_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .amount_precision")
|
local f_ASSET_PRECISION=$(cat ONETRADING_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .amount_precision")
|
||||||
local f_CURRENCY_PRECISION=$(cat BITPANDA_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .quote.precision")
|
local f_CURRENCY_PRECISION=$(cat ONETRADING_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .quote.precision")
|
||||||
local f_ASSET_MINSIZE=$(cat BITPANDA_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .min_size")
|
local f_ASSET_MINSIZE=$(cat ONETRADING_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .min_size")
|
||||||
local f_ASSET_PRICE=$(tail -n1 "asset-histories/${f_ASSET}${f_CURRENCY}.history.csv" | cut -d"," -f2)
|
local f_ASSET_PRICE=$(tail -n1 "asset-histories/${f_ASSET}${f_CURRENCY}.history.csv" | cut -d"," -f2)
|
||||||
|
|
||||||
if [ -n "$f_QUANTITY" ] && [ -n "$f_ASSET_PRICE" ]
|
if [ -n "$f_QUANTITY" ] && [ -n "$f_ASSET_PRICE" ]
|
||||||
|
Loading…
Reference in New Issue
Block a user