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

Strip all fields for StockCodeInfo #32

Merged
merged 2 commits into from
Mar 14, 2018
Merged

Conversation

ianlini
Copy link
Contributor

@ianlini ianlini commented Mar 11, 2018

Some codes in the CSV files has white space after the codes, 4148 for example:
股票,4148 ,全宇生技-KY,KYG0232P1072,2017/06/08,上市,生技醫療業,ESVUFR
in the twse_equities.csv.
Because of this, Stock('4148') cannot get the correct result.
It's actually a problem in the original CSV files, but I don't know where you got them, so I don't change them.

It would be better to validate and handle all the values in the files or the data we fetch.
Because I actually have my own database for the stock information, I only do a workaround here so that I can use Stock().

twstock/codes.py Outdated
@@ -29,11 +29,12 @@ def read_csv(path, types):
csvfile.readline()
for row in reader:
row = ROW(*row)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we strip the code at this line like ROW(*row.strip()) so that we don't need to deal with other parts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean strip all fields?
I will do that later.

@ianlini ianlini changed the title strip code Strip code Mar 12, 2018
@mlouielu mlouielu assigned mlouielu and ianlini and unassigned mlouielu Mar 12, 2018
@mlouielu mlouielu added the bug label Mar 12, 2018
@ianlini ianlini changed the title Strip code Strip all fields for StockCodeInfo Mar 12, 2018
@mlouielu
Copy link
Owner

I'll merge this PR. Again, thanks @ianlini for your contributions!

@mlouielu mlouielu merged commit 80320e0 into mlouielu:master Mar 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants