-
Notifications
You must be signed in to change notification settings - Fork 93
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
Query Finance API for Stocks #152
Conversation
Thanks for opening your first pull request in this repository! Someone will review it when they have a chance. In the mean time, please be sure that you've handled the following things, to make the review process quicker and easier:
Thank you again for your contributions! 👍 |
utils/portfolio.hpp
Outdated
int PortFolio(const std::string& stock0, | ||
const std::string& stock1, | ||
const std::string& stock2, | ||
const std::string& stock3, |
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.
I would use a list/vector here, to make it possible to select an arbitrary number of stocks.
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.
Fair point, but for pArgs = PyTuple_New(???);
how do we solve this dilemma?
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.
vector.size()
should work right?
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.
Nvm
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.
Yeah figured it a bit late, sorry ;D
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.
No worries, I think it's still early for you?
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.
It's 08;00AM :) ,
How about we allow the user to choose the finance API as well and not restrict it to just Yahoo? I did some digging in the code and found the following are available: expected_source = [
"yahoo",
"iex",
"iex-tops",
"iex-last",
"iex-last",
"bankofcanada",
"stooq",
"iex-book",
"enigma",
"fred",
"famafrench",
"oecd",
"eurostat",
"nasdaq",
"quandl",
"moex",
"tiingo",
"yahoo-actions",
"yahoo-dividends",
"av-forex",
"av-forex-daily",
"av-daily",
"av-daily-adjusted",
"av-weekly",
"av-weekly-adjusted",
"av-monthly",
"av-monthly-adjusted",
"av-intraday",
"econdb",
"naver",
] If the user enters the wrong data source the Python interface throws |
Also, perhaps we should store generated csv file in a designated folder like "temp/" or something, no? |
Maybe it makes sense the user can specify a path + filename and if the path doesn't exist we create it.
Sounds like a good idea to me, in the end it's more about the optimization method, but it's nice to have a solid data generation method as well.
Ideally yes, put sometimes the exception are not handed over to the notebook, but I'm not worried about that if we don't handle certain corner cases, as I mentioned above the main focus of the notebook is on the optimization method. |
- any data source is valid
Great suggestions, have applied them all. The style check errors seem to be independent of this PR. Do you mind confirming this? |
@mlpack-jenkins test this please |
A jenkins job I haven't updated, looks like it works now as expected. |
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.
Thanks for putting everything together, looks good to me.
# Drop the first row since it contains NaN. | ||
returns = returns.iloc[1:] | ||
# Normalize dates. | ||
returns['Date'] = returns['Date'].apply(lambda x : x.strftime('%Y%m%d')) |
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.
Nice!
Great, once this is merged. I'll immediately start working on the notebook. Super-easy, barely an inconvenience! |
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.
Second approval provided automatically after 24 hours. 👍
Thanks again! |
@zoq This PR is from our discussion yesterday. Let me know if I'm missing something? Thanks