Financial Services

The query below retrieves the total trading volume of Google stocks in the 4 hour period after some bad news occurred.

PATTERN SEQ(News a, Stock+ b[ ])
WHERE [symbol]
AND a.type = 'bad'
AND b[i].symbol = 'GOOG'
WITHIN 4 hours
HAVING b[b.LEN].volume < 80%*b[1].volume
RETURN sum(b[ ].volume)

The next query reports a one-hour period in which the price of a stock increased from 10 to 20 and its trading volume stayed relatively stable.

PATTERN    SEQ(Stock+ a[])
WHERE [symbol]
AND a[1].price = 10
AND a[i].price > a[i-1].price
AND a[a.LEN].price = 20
WITHIN 1 hour
HAVING avg(a[].volume) # a[1].volume
RETURN a[1].symbol, a[].price

The third query detects a more complex trend: in an hour, the volume of a stock started high, but after a period of price increasing or staying relatively stable, the volume plummeted.

PATTERN SEQ(Stock+ a[], Stock b)
WHERE [symbol]
AND a[1].volume > 1000
AND a[i].price > avg(a[#i-1].price))
AND b.volume < 80% * a[a.LEN].volume
WITHIN 1 hour
RETURN a[1].symbol, a[].(price,volume), b.(price,volume)
~

Last updated: 06/16/21 12:11:29

Locations of visitors to this page


Previous page: Healthcare
Next page: Transport Networks