You are given a series of trades each trade has a key a


Please do that in C++

You are given a series of trades. Each trade has a key, a value, a quantity, and a sequence number. For each trade, print the weighted moving average of all the trades for that particular key.

Round your average to two decimal places. If the sequence number for any trade TT is less than the sequence number for any previous trade, throw out TT. Do not print anything for TT or factor it into your WMA.

M_{x+1} = {(M_x * Q_x)+(v_{x+1} * q_{x+1}) \over Q_{x+1}}M x+1 = Q x+1 (M x *Q x )+(v x+1 *q x+1 )

Where M = weighted moving average, Q = total quantity, q = current quantity, and v = current value.

Input:

The input will be a semicolon delimited string of trades, with each trade being comma delimited. The parameters for each trade will be in order:

Key Value Quantity Sequence number

Where key is a string, value is a rational floating point number, quantity is a positive integer, and sequence number is a positive integer.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: You are given a series of trades each trade has a key a
Reference No:- TGS02888575

Expected delivery within 24 Hours