-
Notifications
You must be signed in to change notification settings - Fork 0
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
Download adapters and components #52
base: develop
Are you sure you want to change the base?
Conversation
…sses feat(ticker splitter): component that splits tickers in groups test(ticker splitter)
… a list of possible parameter values
fix(Parameter validator): items() instead of enumerate() fix(Parameter validator): not more checking parameter is defined by default fix(match param gen): now returns the generated method test(Parameter validator)
… by adapter's parameters style(adapters): formatted file
…ve for all sub-components feat(Tradier): started adapter translation
feat(TickerSplitter): parametrised output ticker groups name feat(Request): added debug mode fix(Request): fixed status code, fixed json response test(tradier_timeseries)
feat(TickerExtractor): added type and length checks test(TickerExtractor)
feat(Pram valid.): added new datetime validation test(param valid): added dt valid. tests
del(TradierTimeseries)
… reuse the same adapter for different downloads
Ayo bro let me review that for you |
Ayo thanks bro |
fix: missing exception string format parameter
Still hard to read and decipher, needs some work. |
refactor: applied autopeep8 formatting
refactor: Adapter init initialises components list if not defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems sort of fine overall, I only have two doubts I pointed out. Also I believe docstrings could be a bit more generous with explanations/examples. I don't think I would have understood what some of the components do if I could not have looked directly into the code.
feat: changed tradier metadata to adapters
fix: time_handler handles non-existing seconds feat: Renaming component
… first parameter anymore
fix: date validation properly uses required fix: datetimetoepoch component won't translate datetime if it's None
test: tradier checking provider and ticker in atoms test: fixed some adapter component tests
fix: Tradier checking header presence before using it
…nt lists delete: unused components, for clarity rename: TickerChunkComp to ChunkerComp (more generic) move: Parameter validation methods factory to validators file
refactor: SubAdapter does not make a difference between prep and ret components
test: updated components tests
Something that will need some work is how to pass a limiter to the request component at initialization, as of now the limiter is instantiated when the file is parsed and cannot be changed. |
cleanup: removed RealtimeDownloader and TradierRealtime
Premise
The download phase was very much specific for each provider, leading to difficulty in spotting bugs, hard to test code, and multiple failure points.
Features
feat(Adapter): Class that holds components, performs the prepare, retrieve and atomize phases calling each one of its components per phase.
feat(AdapterComponent): Implements one or more of the three phases of the download, just like a middleware. They should be as generic as possible, making them harder to test but suitable for more providers.
Components
Parameter validation: Every downloader needs parameter validation because the provider only supports some values (eg. interval "1min" or "1m"), so it's a component that given the parameter name, and a validation method applies the method to check for validity of the parameter's value.
Request: Performs bare HTTP requests, taking values from parameters or constant ones given in the constructor. It can build a URL by using
BASE_URL + url parameters + '?' + query parameters
(not done manually, but by the requests module). Also supports HTTP headers, request timeout time, automatic JSON of the response, request limiter."Chunker": Splits an array of elements in an array of chunks of a given maximum size. eg
max_size=3
then[A, B, C, D, E] - > [[A, B, C], [D, E]]
. Used when the provider supports multiple tickers but sets a maximum number of them per request.Notes
I also wanted to keep downloaders and the filtering/streaming structures separated, in order for the downloader part to be an MVP.
Picture of something weird