-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streaming code update for different format in the response from schwab #33
Comments
This is the response from {
"accounts": [
{
"accountNumber": "12345678",
"primaryAccount": false,
"type": "BROKERAGE",
"nickName": "XXXXXXX",
"displayAcctId": "...xxx",
"autoPositionEffect": false,
"accountColor": "Green"
},
{
"accountNumber": "23456789",
"primaryAccount": false,
"type": "BROKERAGE",
"nickName": "xxxxxxxxx",
"displayAcctId": "...xxx",
"autoPositionEffect": false,
"accountColor": "Green"
},
{
"accountNumber": "34567890",
"primaryAccount": false,
"type": "BROKERAGE",
"nickName": "xxxxxxxxxx",
"displayAcctId": "...xxx",
"autoPositionEffect": false,
"accountColor": "Blue"
},
{
"accountNumber": "45678901",
"primaryAccount": false,
"type": "BROKERAGE",
"nickName": "xxxxxxxx",
"displayAcctId": "...xxx",
"autoPositionEffect": false,
"accountColor": "Green"
},
{
"accountNumber": "56789012",
"primaryAccount": true,
"type": "BROKERAGE",
"nickName": "xxxxxxxxx",
"displayAcctId": "...xxx",
"autoPositionEffect": false,
"accountColor": "Green"
}
],
"streamerInfo": [
{
"streamerSocketUrl": "wss://streamer-api.schwab.com/ws",
"schwabClientCustomerId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"schwabClientCorrelId": "xxxxxxxx",
"schwabClientChannel": "N9",
"schwabClientFunctionId": "APIAPP"
}
],
"offers": [
{
"level2Permissions": true,
"mktDataPermission": "NP"
}
]
} |
This is now fixed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried to use the streaming feature from schwab-py and encountered some errors during the initialization. These are the issues I found which I fixed locally and then the streaming initialization went fine.
The below issues are because of the difference in the response from the Schwab's API as compared to the TDA API.
At https://github.com/alexgolec/schwab-py/blob/main/schwab/streaming.py#L215, it should be changed like this:
At https://github.com/alexgolec/schwab-py/blob/main/schwab/streaming.py#L229 , it should be changed like this:
The reason is that Schwab API returns only one object in the
streamerInfo
array even though there are multiple accounts.With the above changes, I was able to use schwab-py to start the streaming and subscribe to quote, candle and l2 data.
The text was updated successfully, but these errors were encountered: