Current location - Trademark Inquiry Complete Network - Futures platform - Excuse me, futures experts, how to calculate the price of yellow moving average in the time-sharing trend of varieties? The more detailed the better, thank you!
Excuse me, futures experts, how to calculate the price of yellow moving average in the time-sharing trend of varieties? The more detailed the better, thank you!
Calculate the weighted average of the transaction volume of each node

A product 34 yuan bought 10, and B product 45 yuan bought 20. What is the average price of product A and product B? At this time, the arithmetic average can't be directly used as (34+45)/2, because they buy different quantities, so to calculate their average price, they can only use the quantity they buy as the weight and carry out weighted average: (34×10+45× 20)/(10+20) = 65430.

An algorithm like this.