I’m bringing in price data for cryptocurrencies and stocks via an API. I am trying to calculate moving averages based on this data using list shifter, though I’m open to using any method.
Trying to figure out which mathematical operators to use in listshifter to achieve the desired result.
Here is the formula to calculate a moving average:
Happy to pay a $50/hr for someone to walk me through on a video call how to do this.
Could you give more detail on the specific problem?
If this is just a calculation, this can (and should) be done through a javascript function: declare variables, store data in them, and retrieve them in your bubble app. It should work even if the data is inside a repeating group (you can put a JS element inside a repeating group).
The list shifter (I’m assuming you’re referring to the community plugin) shouldn’t be needed here.
Happy to hop on call with you, but my schedule only opens up next week.
Thanks for the response happy to provide more detail.
So basically I am bringing in time series price data via an API (not storing it in a database) and populating it in a financial candlestick chart plugin ([New plugin] Advanced Financial Charts and Graphs) (so it’s not being displayed in a repeating group).
Basically I want to generate a new list where each price is the average of the previous 147 close prices. Then I’ll be able to add the new list data to the chart in the form of a line series.
I see. nothing like @Thimo 's chart plugins . Here’s an implementation idea off the top of my head:
You need to create a list of close prices and be able to pass it into the JS function as a variable. (or you can try to send in 147 variables into the JS function, which is ill-advised). The best way may be to do a recursive workflow (start with an empty list, loop through the data, and add the close price to store the list in your database, or a custom state).
Pass in the list into your JS script as a variable. You’ll need to create an additional variable that initializes with an empty array.
Write the JS function that takes the initial list of close prices, and generates a new list of average prices that returns what you want. I’m 99% sure this can be done in vanilla Javascript.
Export the new list as a bubble variable, and you can call on it in the graph plugin