The input is hypothetical stock price and volume data of three companies IBM, General Electric (GE), and Procter & Gamble (PG) between the time period of '05/17/1961' and '06/21/1961'. The WMAVG function in the example calculates the weighted moving average for stockprice and volume for each company.
Data is assumed to be partitioned such that each partition contains all the rows of an entity. For example, if the weighted moving average of a particular equity share price is required, then all transactions of that equity share must be part of one partition. It is assumed that the input rows are provided in the correct order.
id | name | period | stockprice | volume |
---|---|---|---|---|
1 | IBM | 1961-05-1700:00:00 | 460 | 640000 |
1 | IBM | 1961-05-1800:00:00 | 457 | 707200 |
1 | IBM | 1961-05-1900:00:00 | 452 | 747200 |
1 | IBM | 1961-05-2200:00:00 | 459 | 1.3312e+06 |
1 | IBM | 1961-05-2300:00:00 | 462 | 1.848e+06 |
1 | IBM | 1961-05-2400:00:00 | 459 | 779200 |
1 | IBM | 1961-05-2500:00:00 | 463 | 528000 |
1 | IBM | 1961-05-2600:00:00 | 479 | 843200 |
1 | IBM | 1961-05-2900:00:00 | 493 | 1.728e+06 |
1 | IBM | 1961-05-3100:00:00 | 490 | 880000 |
1 | IBM | 1961-06-0100:00:00 | 492 | 760000 |
1 | IBM | 1961-06-0200:00:00 | 498 | 1.848e+06 |
1 | IBM | 1961-06-0500:00:00 | 499 | 1.3472e+06 |
1 | IBM | 1961-06-0600:00:00 | 497 | 1.48e+06 |
1 | IBM | 1961-06-0700:00:00 | 496 | 1.0912e+06 |
1 | IBM | 1961-06-0800:00:00 | 490 | 1.096e+06 |
1 | IBM | 1961-06-0900:00:00 | 489 | 760000 |
1 | IBM | 1961-06-1200:00:00 | 478 | 904000 |
1 | IBM | 1961-06-1300:00:00 | 487 | 1.9552e+06 |
1 | IBM | 1961-06-1400:00:00 | 491 | 1.0912e+06 |
1 | IBM | 1961-06-1500:00:00 | 487 | 1.3232e+06 |
1 | IBM | 1961-06-1600:00:00 | 482 | 376000 |
1 | IBM | 1961-06-1900:00:00 | 479 | 339200 |
1 | IBM | 1961-06-2000:00:00 | 478 | 640000 |
1 | IBM | 1961-06-2100:00:00 | 479 | 640000 |
2 | GE | 1961-05-1700:00:00 | 68.2502 | 2.7264e+06 |
2 | GE | 1961-05-1800:00:00 | 67.7501 | 1.6704e+06 |
2 | GE | 1961-05-1900:00:00 | 68.375 | 1.5168e+06 |
2 | GE | 1961-05-2200:00:00 | 67.1251 | 1.8528e+06 |
2 | GE | 1961-05-2300:00:00 | 67.1251 | 1.7184e+06 |
2 | GE | 1961-05-2400:00:00 | 66 | 1.2672e+06 |
... | ... | ... | ... | ... |