Initial checkin
This commit is contained in:
71
README.md
Normal file
71
README.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# Charls Schwab Quote recording bot
|
||||
|
||||
## Expiry
|
||||
* Access token expires in 30 Min.
|
||||
* Refresh token expires in ?
|
||||
|
||||
## File - Descriptions
|
||||
### **`appCredentials.dat`**
|
||||
* Base64 encoded App Credentials - `"{app key}:{secret}"`
|
||||
* Manually maintained
|
||||
|
||||
### **`appKey.dat`**
|
||||
* only the application's AppKey
|
||||
* Manually maintained
|
||||
|
||||
#### **`allSymbols.json`**
|
||||
* List of all Symbols to get Data for
|
||||
* Manually maintained
|
||||
|
||||
### **`access_token.dat`**
|
||||
* Current Access Token
|
||||
* written by `getNewAccessToken.sh`
|
||||
|
||||
### **`accessTokenReqResp.json`**
|
||||
* Full JSON response of the last Access Token request
|
||||
* written by `getNewAccessToken.sh`
|
||||
|
||||
### **`refresh_token.dat`**
|
||||
* Current refresh token
|
||||
* written by `getNewRefreshToken.sh`
|
||||
|
||||
### **`refreshTokenReqResp.json`**
|
||||
* Full JSON response of the last Refresh Token request
|
||||
* written by `getNewRefreshToken.sh`
|
||||
|
||||
### **`codeReceiveServer.py`**
|
||||
* Python HTTPS web server to receive and output the Authentication code from the Schwab Website callback
|
||||
* This web server only runs temporarily and ends after receiving a request
|
||||
|
||||
### **`cert.pem`**
|
||||
* self signed certificate for the temporary HTTPS server that receives the code.
|
||||
* Manually maintained with:
|
||||
`openssl req -new -x509 -keyout cert.pem -out cert.pem -days 365 -nodes`
|
||||
*Answer all questions hitting enter.*
|
||||
|
||||
## **`data/`**
|
||||
* Folder containing date sub-folders for the output data
|
||||
* Created and maintained by `recordSingleSymbolSingleRun.sh`
|
||||
|
||||
### **`getNewAccessToken.sh`**
|
||||
* Gets a new access Token and saves it to file `access_token.dat`
|
||||
|
||||
### **`getNewRefreshToken.sh`**
|
||||
* Gets a new refresh Token and saves it to file `refresh_token.dat`
|
||||
|
||||
### **`recordAllSymbolsSingleRun.sh`**
|
||||
* Runs `recordSingleSymbolSingleRun.sh` for every Symbol in file `allSymbols.json`
|
||||
|
||||
### **`recordQuoteSingleSymbolSingleRun.sh`**
|
||||
* requests stock quote data for a single symbol and writes output into the `data/*` Folder structure.
|
||||
|
||||
### **`recordOptionChainSingleSymbolSingleRun.sh`**
|
||||
* requests option chain data for a single symbol and writes output into the `data/*` Folder structure.
|
||||
|
||||
|
||||
# NEW CHANGES, NEED TO DOCUMENT
|
||||
jq <<< '{ "numberOfContracts":'$(( $(jq '.numberOfContracts' < ITM.json) + $(jq '.numberOfContracts' < OTM.json) ))' }' > numberOfContracts.tmp
|
||||
jq '. | del(.numberOfContracts) | map_values(select(type!="object"))' < ITM.json > CommonDetail.tmp
|
||||
jq '. | map_values(select(type=="object"))' < ITM.json > ITMo.tmp
|
||||
jq '. | map_values(select(type=="object"))' < OTM.json > OTMo.tmp
|
||||
jq -s '.[0] * .[1] * .[2] * .[3]' numberOfContracts.tmp CommonDetail.tmp ITMo.tmp OTMo.tmp | less
|
||||
Reference in New Issue
Block a user