def create_bank_account(bank_name, legal_name, bank_account, bank_account_name, bank_account_status_enum, payment_system_code, ip, headers): bank_account = { 'bankName': bank_name, ##开户行名称 'legalName': legal_name, 'bankAccount': bank_account, ##银行账户 'bankAccountName': bank_account_name, ##银行账户名称 'bankAccountStatusEnum': bank_account_status_enum, ##启用/停用 'paymentSystemCode': payment_system_code ##支付系统行号 } utils.call_request(ip, 'reference-data-service', 'refBankAccountSave', bank_account, headers)
def add_to_white_list(ip, headers): instrument_list_response = utils.call_request(ip, "market-data-service", "mktInstrumentsListPaged", {}, headers) instrument_list = instrument_list_response['page'] for instrument in instrument_list: params = { 'venueCode': instrument['exchange'], 'instrumentId': instrument['instrumentId'], 'notionalLimit': 100000000000 } utils.call_request(ip, 'market-data-service', 'mktInstrumentWhitelistSave', params, headers)
def get_bct_sales_map(ip, headers): bct_sales_map = {} bct_sales = utils.call_request(ip, 'reference-data-service', 'refSalesList', {}, headers) for bct_sales in bct_sales: subsidiary = bct_sales['subsidiaryName'] branch = bct_sales['branchName'] sale = bct_sales['salesName'] list_to_sales_map(subsidiary, branch, sale, bct_sales_map) return bct_sales_map
def get_bct_subsidiary_branch_map(ip, headers): bct_subsidiary_branch_map = {} bct_subsidiary_branchs = utils.call_request(ip, 'reference-data-service', 'refSubsidiaryBranchList', {}, headers) for item in bct_subsidiary_branchs: branchs = bct_subsidiary_branch_map.get(item['subsidiaryName']) if branchs: branchs.append(item) else: bct_subsidiary_branch_map[item['subsidiaryName']] = [item] return bct_subsidiary_branch_map
def create_vol(host, headers, name, underlyer, instance, spot, tenors, strikes, labels, vols, days_in_year, val_date, save=True): instruments = [{'tenor': tenors[i], 'vols': [{'strike': strikes[j], 'label': labels[j], 'quote': vols[i][j]} for j in range(len(strikes))]} for i in range(len(tenors))] params = { 'underlyer': { 'instrumentId': underlyer, 'instance': instance, 'field': 'close' if instance.lower() == 'close' else 'last', 'quote': spot }, 'modelName': name, 'instance': instance, 'valuationDate': val_date, 'instruments': instruments, 'daysInYear': days_in_year, 'save': save } res = utils.call_request(host, "model-service", "mdlVolSurfaceInterpolatedStrikeCreate", params, headers) return res
def get_bct_legal_name(ip, headers): parties = utils.call_request(ip, 'reference-data-service', 'refPartyList', {}, headers) party_names = {} for party in parties: party_names[party['legalName']] = party['legalName'] return party_names
def get_bct_bank_accounts(ip, headers): bank_account_result = utils.call_request(ip, 'reference-data-service', 'refBankAccountSearch', {}, headers) bank_accounts = {} for bankAccount in bank_account_result: bank_accounts[bankAccount['legalName']] = bankAccount['bankAccount'] return bank_accounts