Closed gporter0205 closed 3 years ago
@gporter0205 Thanks for the PR. What is the issue with the JSON that makes it necessary to parse things manually? I'm not a huge fan of Jackson as it's very over-engineered, but OTOH, there is almost always a way to customize the parsing with a flag or settings to avoid having to deal with lower-level JsonNodes.
Also, would you squash you commits down into a single commit? It's hard to see what has actually changed when you make revisions to previous commits.
ok, I squashed the commits into one. I'll make sure I do that prior to issuing any future pull requests.
Here's a sample of the json return from TDA market hours. It's basically using the value as a key in the first two levels of the json. I'm still using Jackson to parse it, but using JsonNode to navigate past the first two levels. If there's a better way to parse it, then I'm open to ideas. I struggled getting the ObjectMapper to do anything with it except choke on it.
_{ "future": { "DFE": { "date": "2021-06-07", "marketType": "FUTURE", "exchange": "NYMEX", "category": "Energy", "product": "DFE", "productName": "kern river natural gas (platts iferc) fixed price futures", "isOpen": true, "sessionHours": { "preMarket": [ { "start": "2021-06-07T17:45:00-04:00", "end": "2021-06-07T18:00:00-04:00" } ], "regularMarket": [ { "start": "2021-06-07T18:00:00-04:00", "end": "2021-06-08T17:15:00-04:00" } ] } }, "equity": { "EQ": { "date": "2021-06-07", "marketType": "EQUITY", "exchange": "NULL", "category": "NULL", "product": "EQ", "productName": "equity", "isOpen": true, "sessionHours": { "preMarket": [ { "start": "2021-06-07T07:00:00-04:00", "end": "2021-06-07T09:30:00-04:00" } ], "regularMarket": [ { "start": "2021-06-07T09:30:00-04:00", "end": "2021-06-07T16:00:00-04:00" } ], "postMarket": [ { "start": "2021-06-07T16:00:00-04:00", "end": "2021-06-07T20:00:00-04:00" } ] } } }, "bond": { "BON": { "date": "2021-06-07", "marketType": "BOND", "exchange": "NULL", "category": "NULL", "product": "BON", "productName": "bond", "isOpen": true, "sessionHours": { "preMarket": [ { "start": "2021-06-07T04:00:00-04:00", "end": "2021-06-07T08:00:00-04:00" } ], "regularMarket": [ { "start": "2021-06-07T08:00:00-04:00", "end": "2021-06-07T17:00:00-04:00" } ], "postMarket": [ { "start": "2021-06-07T17:00:00-04:00", "end": "2021-06-07T20:00:00-04:00" } ] } } } }
_
@gporter0205 I merged these changes manually. The only thing I reverted was a small change you had made to the way Accounts were parsed in TdaJsonParser. This broke a unit test (not integration), so I'm not sure if it was a mistake or something else. If there was an issue you're having with getAccounts method, let me know.
I forked the project and added support for the TDA market hours service. Unfortunately, that service doesn't return valid JSON so I had to take a different parsing approach. Take a look and if you'd like to use it then great. If not, then I'll just run off of my fork. Either way, thanks for putting this library together. It makes called TDA API a LOT easier.