Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to select stocks from my csv file fetcher

Good day,

I have created a script that will select and rank the stocks for every trading day. How can I do the backtest as I just want to code to read the highest ranking stock in the list when I sold off the stock in the portfolio? I need the code that will run my script (written in python) each day. If I still hold 3 stocks in the portfolio, no stock from the list will be bought. If I sold off one of the stock in the portfolio, I will buy the highest ranking form the list i created on the previous trading day. If I sold off two stocks, I will replace top two ranking stock in the list.

Thanks

3 responses

The steps is as below:
1. Query and analysis all stocks from Yahoo API every trading day.
2. Create a list in csv for the stocks to buy for that day
3. If the stocks of my portfolio has drop 5%, I will sell and replace for the top pick stocks from my list

I am not sure if this type of stocks selection is allow thru Quantopian because I am not limit myself fix to a stock and use MACD crossover or other indicators. I will choose from all stocks from a stock exchange.
Hope to hear from you guys

Hi Ching
I am new to Quantopian and while I was looking for something on the community forum came across your question.
I have been playing around with fetcher and should be able to help you if you are still looking for the answer given you posted almost two years ago.
Let me know.
Best wishes
Savio

Hi Savio and Ching,

I suggest checking out the My Data feature which will allow you to upload your own data for use with pipeline. The live component will allow you to upload new data nightly, and we'll take care of the point-in-time capture of the data just like we do with partner vendors.

Savio, do you mind sharing some of your fetcher API endpoints with me via [email protected]? We will be adding a similar API end point to the My Data feature, I would like to understand the data manipulations you are performing via pre_func and post_func.

If you are interested in joining the alpha pilot, please let us know more about your data and use case

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.