Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Difficult time pulling in API (Kimono Labs)

Algo Conditionals
## if between 0-3% above 52 week low
##AND not within 5 days of earnings
##AND RSI is super/duper oversold between 20-30
##AND net profit margin +0.01
##AND beta is between 1-2

It looks like the best tool to pull in my data is use FinViz stock screener to get down to the 20-50 stocks a day in my universe. The crawler I'm using to do that is Kimono (from the most recent YC batch), super cool site chrome extension that let's you make an API out of any website!

So my question is, can I use code like below to pull the data? This is the API code provided by Kimono to able to pull the data into your build.

I feel like my code isn't working because it isn't within the fetch_csv functionality..

"results = json.load(urllib.urlopen("http://www.kimonolabs.com/api/csv/5k0ncr26?apikey=53100de28f37cb4c582eea1b3c7dea1d", / date_column = 'date', pre_func = preview,
universe_func=my_universe)"

A few other reference points

direct URL to .csv data: http://www.kimonolabs.com/api/csv/5k0ncr26?apikey=53100de28f37cb4c582eea1b3c7dea1d

Kimono API code with key, they provide:
import json
import urllib

results = json.load(urllib.urlopen("http://www.kimonolabs.com/api/5k0ncr26?apikey=53100de28f37cb4c582eea1b3c7dea1d"))

5 responses

Hi Simon,

That's cool, I have played around with the 'kimonify' functionality a little (it does seem really cool!), but I haven't successfully directly linked the API results to fetcher yet. I think the problem is that fetcher needs a URL to the .csv file, not to a web-page with the csv data displayed on it. Is there a way in Kimono to get a link that's directly to the .csv data, such that when you click the link the .csv automatically downloads?

The other issue I foresee is that for live trading Fetcher needs to maintain persistant historical data rather than point to a 'memoryless' data set that updates each day. Do you know if Kimono will let you append your new stock screen results each day (with date labels) or does it just overwrite your prior results? If it can't build a historical file then we'll probably need to put one more intermediate step in between Kimono and Fetcher where we append new universe snapshots to a dropbox hosted csv file as the screen evolves.

I love to idea of linking the output of your stock screener and using the universe callback function. In the long run I think it would be great for Quantopian to be able to provide the screening capabilities directly, but in the meantime this is a great way to get that functionality without waiting on development work.

Best wishes, Jess

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.

very cool! The problem you're seeing is the csv has some extraneous rows for meta data about the csv. fetcher expects the first row to be column headers, and all subsequent rows to be data. The kimono csv "raw" is adding a line to the top, and few lines to the bottom that are unexpected for fetcher. It might be possible to clean this up in a pre_func.

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.

Hi,

I managed to get Kimono to work with fetcher, but then I somehow corrupted the Kimono API when I tried to tweak it. Now I can't seem to get it back to where it was :(. Then I noticed that FinViz has an export link, so I did a quick fetch of that. The algo doesn't actually do anything beyond fetching the data, but I thought it might be useful anyway.

thanks,
fawce

John, you are AWESOME!!! Thanks so much, I'll take it from here and bring in my buy/sell conditionals :) I'll share with you the final product!

if you guys find kimono interesting, you may be interested in my Software as a Service: PhantomJsCloud, which allows you to scrape hundreds of pages in parallel. sorry no easy WYSIWYG editor, but if you have programming chops you can write normal jquery to scrape a page.

You can see an example by looking at our docs page: "Pinterest to JSON" example.
Sorry the service is not for non-developers.