Sort:  

Right. SQL is very powerful. I hadn't thought of that. Thanks.

The nice thing about building a database for a swap program is that you can use the database to examine the full history of the swap. I like sqlite3. sqlite3 is a lightweight portable database that works on linux, windows and apple.

I would create a table for both sides of the swap. So, if you were analyzing HIVE to BLURT, I would create one table for the HIVE side and another for the BLURT side. You can do an outer join between the tables, this would show gaps for incomplete trades.

You can also use the WHERE NOT EXIST feature. WHERE NOT EXISTS should produce a table of the mismatches.

PS You could just have just one table. some database engines won't allow queries that self join a table as this can lead to a reflexive paradox; so it is best to have two tables. one for the source and the other for the destination.

!WINE