def update_config(self): config_json = self.get_config() # 初始化 API 接口 self._account_api = account.AccountAPI( config_json["auth"]["api_key"], config_json["auth"]["seceret_key"], config_json["auth"]["passphrase"], True) self._spot_api = spot.SpotAPI(config_json["auth"]["api_key"], config_json["auth"]["seceret_key"], config_json["auth"]["passphrase"], True) self._future_api = future.FutureAPI(config_json["auth"]["api_key"], config_json["auth"]["seceret_key"], config_json["auth"]["passphrase"], True) self._swap_api = swap.SwapAPI(config_json["auth"]["api_key"], config_json["auth"]["seceret_key"], config_json["auth"]["passphrase"], True) # 初始化参数 self._strategy_id = config_json["strategy_id"] self._k_line_period = config_json["k_line_period"] self._sampling_num = config_json["sampling_num"] self._leverage = config_json["leverage"] self._coin_usdt = config_json["coin_usdt"] self._coin_usdt_overflow = config_json["coin_usdt_overflow"] self._insurance = config_json["insurance"] self._long = config_json["long"] self._short = config_json["short"] self._grid = config_json["grid"] # 计算参数 self._sampling_sum = (self._sampling_num * (1 + self._sampling_num)) / 2
def bd(): nowtime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print('量化检测:' + '\033[0;34;40m\t' + nowtime + ': \033[0m') futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True) result = futureAPI.get_specific_position('BTC-USD-200327') # long_qty short_qty 空仓数量 # long_avg_cost short_avg_cost 开仓平均价 # long_settlement_price short_settlement_price 结算基准价 mail_text = '' # 邮件内容 my_future = result['holding'] # 我的量化数据 if my_future[0]['long_qty'] == '0': mail_text = my_future[0]['short_avg_cost'] + '开空。上次动作:' + my_future[0][ 'long_avg_cost'] + '开多,' + my_future[0][ 'long_settlement_price'] + '平多' else: mail_text = my_future[0]['long_avg_cost'] + '开多。上次动作:' + my_future[0][ 'long_avg_cost'] + '开空,' + my_future[0][ 'long_settlement_price'] + '平空' get_last_text = "select top 1 mail_text from tab_send_email order by create_time desc" last_text = ms.ExecQueryOne(get_last_text) # 如果邮件内容不为空,并且和上次不同,插入数据库,以发送提醒邮件 if mail_text != '' and mail_text != last_text[0]: send_mail_sql = "insert into tab_send_email (address_to,mail_subject,mail_text) values('*****@*****.**','半岛检测','" + mail_text + "')" print(mail_text) ms.ExecNonQuery(send_mail_sql) else: print('相同')
def get_data(): futureAPI = future.FutureAPI(api_key, secret_key, passphrase, False) k_result = futureAPI.get_kline(future_id, '') df = pd.DataFrame(k_result,columns=['time','open','high','low','close','volume','vc']) upper_band, middle_band, lower_band = talib.BBANDS(df['close'].apply(float).values, timeperiod = 10, nbdevup = 0.5, nbdevdn = 0.5) df['upper_band'] = upper_band df['middle_band'] = middle_band df['lower_band'] = lower_band print df pre_close_price = history_data['closePrice'][-1] # 交割合约API futureAPI = future.FutureAPI(api_key, secret_key, passphrase, False) # 单个合约持仓信息 (20次/2s) result = futureAPI.get_specific_position(future_id) #获取多仓可平仓数量,空仓可平仓数量 long_amount = result['holding'][0]['long_avail_qty'] short_amount = result['holding'][0]['short_avail_qty'] amount = 1 print(long_amount,short_amount) # 撤销未完成订单 (40次/2s) cancle_result = futureAPI.revoke_order(future_id, '') #向上击穿布林 if pre_close_price > upper_band[-1]: #已经持有空仓 if current_short > 0: #'买入平空' #市价全平 #order_result = futureAPI.close_position(future_id, 'short') order_result = futureAPI.take_order(instrument_id = future_id, type = '4',order_type='4',size = str(amount)) #并未持有多仓 if current_long < amount: #'买入开仓' order_result = futureAPI.take_order(instrument_id = future_id, type = '1',order_type='4',size = str(amount)) #向下击穿布林 if pre_close_price < lower_band[-1]: #已经持有多仓 if current_long > 0: #'卖出平多' #市价全平 #order_result = futureAPI.close_position(future_id, 'long') order_result = futureAPI.take_order(instrument_id = future_id, type = '3',order_type='4',size = str(amount)) #并未持有空仓 if current_short < amount: #'卖出开空' order_result = futureAPI.take_order(instrument_id = future_id, type = '2',order_type='4',size = str(amount))
def __init__(self): super().__init__() api_key = '50efe898-4ee3-4f7e-bc5a-05e6b955f441' seceret_key = '44CB9460F6FB6C906D647390AB650E55' passphrase = 'Take_order_API' self.futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True)
def __init__(self): self.instrument_id = Instrument_id api_key = 'a81e9a56-6cc0-4f7a-a146-a9fc590b3d63' seceret_key = '5C59BB0410BE0989D3C8861E00CD70BF' passphrase = 'Position_info_API' self.futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True) self.log = Log("Position_info_API.txt")
def __init__(self): self.instrument_id = Instrument_id self.beishu = BEISHU api_key = '50efe898-4ee3-4f7e-bc5a-05e6b955f441' seceret_key = '44CB9460F6FB6C906D647390AB650E55' passphrase = 'Take_order_API' self.futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True) self.log = Log("Take_order_API.txt")
def __init__(self): self.instrument_id = Instrument_id api_key = 'cc94168a-060d-409c-81b5-bbb3e329bf15' seceret_key = '5F21098F1D113AA02A00FFDEF31761A2' passphrase = 'Market_info_API' self.futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True) self.log = Log("Market_info_API.txt") db = dbm.open(self.instrument_id, 'c') if b'latest' not in db.keys(): db['latest'] = '2019-02-07T07:32:29.000Z' db.close()
def yijia(): nowtime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print('\033[0;34;40m\t' + nowtime + ': \033[0m') spotAPI = spot.SpotAPI(api_key, seceret_key, passphrase, True) # get_ticker 获取全部ticker信息 # type(bb_get_ticker): list bb_get_ticker = spotAPI.get_ticker() # type(ticker) : dict instrument_id_list = ['BTC-USDT', 'LTC-USDT', 'ETH-USDT', 'EOS-USDT', 'XRP-USDT', 'ETC-USDT', 'BCH-USDT', 'BSV-USDT'] ticker_list = [] for bb_ticker in bb_get_ticker: if bb_ticker['instrument_id'] in instrument_id_list: ticker_list.insert(len(ticker_list), {'name': bb_ticker['instrument_id'][0:-1], bb_ticker['instrument_id'][0:-1]: bb_ticker['last']}) # best_ask 卖一价 last 最新成交价 futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True) future_get_ticker = futureAPI.get_ticker() mail_text = '' for ticket in ticker_list: for future_ticker in future_get_ticker: if ticket['name'] in future_ticker['instrument_id']: ticket[future_ticker['instrument_id']] = future_ticker['last'] rate = (float(future_ticker['last']) / float(ticket[ticket['name']]) * 100 - 100) ticket[future_ticker['instrument_id'] + '溢价'] = '%.2f' % rate + '%' if (rate > 3 or rate < -3) and ('190628' in future_ticker['instrument_id']): mail_text = mail_text + '\r\n' + future_ticker['instrument_id'] + '季度溢价:' + str('%.2f' % rate + '%') elif (rate > 1 or rate < -1) and ('190628' not in future_ticker['instrument_id']): mail_text = mail_text + '\r\n' + future_ticker['instrument_id'] + '周溢价:' + str('%.2f' % rate + '%') # [{'name': 'ETH-USD', 'ETH-USD': '171.78', 'ETH-USD-190517': '170.476', 'ETH-USD-190517溢价': '-0.76%', 'ETH-USD-190628': '171.191', 'ETH-USD-190628溢价': '-0.34%', 'ETH-USD-190510': '170.634', 'ETH-USD-190510溢价': '-0.67%'}] # print(ticker_list) # print(mail_text) # sys.exit(0) # 判断上一次时间在2小时之前 并且时间在8点到晚上12点 则插入信息 today = datetime.datetime.today() get_last_time = "select * from tab_send_email where create_time > '" + ( datetime.datetime.now() - datetime.timedelta(hours=2)).strftime('%Y-%m-%d %H:%M:%S') + "'" last_time = ms.ExecQueryOne(get_last_time) bl1=nowtime>datetime.datetime(today.year, today.month, today.day,8, 30, 0).strftime('%Y-%m-%d %H:%M:%S') bl2=nowtime<datetime.datetime(today.year, today.month, today.day, 23, 59, 59).strftime('%Y-%m-%d %H:%M:%S') bl3 =(last_time is None) if bl1 and bl2 and bl3 and mail_text != '': send_mail_sql = "insert into tab_send_email (address_to,mail_subject,mail_text) values('*****@*****.**','okex期货出现溢价'+'" + nowtime + "','" + mail_text + "')" print(mail_text) ms.ExecNonQuery(send_mail_sql) else: # print(bl1,bl2,bl3) pass
def cancel_order(): futureAPI = future.FutureAPI(api_key, secret_key, passphrase, False) #获取未成交和部分成交的订单列表 order_list = [] order_info = futureAPI.get_order_list(future_id, '0')[0]['order_info'] for i in order_info: order_list.append(i['order_id']) order_info = futureAPI.get_order_list(future_id, '1')[0]['order_info'] for i in order_info: order_list.append(i['order_id']) if order_list: canceled_orders = futureAPI.revoke_orders(future_id, order_ids=order_list) print('撤单成功') else: print('无单可撤')
def connect_context(context, ws_flag=True, restapi_flag=True): """ set up context object :param context: context is the object to hold all trade stats across functions :return: context """ logger.info('Connect to websocket and restapi') if restapi_flag: context.futureAPI = future.FutureAPI(context.api_key, context.secret_key, context.passphrase, True) context.spotAPI = spot.SpotAPI(context.api_key, context.secret_key, context.passphrase, True) if ws_flag: context.ws = websocket.WSSubscription(context.instrument_id, context.instrument_type) context.ws_spot = websocket.WSSubscription(context.spot_inst_id, context.spot_inst_type) time.sleep(3) return context
def trade(): futureAPI = future.FutureAPI(api_key, secret_key, passphrase, False) # 单个合约持仓信息 (20次/2s) result = futureAPI.get_specific_position(future_id) #获取多仓可平仓数量,空仓可平仓数量 long_amount = result['holding'][0]['long_avail_qty'] short_amount = result['holding'][0]['short_avail_qty'] amount = 1 print(long_amount,short_amount) # 撤销未完成订单 (40次/2s) result = futureAPI.revoke_order(future_id, '') #向上击穿布林 if pre_close_price > upper_band[-1]: #已经持有空仓 if current_short > 0: #'买入平空' #市价全平 #order_result = futureAPI.close_position(future_id, 'short') order_result = futureAPI.take_order(instrument_id = future_id, type = '4',order_type='4',size = str(amount)) print('已经已经持有空仓,买入平空') #并未持有多仓 if current_long < amount: #'买入开仓' order_result = futureAPI.take_order(instrument_id = future_id, type = '1',order_type='4',size = str(amount)) print('并未持有多仓,买入开仓') #向下击穿布林 if pre_close_price < lower_band[-1]: #已经持有多仓 if current_long > 0: #'卖出平多' #市价全平 #order_result = futureAPI.close_position(future_id, 'long') order_result = futureAPI.take_order(instrument_id = future_id, type = '3',order_type='4',size = str(amount)) print('已经持有多仓,卖出平多') #并未持有空仓 if current_short < amount: #'卖出开空' order_result = futureAPI.take_order(instrument_id = future_id, type = '2',order_type='4',size = str(amount)) print('并未持有空仓,卖出开空')
def __init__(self, api_key: str, api_secret: str, passphrase: str, is_debug=False): super().__init__(api_key, api_secret, passphrase, is_debug=is_debug) self.account_api = account_api.AccountAPI(self.api_key, self.api_secret, self.passphrase, False) self.spot_api = spot_api.SpotAPI(self.api_key, self.api_secret, self.passphrase, False) self.margin_api = lever_api.LeverAPI(self.api_key, self.api_secret, self.passphrase, False) self.futures_api = futures_api.FutureAPI(self.api_key, self.api_secret, self.passphrase, False) self.swap_api = swap_api.SwapAPI(self.api_key, self.api_secret, self.passphrase, False) self.options_api = option_api.OptionAPI(self.api_key, self.api_secret, self.passphrase, False) self.information_api = information_api.InformationAPI( self.api_key, self.api_secret, self.passphrase, False) self.index_api = index_api.IndexAPI(self.api_key, self.api_secret, self.passphrase, False)
import datetime import json import time import okex.futures_api as future from common_helper import convert_tv2ok_resolution, convert_timestamp2ok from config_helper import diamond okex_cfg = diamond.get_exchange_auth('okex') api_key = okex_cfg.get('api_key') secret = okex_cfg.get('secret') passphrase = okex_cfg.get('passphrase') okex = future.FutureAPI(api_key, secret, passphrase, True) def convert_iso2timestamp(iso_time): # '1984-06-02T19:05:00.000Z' utc_dt = datetime.datetime.strptime(iso_time, '%Y-%m-%dT%H:%M:%S.%fZ') # Convert UTC datetime to seconds since the Epoch timestamp = (utc_dt - datetime.datetime(1970, 1, 1)).total_seconds() return timestamp def convert_timestamp2iso(timestamp): utc_dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=timestamp) return utc_dt.strftime('%Y-%m-%dT%H:%M:%S.%.3fZ') def get_history_kline(symbol, time_from, time_to, resolution):
def job(): inputval = input("请输入查询:") key = inputval.split('询') # key=msg['Text'].split('询') if (len(key) == 2 and key[0] == '查'): keyvalue = key[1] account = ms.ExecQueryOne( " select api_key,seceret_key,passphrase from tab_accounts where keyvalue='" + keyvalue + "' ") if (account is not None): api_key = str(account[0]) seceret_key = str(account[1]) passphrase = str(account[2]) row = ms.ExecQueryOne( "select top 1 * from okex where name='" + keyvalue + "' and DateDiff(dd,create_time,getdate())<=1 order by create_time asc " ) lastday = '0' lastday_btc = '0.0' lastday_eth = '0.0' lastday_eos = '0.0' lastday_etc = '0.0' sys.exit(0) if (row is not None): lastday = str(row[1]) lastday_btc = str(row[4]) lastday_eth = str(row[5]) lastday_eos = str(row[6]) lastday_etc = str(row[7]) print('' + keyvalue + ': ') spotAPI = spot.SpotAPI(api_key, seceret_key, passphrase, True) spotresult = spotAPI.get_coin_account_info('USDT') futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True) btc_amunt = futureAPI.get_coin_account('btc') etc_amunt = futureAPI.get_coin_account('etc') eth_amunt = futureAPI.get_coin_account('eth') eos_amunt = futureAPI.get_coin_account('eos') swapAPI = swap.SwapAPI(api_key, seceret_key, passphrase, True) btc_price = swapAPI.get_mark_price( 'BTC-USD-SWAP')['mark_price'] etc_price = swapAPI.get_mark_price( 'ETC-USD-SWAP')['mark_price'] eth_price = swapAPI.get_mark_price( 'ETH-USD-SWAP')['mark_price'] eos_price = swapAPI.get_mark_price( 'EOS-USD-SWAP')['mark_price'] # 查询价格 btc = float(str(btc_price)) * float(str(btc_amunt['equity'])) etc = float(str(etc_price)) * float(str(etc_amunt['equity'])) eth = float(str(eth_price)) * float(str(eth_amunt['equity'])) eos = float(str(eos_price)) * float(str(eos_amunt['equity'])) all = str(eos + eth + btc + etc + float(str(spotresult['balance']))) # 盈利比率 bfb = '%.2f%%' % ( (float(all) - float(lastday)) / float(all) * 100) if (lastday == '0'): bfb = '0%' res = keyvalue + ':\n当前币币账户USDT:' + spotresult[ 'balance'] + '\n' + '当前合约账户btc:' + btc_amunt[ 'equity'] + ';\n昨日' + lastday_btc + '\n' + '当前合约账户etc: ' + etc_amunt[ 'equity'] res = res + ';\n昨日' + lastday_etc + '\n' + '当前合约账户eth: ' + eth_amunt[ 'equity'] + ';\n昨日' + lastday_eth + '\n' + '当前合约账户eos: ' + eos_amunt[ 'equity'] + ';\n昨日' + lastday_eos + '\n账户总计USDT约: ' + all + ';\n昨日: ' + lastday + '\n' + '今日USDT本位盈利率' + bfb # return res print(res) else: print('查询口令错误')
import okex.futures_api as future import time import pdb api_key = '372af18c-b3e2-4804-98ba-0bc1dbf89982' seceret_key = '10A6B1283C5DCB32FB03B664D9785691' passphrase = '' futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True) result = futureAPI.get_products() pdb.set_trace() result = futureAPI.get_specific_ticker('BTC-USD-191227') while True: futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True) result = futureAPI.get_specific_ticker('BTC-USD-191227') print(result['best_bid'], result['timestamp']) time.sleep(1)
# 获取订单信息 (20次/2s) # result = levelAPI.get_order_info('', '') # 获取所有未成交订单 (20次/2s) # result = levelAPI.get_order_pending('') # 获取成交明细 (10次/2s) # result = levelAPI.get_fills('') # 获取杠杆倍数 (5次/2s) # result = levelAPI.get_leverage('') # 设置杠杆倍数 (5次/2s) # result = levelAPI.set_leverage('', '') # 公共-获取标记价格 (20次/2s) # result = levelAPI.get_mark_price('') # future api test # 交割合约API futureAPI = future.FutureAPI(api_key, secret_key, passphrase, False) # 所有合约持仓信息 (5次/2s) # result = futureAPI.get_position() # 单个合约持仓信息 (20次/2s) # result = futureAPI.get_specific_position('') # 所有币种合约账户信息 (1次/10s) # result = futureAPI.get_accounts() # 单个币种合约账户信息 (20次/2s) # result = futureAPI.get_coin_account('') # 获取合约币种杠杆倍数 (5次/2s) # result = futureAPI.get_leverage('') # 设定合约币种杠杆倍数 (5次/2s) # 全仓 # result = futureAPI.set_leverage('', '') # 逐仓 # result = futureAPI.set_leverage('', '', '', '')
def okex(): try: nowtime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print('\033[0;34;40m\t' + nowtime + ': \033[0m') zh = ms.ExecQueryALL( " select keyvalue from tab_accounts where status =1") if __name__ == '__main__': for i in zh: keyvalue = list(i)[0] account = ms.ExecQueryOne( " select api_key,seceret_key,passphrase from tab_accounts where keyvalue='" + keyvalue + "' ") if (account is not None): api_key = str(account[0]) seceret_key = str(account[1]) passphrase = str(account[2]) row = ms.ExecQueryOne( "select top 1 * from okex where name='" + keyvalue + "' and DateDiff(dd,create_time,getdate())=1 order by create_time asc ") # print(row) lastday = '0' lastday_btc='0.0' lastday_eth='0.0' lastday_eos='0.0' lastday_etc='0.0' if (row is not None): lastday = str(row[1]) lastday_btc = str(row[4]) lastday_eth = str(row[5]) lastday_eos = str(row[6]) lastday_etc = str(row[7]) # sys.exit(0) # print('\033[0;34;40m\t' + lastday + ': \033[0m') print('' + keyvalue + ': ') spotAPI = spot.SpotAPI(api_key, seceret_key, passphrase, True) spotresult = spotAPI.get_coin_account_info('USDT') # future api test futureAPI = future.FutureAPI(api_key, seceret_key, passphrase, True) # futureresult_get_accounts = futureAPI.get_accounts() # # print('当前合约账户'+json.dumps(futureresult_get_accounts.info)) # if(futureresult_get_accounts['info'].__contains__('btc')): # print('当前合约账户btc: '+futureresult_get_accounts['info']['btc']['equity']) # if (futureresult_get_accounts['info'].__contains__('etc')): # print('当前合约账户etc: '+futureresult_get_accounts['info']['etc']['equity']) # if (futureresult_get_accounts['info'].__contains__('eth')): # print('当前合约账户eth: '+futureresult_get_accounts['info']['eth']['equity']) # if (futureresult_get_accounts['info'].__contains__('eos')): # print('当前合约账户eos: '+futureresult_get_accounts['info']['eos']['equity']) btc_amunt = futureAPI.get_coin_account('btc') etc_amunt = futureAPI.get_coin_account('etc') eth_amunt = futureAPI.get_coin_account('eth') eos_amunt = futureAPI.get_coin_account('eos') # futureresult_get_position = futureAPI.get_position() # print('当前合约账户持仓:' + json.dumps(futureresult_get_position['holding'][0][0])) #### # futureresult_get_order_list1 = futureAPI.get_order_list(6, '', '', '', 'ETH-USD-190329') # futureresult_get_order_list2 = futureAPI.get_order_list(7, '', '', '', 'ETH-USD-190329') # # print('未完成:' + json.dumps(futureresult_get_order_list1)) # print('已完成:' + json.dumps(futureresult_get_order_list2)) # sys.exit(0) # #### # print('当前合约账户持仓'+json.dumps(futureresult_get_position['holding'][0][0])) # swap api test swapAPI = swap.SwapAPI(api_key, seceret_key, passphrase, True) btc_price = swapAPI.get_mark_price('BTC-USD-SWAP')['mark_price'] etc_price = swapAPI.get_mark_price('ETC-USD-SWAP')['mark_price'] eth_price = swapAPI.get_mark_price('ETH-USD-SWAP')['mark_price'] eos_price = swapAPI.get_mark_price('EOS-USD-SWAP')['mark_price'] btc = float(str(btc_price)) * float(str(btc_amunt['equity'])) etc = float(str(etc_price)) * float(str(etc_amunt['equity'])) eth = float(str(eth_price)) * float(str(eth_amunt['equity'])) eos = float(str(eos_price)) * float(str(eos_amunt['equity'])) all = str(eos + eth + btc + etc + float(str(spotresult['balance']))) # ms.ExecNonQuery(newsql.encode('utf-8')) # newsql = "insert into okex (usdt,name) values('" + all + "','" + keyvalue + "')" # print(newsql) # # ms.ExecNonQuery(newsql) # newsql = "insert into okex (usdt,name,btc,eth,eos,etc) values('" + all + "','" + keyvalue + "','" + btc_amunt['equity'] + ",'" + eth_amunt['equity'] + ",'" + eos_amunt['equity'] + ",'" + etc_amunt['equity'] + "')" newsql = "insert into okex (usdt,name,btc,eth,eos,etc) values('" + all + "','" + keyvalue + "','" + btc_amunt[ 'equity'] + "','" + eth_amunt['equity'] + "','" + eos_amunt['equity'] + "','" + etc_amunt['equity'] + "')" ms.ExecNonQuery(newsql) bfb = '%.2f%%' % ((float(all) - float(lastday)) / float(all) * 100) if (lastday == '0'): bfb = '0%' res = keyvalue + ':\n当前币币账户USDT:' + spotresult['balance'] + '\n' + '当前合约账户btc:' + btc_amunt[ 'equity'] + ';昨日'+lastday_btc+'\n' + '当前合约账户etc: ' + etc_amunt['equity'] res = res +';昨日'+lastday_etc+ '\n' + '当前合约账户eth: ' + eth_amunt['equity'] +';昨日'+lastday_eth+ '\n' + '当前合约账户eos: ' + eos_amunt[ 'equity'] +';昨日'+lastday_eos+ '\n账户总计USDT约: ' + all + ';昨日: ' + lastday + '\n' + '今日USDT本位盈利率' + bfb print(res) time.sleep(10) except Exception as e: newsql = "insert into tab_send_email (address_to,mail_subject,mail_text) values('*****@*****.**','okex脚本出现问题'+'"+nowtime+"','"+str(e)+"')" ms.ExecNonQuery(newsql) time.sleep(10)