aboutsummaryrefslogtreecommitdiffstats
path: root/python/query_runner.py
blob: 45595f98b049a4c7201d4ce51f3779ec5d26d71f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import psycopg2
conn = psycopg2.connect(database="ET", user="guillaume")
cursor = conn.cursor()

# cursor.execute("select select a.name,a.issuername,a.loanxid,b.bid from et_collateral a left outer join markit_prices b on a.loanxid=b.loanxid where a.dealname='octagon8'")
cursor.execute("select a.name, COALESCE(b.bid,c.price) as price, a.currentbalance from et_collateral a left outer join markit_prices b on a.loanxid=b.loanxid left outer join bloomberg_prices c on a.cusip=c.cusip where a.dealname='octagon8'")

for line in cursor:
    # import pdb;pdb.set_trace()
    print  "\t".join(map(str,line))
cursor.close()
conn.close()