'PEZ prod': ('pslchi5pepgsql10', 5500), 'PEZ prod archive': ('pslchi6ppgsql10', 5500), 'PEZ staging': ('pvlchi6spgsql1', 5500), 'PEZ Uat': ('pvlchi6upgsql1', 5500), 'PEZ Uat archive': ('pslchi6ppgsql10', 5550), 'SQL3': ('SQL3', ), 'SQL2': ('pswchi6psql2', 'LabsProjects') } server = 'PEZ prod archive' host = db[server][0] port = db[server][1] engine = create_engine('postgresql://*****:*****@' + host + ':' + str(port) + '/execution') c = pymmd.MMDConnection('pvlchi6ppymmd1', 9999) #CHANGE USER TO YOUR OWN USERNAME r = c.call('auth.auto', {'user': '******'}) sql1_host = 'PVWCHI6PSQL1' sql1_user = '******' sql1_pwd = 'W!nt3r2015' db = 'CMSandbox' def orders(typec): qry = ''' with x as (select symbol, liq_rank, rowin, ROW_NUMBER() OVER (PARTITION BY symbol order by rowin desc) as rnk from eventstats.liq_rank_inout), y as ( select *
import pandas as pd import numpy as np import datetime from multiprocessing import Pool from pyspark import pyspark as ps import pymmd import pycake #from pympler import summary, muppy, tracker import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText c = pymmd.MMDConnection('pvlchi6ppymmd1', 9999) #connection string to everything r = c.call('auth.auto', {'user': '******'}) def get_opts(s): try: s.refresh() except Exception as err: #TEST IT OUT print 'ERR: Could not refresh table' print err keys = s.make_dataframe().index #just an object of the option names s.channel.close() ps.close() return keys.values #Name, exp, and strike information of the options are string
import pyodbc from datetime import date from scipy import stats import statsmodels.api as sm import matplotlib.pyplot as pltI import smtplib from pyspark import pyspark as ps from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.MIMEBase import MIMEBase from email import Encoders import datetime from sqlalchemy import create_engine import pymmd c = pymmd.MMDConnection('pvlchi6ppymmd1', 9999) #connection string to the prints widget r = c.call('auth.auto', {'user': '******'}) sql1_host = 'PVWCHI6PSQL1' sql1_user = '******' sql1_pwd = 'W!nt3r2015' db = 'CMSandbox' def sample(): connstr = 'DRIVER={SQL Server Native Client 11.0}; SERVER=pvwchi6psql1; Database=master; Trusted_Connection=yes' connection = pyodbc.connect(connstr) query = """ SELECT CAST(convert(date, x.LastUpdated, 103) as datetime) as dt ,x.UnderlyingSymbol as Symbol
df=data.get_df() d = defaultdict(list) now = str(datetime.datetime.now()) for i in range (0,len(df)): sym = df.ix[i][0] BPS = float(df.ix[i][1]) Shares = int(df.ix[i][2]) d[sym]={'BPS':BPS, 'Shares':Shares, 'Date':now} print datetime.datetime.now() try: c2 = pymmd.MMDConnection('delphi', 9999) except: pass try: c = pymmd.MMDConnection('asgard', 9999) except: pymmd.MMDConnection('olympus', 9999) req = {'action':"import", 'name':"DM_SAMHAT_BPS", 'data':d, 'expiration':'11/05/2055'} try: response = c.call('data.map.manager', req) except: pass try: response = c2.call('data.map.manager', req) except: pass print response