Fix already done trade detecation and e-mail address in deadswitch call

This commit is contained in:
2024-10-01 16:28:14 -05:00
parent b8b99a8a9e
commit bbb9d5dce6
5 changed files with 5 additions and 5 deletions

View File

@@ -44,7 +44,7 @@ longSymbol=$(jq -r '.symbol' < temp/longLeg.json)
log "Long Symbol: _${longSymbol}_ Strike: _${longStrike}_ Bid: _${longBid}_ Ask: _${longAsk}_" info log "Long Symbol: _${longSymbol}_ Strike: _${longStrike}_ Bid: _${longBid}_ Ask: _${longAsk}_" info
#Check if this order has already been submitted. #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 if [[ $(wc -l < temp/existingOrders.$$) -eq 0 ]];then
log "Not Yet traded, continuing" info log "Not Yet traded, continuing" info
else else

View File

@@ -74,7 +74,7 @@ priceOffset=0.00 # try to get a little better price
# 2) Round to the Coloses full number # 2) Round to the Coloses full number
# 3) Divide by 20 # 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=$(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 orderJson=$(jq -c <<-EOM
{ {

View File

@@ -49,7 +49,7 @@ longSymbol=$(jq -r '.symbol' < temp/longLeg.json)
log "Long Symbol: _${longSymbol}_ Strike: _${longStrike}_ Bid: _${longBid}_ Ask: _${longAsk}_" info log "Long Symbol: _${longSymbol}_ Strike: _${longStrike}_ Bid: _${longBid}_ Ask: _${longAsk}_" info
#Check if this order has already been submitted. #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 if [[ $(wc -l < temp/existingOrders.$$) -eq 0 ]];then
log "Not Yet traded, continuing" info log "Not Yet traded, continuing" info
else else

View File

@@ -12,7 +12,7 @@ if [[ ${ageInSec} -gt 600 ]]; then
-d "grant_type=refresh_token&refresh_token=$(<refresh_token.dat)" > temp/accessTokenReqResp.$$.json -d "grant_type=refresh_token&refresh_token=$(<refresh_token.dat)" > temp/accessTokenReqResp.$$.json
jq -e -r .access_token temp/accessTokenReqResp.$$.json > access_token.dat jq -e -r .access_token temp/accessTokenReqResp.$$.json > access_token.dat
if [[ $? -ne 0 ]]; then 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 throw "ERROR: GETTING THE ACCESS TOKEN FAILED! $(<temp/accessTokenReqResp.$$.json)" err
fi fi
fi fi

View File

@@ -37,7 +37,7 @@ done
if [[ -e temp/hadErrors.$$.tmp ]]; then if [[ -e temp/hadErrors.$$.tmp ]]; then
rm temp/hadErrors.$$.tmp 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 fi
log "Finished" log "Finished"