Using Calculations & Stock Prices in App

Hi - I’m trying to create a simple if / then calculator that pulls in a current stock price. I’m new to Bubble and have been having trouble getting Google Finance and the Stock Ticker plugin to work.

Basically what I’m trying to do is create a fill in the blank sentence like this:

If I invest (user enters investment amount) in (user enters ticker name) today, (ticker’s name)'s price per share is (price pulled from API), and I’ll own (user investment amount / ticker price) shares. Then I’d like to have some simple math functions later on, but that’s the general idea.

Does anyone have an example of how to work in a plug in, user entry, and in-app math function in one line like this?

Thanks!

I’m also new, and someone might have a different solution, but my Bubble app has to do the same thing basically. After looking at the plugins available and different stock API providers, I settled on creating a manual API with IEX Cloud. You can also use AlphaVantage but I’ve found IEX to be the best.

To implement it: install the API Connector plugin by bubble. Now make an account with IEX Cloud to get your key. Here is how I set it up in the API connector. This should be able to get you all the values you need. Note that some of the values returned are only for paid IEX subscribers, but you should be able to get the price and other basic info.



Once that’s entered, it’s a really simple call to get your data.

2 Likes

Thanks @ramzizi - haven’t been able to get the API working yet so that user can enter the ticker, will keep working on solutions, I may not have set it up correctly

Let me know if you need any further help. I do remember on the api connector having to initialize the call, that should at least be able to tell you whether your bubble app can talk with IEX. Also there might be live vs test keys on IEX, and the IEX url is different for each so play around with that

You are a hero!!!

I was wanting to bring in some share prices along with full company name (based on the ticker symbol) and various other bits of data. I knew it could be done, but I thought it would take me days to figure out.

Thanks to you - my super hero - I was displaying all the correct data in a lot less than an hour.

So huge thanks and heaps of kudos to you Ramzizi.

1 Like

You’re welcome! Glad to help. One thing I’ve grown to love with Bubble is that every time I think something is not possible in Bubble, a little digging and elbow grease eventually leads you to a solution. I didn’t think this stock problem would be solvable without a plug in or custom code

1 Like

Hi there, how would you refresh that price every second, or stream it live?

You need to have a WF that trigger every X sec to refresh the API Call. You also need a change in API call request or Bubble will not call API Again.

I notice that if I change the field for the stock price to another stock ticker such as “goog” it fetches the price. If I then change the field to something like “intc” it fetches that stock price. If I go back and input “goog” into the reference field it just displays the original price that was fetched. Not the current one. It never updates with the current price, only the price that was first fetched. How can I clear that information so that it fetches current information each time?

I forget to add a link to help you