Skip to content
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

Add data cleaning to Quote DataFrames #78

Closed
d3an opened this issue Jan 10, 2022 · 0 comments · Fixed by #80
Closed

Add data cleaning to Quote DataFrames #78

d3an opened this issue Jan 10, 2022 · 0 comments · Fixed by #80
Assignees

Comments

@d3an
Copy link
Owner

d3an commented Jan 10, 2022

Refactor CleanScreenerDataFrame to support both Screener df's and Quote df's.

@d3an d3an self-assigned this Jan 10, 2022
@d3an d3an closed this as completed in #80 Jan 13, 2022
d3an added a commit that referenced this issue Jan 13, 2022
### Change to Function Signature

`GetQuotes` now returns `(Results, error)`. The error here should either be `nil` or `fmt.Errorf("error failed to generate rows from quote KVP map")`.

`Results` is constructed as `Results{Data: *dataframe.DataFrame, Warnings: []Warning, Errors: []Error}`. As follows:
  - `Data` is the previously returned DataFrame
  - `Warnings` is a slice of new `Warning` structs. An example `Warning` is given by `Warning{Ticker: "INVALID", Error: fmt.Errorf("resource not found")}`. Right now, warnings only indicate that Finviz does not support the given ticker.
  - `Errors` is a slice of new `Error` structs. An example `Error` is given by `Error{Ticker: "SNAP", Error: fmt.Errorf(...)}`. Errors could occur if Finviz has placed you on a block list (usually done via Cloudflare) or could be an internal library error. 

If a Warning or Error exists for a Ticker, then the returned DataFrame will not have a row for that Ticker. The three sets, i.e., Data, Warnings, and Errors, are mutually exclusive.

### Other Changes

- Added `Exchange` column to returned DataFrame.
- Fixed a bug that sometimes returned `S&P,500` as a stock's Index; now returns `S&P500`.
- Added data cleaning to DataFrame results, i.e., most columns should now correspond to their actual data type. 
- Added support for backoff algorithm on request frequency.

Closes #78, #79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant