RIC Exchange Codes

Question: A Reuters instrument code, or RIC, is a ticker-like code used by Thomson Reuters to identify financial instruments and indices. For equities, the RIC is a combination of the ticker and exchange code, delimited by a period ('.'). Given the trade table below for a single day, write a query that returns the total volume of trades per exchange. The expected columns are ric, size.

More Information:

https://en.wikipedia.org/wiki/Reuters_Instrument_Code

Example

                                
                                q)trade:([]ric:`AAPL.DE`AAPLE.MI`AAPL.MX`IBM.DE`IBM.F`MSFT.DE`MSFT.MX;px:282.9 281.6 7355.5 106.1 107.8 163.84 4257.01;size:1500 2352 3688 3318 1029 57213 7274)
q)trade
ric      px      size
----------------------
AAPL.DE  282.9   1500
AAPLE.MI 281.6   2352
AAPL.MX  7355.5  3688
IBM.DE   106.1   3318
IBM.F    107.8   1029
MSFT.DE  163.84  57213
MSFT.MX  4257.01 7274

==== Expected ====
ric size
---------
DE  62031
F   1029
MI  2352
MX  10962
                                
                            

Solution

Tags:
finance sql
Searchable Tags
algorithms api architecture asynchronous c csv data structures dictionaries disk feedhandler finance functions ingestion ipc iterators machine learning math multithreading optimizations realtime shared library sql statistics streaming strings tables temporal utility websockets