Fix already done trade detecation and e-mail address in deadswitch call
This commit is contained in:
@@ -44,7 +44,7 @@ longSymbol=$(jq -r '.symbol' < temp/longLeg.json)
|
||||
log "Long Symbol: _${longSymbol}_ Strike: _${longStrike}_ Bid: _${longBid}_ Ask: _${longAsk}_" info
|
||||
|
||||
#Check if this order has already been submitted.
|
||||
./getOrders.sh | grep '\(WORKING\|FILLED\),'${longSymbolC:0:12} > temp/existingOrders.$$
|
||||
./getOrders.sh | grep '\(WORKING\|FILLED\),'"${longSymbol:0:12}" > temp/existingOrders.$$
|
||||
if [[ $(wc -l < temp/existingOrders.$$) -eq 0 ]];then
|
||||
log "Not Yet traded, continuing" info
|
||||
else
|
||||
|
||||
@@ -74,7 +74,7 @@ priceOffset=0.00 # try to get a little better price
|
||||
# 2) Round to the Coloses full number
|
||||
# 3) Divide by 20
|
||||
priceOpen=$(echo "scale=2; exact=((${shortBidC}+${shortAskC})/2) + ((${shortBidP}+${shortAskP})/2) - ((${longBidC}+${longAskC})/2) - ((${longBidP}+${longAskP})/2) + ${priceOffset}; scale=0; round5=exact*20/1; scale=2; round5/20" | bc)
|
||||
priceOpen=4.80 # All nice calculating a price, but I want those to be filled and reasonably, they will (hopefully) be filled at 475
|
||||
priceOpen=4.75 # All nice calculating a price, but I want those to be filled and reasonably, they will (hopefully) be filled at 475
|
||||
|
||||
orderJson=$(jq -c <<-EOM
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ longSymbol=$(jq -r '.symbol' < temp/longLeg.json)
|
||||
log "Long Symbol: _${longSymbol}_ Strike: _${longStrike}_ Bid: _${longBid}_ Ask: _${longAsk}_" info
|
||||
|
||||
#Check if this order has already been submitted.
|
||||
./getOrders.sh | grep '\(WORKING\|FILLED\),'${longSymbolC:0:12} > temp/existingOrders.$$
|
||||
./getOrders.sh | grep '\(WORKING\|FILLED\),'"${longSymbol:0:12}" > temp/existingOrders.$$
|
||||
if [[ $(wc -l < temp/existingOrders.$$) -eq 0 ]];then
|
||||
log "Not Yet traded, continuing" info
|
||||
else
|
||||
|
||||
@@ -12,7 +12,7 @@ if [[ ${ageInSec} -gt 600 ]]; then
|
||||
-d "grant_type=refresh_token&refresh_token=$(<refresh_token.dat)" > temp/accessTokenReqResp.$$.json
|
||||
jq -e -r .access_token temp/accessTokenReqResp.$$.json > access_token.dat
|
||||
if [[ $? -ne 0 ]]; then
|
||||
curl -d "" -X POST "https://deadswitch.kawomi.com/api/v1?topic=trade.schwab.error.getNewAccessToken&secs=1&email=joe@kawomi.com"
|
||||
curl -s -d "" -X POST "https://deadswitch.kawomi.com/api/v1?topic=trade.schwab.error.getNewAccessToken&secs=1&email=joerg.tretter@gmail.com"
|
||||
throw "ERROR: GETTING THE ACCESS TOKEN FAILED! $(<temp/accessTokenReqResp.$$.json)" err
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -37,7 +37,7 @@ done
|
||||
|
||||
if [[ -e temp/hadErrors.$$.tmp ]]; then
|
||||
rm temp/hadErrors.$$.tmp
|
||||
curl -d "" -X POST "https://deadswitch.kawomi.com/api/v1?topic=trade.schwab.error.recordAllSymbolsSingleRun&secs=1&email=joe@kawomi.com"
|
||||
curl -s -d "" -X POST "https://deadswitch.kawomi.com/api/v1?topic=trade.schwab.error.recordAllSymbolsSingleRun&secs=1&email=joerg.tretter@gmail.com"
|
||||
fi
|
||||
|
||||
log "Finished"
|
||||
|
||||
Reference in New Issue
Block a user