def online_apikey_modify(account, token, api_key, bind_ip, remark, permission, dialing_code="86"): #修改ApiKey信息 url = "%s/api/v1/merchant/apikey/modify" % B3_url # verification_id = send_email_sms(sms_type="9", account=account,token=token, language="zh") verification_id = send_sms(sms_type="9", account=account, token=token, language="zh", dialing_code=dialing_code) verification_code = input("验证码:") body = { "token": token, "api_key": api_key, "verification_code": verification_code, "verification_id": verification_id, "bind_ip": bind_ip, "remark": remark, "permission": permission } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def common_currencys(): #获取所有币种 url = "%s/api/v1/common/currencys" % B3_url run = RunMain(url=url, params=None, data=None, headers=get_signture(IOS_apikey, IOS_apisecret), method='GET') out_log(url,response_msg=json.loads(run.response)) print(json.loads(run.response))
def withdraw(token,symbol,amount,address,password,account,chain_id): #提币 url = "%s/api/v1/wallet/withdraw" % B3_url password = str(hashlib.sha256(password.encode('utf-8')).hexdigest()).upper() db = DB('mysql.b3dev.xyz', 3306, 'b3_api', 'fGFcqRkHC5D2z^b^', 'b3') # B3devDB # db = DB('mysql.b2dev.xyz', 3306, 'b2_cc', 'EV0Yom7L5l4r', 'biso') # devDB # db = DB('mysql.b2sit.xyz', 3306, 'b2_cc', '7iD5uXtW84tG', 'biso') #sitDB # db = DB('mysql.b2sim.xyz', 3306, 'b2_cc', '30iAc2sF8UZa', 'biso') #simDB verification_id = send_sms(sms_type="7", account=account,token=token) verification_code = db.query( "SELECT verification_code FROM `user_verification_code` WHERE user_account = 86%s ORDER BY code_over_time DESC LIMIT 1" % account)[0][0] body={ "token":token, "symbol":symbol, "amount":amount, "address":address, "verification_id":verification_id, "verification_code":verification_code, "password":password, "account":"86%s"%account, "chain_id":chain_id } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url,send_msg=body,response_msg=json.loads(run.response)) print(json.loads(run.response))
def common_get_tradePairs(): #获取所有交易对及最新成交涨跌信息 url = "%s/api/v1/common/get_tradePairs" % B3_url run = RunMain(url=url, params=None, data=None, headers=get_signture(IOS_apikey, IOS_apisecret), method='GET') out_log(url,response_msg=json.loads(run.response)) print(json.loads(run.response))
def apikey_create(account, token, permission, bind_ip, remark, dialing_code=""): #申请ApiKey url = "%s/api/v1/merchant/apikey/create" % B3_url db = DB(host, port, user, password, database) # B3devDB verification_id = send_email_sms(sms_type="8", account=account, token=token, language="zh") # verification_id = send_sms(sms_type="8", account=account, token=token, language="zh",dialing_code=dialing_code) verification_code = db.query( "SELECT verification_code FROM `user_verification_code` WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % (dialing_code + account))[0][0] body = { "token": token, "permission": permission, #权限类型,取值范围:1=读取 2=交易 4=划转,可组合使用 "verification_code": verification_code, "verification_id": verification_id, "bind_ip": bind_ip, "remark": remark } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def common_timestamp(): #获取系统当前时间 url = "%s/api/v1/common/timestamp" % B3_url run = RunMain(url=url, params=None, data=None, headers=get_signture(H5_apikey, H5_apisecret), method='GET') out_log(url,response_msg=json.loads(run.response)) print(json.loads(run.response))
def get_info(token): #获取提交的商户认证信息 url = "%s/api/v1/business/get_info"% B3_url body = { "token":token, } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') print(json.loads(run.response))
def quit_validate(token): #获取商户退出条件的符合情况 url = "%s/api/v1/business/quit_validate"% B3_url body = { "token":token, } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') print(json.loads(run.response))
def quit_business(token,remark=""): #退出商户认证 url = "%s/api/v1/business/quit"% B3_url body = { "token":token, "remark":remark } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') print(json.loads(run.response))
def get_assets(token): # 获取币币账户币种资产 url = "%s/api/v1/wallet/get_assets" % B3_url body = { "token": token, } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def validate_token(token): # 检验token是否有效 url = "%s/api/v1/user/validate_token" % B3_url body = { "token": token } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def invitation_my_records(token, page_number, page_size): #获取我的邀请记录 url = "%s/api/v1/invitation/my_records" % B3_url body = {"token": token, "page_number": page_number, "page_size": page_size} run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def cancel_withdraw(token,record_id): # 取消提币 url = "%s/api/v1/wallet/cancel_withdraw" % B3_url body = { "token": token, "record_id": record_id } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def get_recharge_detail(token,record_id): # 5205-获取账户折合总资产 url = "%s/api/v1/wallet/get_recharge_detail" % B3_url body = { "token": token, "record_id":record_id } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def total_assets(token,type,quote_currency=""): # 5205-获取账户折合总资产 url = "%s/api/v1/wallet/total_assets" % B3_url body = { "token": token, "type":type, #资产类型,取值范围::1=币币资产 2=法币资产 4=合约资产,可组合使用 "quote_currency":quote_currency #计价币种,取值范围:USD | CNY,默认值:USD } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def validate_address(symbol,chain_id,address): # 验证提币地址是否合法 url = "%s/api/v1/wallet/validate_address" % B3_url body = { "symbol": symbol, "chain_id":chain_id, "address":address, } run = RunMain(url=url, params=body, data=None, headers=get_signture(H5_apikey, H5_apisecret, body), method='GET') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def get_address(token,symbol,chain_id): # 获取充币地址 url = "%s/api/v1/wallet/get_address" % B3_url body = { "token": token, "symbol": symbol, "chain_id": chain_id,# 币种所归属的主链ID } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def banner_get_list(size,platform,language=None): #获取Banner列表 url = "%s/api/v1/banner/get_list" % B3_url body = { "size":size, "platform":platform, "language":language } run = RunMain(url=url, params=body, data=None, headers=get_signture(IOS_apikey, IOS_apisecret), method='GET') out_log(url,response_msg=json.loads(run.response)) print(json.loads(run.response))
def reduce_deposit(token,symbol,amount,user_id): #商户认证-减少商户保证金 url = "%s/api/v1/admin/business/reduce_deposit"% B3_url body = { "token":token, "symbol": symbol, "amount": amount, "user_id": user_id } run = RunMain(url=url, params=None, data=body, headers=get_signture(sys_apikey, sys_apisecret, body), method='POST') print(json.loads(run.response))
def KYC(token,name,certificate_type,certificate_no): # KYC实名认证 url = "%s/api/v1/authentication/kyc" % B3_url body = { "token": token, "name":name, "certificate_type":certificate_type, "certificate_no":certificate_no } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def apikey_get_list(token): #获取ApiKey列表 url = "%s/api/v1/merchant/apikey/get_list" % B3_url body = { "token": token, } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def announcement_get_list(page_number,page_size,platform,language=None): #获取公告列表 url = "%s/api/v1/announcement/get_list" % B3_url body = { "page_number":page_number, "page_size":page_size , "platform":platform, "language":language } run = RunMain(url=url, params=body, data=None, headers=get_signture(IOS_apikey, IOS_apisecret), method='GET') out_log(url,response_msg=json.loads(run.response)) print(json.loads(run.response))
def invitation_my_stats(token): #获取我的邀请统计信息 url = "%s/api/v1/invitation/my_stats" % B3_url body = { "token": token, } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def transfer_fund(token,symbol,amount,side): # 资金划转 url = "%s/api/v1/wallet/transfer_fund" % B3_url body = { "token": token, "symbol": symbol, "amount": amount, "side": side, #划转方向, 1=划往C2C账户 0=划往币币账户 } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def get_withdrawal_list(token,symbol,page_number="1",page_size="10"): # 获取提币记录 url = "%s/api/v1/wallet/get_withdrawal_list" % B3_url body = { "token": token, "symbol": symbol, "page_number": page_number, "page_size": page_size } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def apply(token,symbol,amount): #提交商户认证 url = "%s/api/v1/business/apply"% B3_url body = { "token":token, "certificate_front":"e6ec529ba185279aa0adcf93e645c7cd.jpg", "certificate_back":"469bba0a564235dfceede42db14f17b0.jpg", "certificate_handheld":"509e1a7dd584d7de15b20fc52e0e2e8d.jpg", "symbol":symbol, "amount":amount #USDT:1500,BTC:0.2 } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') print(json.loads(run.response))
def get_stats(token): # 6861-获取代理商佣金记录详情 url = "https://api.b1dev.xyz/api/v1/invitation/get_stats" body = { "token": token, } run = RunMain(url=url, params=None, data=body, headers=get_signture(Android_apikey, Android_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def futures_transfer_to_risk(apikey, apisecret, symbol, amount): #风险保证金资产划转 url = "%s/merchant/api/v1/futures/sys/account/transfer_to_risk" % B3_url t = time.time() timestamp = str(int(round(t * 1000))) sign_body = { "symbol": symbol, "amount": amount, } sign = get_signture(apikey=apikey, apisecret=apisecret, playload=sign_body) # print(sign) body = { "symbol": symbol, "amount": amount, "timestamp": timestamp, "apikey": apikey, "sign": sign } run = RunMain(url=url, params=None, data=body, headers="", method='POST') out_log(url, response_msg=json.loads(run.response)) print(json.loads(run.response))
def online_apikey_create(account, token, permission, bind_ip, remark): #申请ApiKey url = "%s/api/v1/merchant/apikey/create" % B3_url verification_id = send_email_sms(sms_type="8", account=account, token=token, language="zh") # verification_id = send_sms(sms_type="8",account=account,token=token,language="zh") verification_code = input("验证码:") body = { "token": token, "permission": permission, #权限类型,取值范围:1=读取 2=交易 4=划转,可组合使用 "verification_code": verification_code, "verification_id": verification_id, "bind_ip": bind_ip, "remark": remark } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))