python搭建_简单_交易系统【转载】

  • 构建account_class 类
  • 构建所需函数
  • 构建最大回撤、收益率、回测函数
  • 构建银行翻倍、选股函数
  • 回测实证分析

(转自 https://www.joinquant.com/view/community/detail/4e35bd681cdeb7a10e258d302bf9ca35?type=1)

简易系统包含了选股函数(用银行股翻倍公式进行选股)
选股策略回测 结果可视化。

系统逻辑:
根据回测区间和调仓频率,计算出调仓日期
step1 在调仓日,选出股票(股票池为 14支银行股)
step2 在调仓日,卖出未选中的股票。将所有资金 买入选出的股票。

数据接口 由聚宽JQdata提供。

代码来源于北京量化平台科技有限公司。

我进行了一些优化,用的聚宽数据接口,写了很多注释。

附件是电子版参考书。
书里有很多图表。

当时这门课的场景还历历在目。
时间过的真快,转眼已整整一年了。

导入所需的包

# -*- coding: utf-8 -*-
import ashare
from ashare import *
from django.shortcuts import render
import os
import json
import datetime
import random
import numpy as np
import pandas as pd
import math
import ssdata
import matplotlib.pyplot as plt
import time
import lhptdata as lh
#import jqdatasdk as jq
from jqdatasdk import *
#用jqdata账号登陆
auth('','')

auth success

构建account_class 类

###############################################################################
#             Define framework classes                          #
###############################################################################class account_class:def __init__(self, start_date, end_date, capital_base, freq, benchmark,universe, tax=0.001, commission=0.00025, slippage=0.01):"""start_date: the start date of back testend_date: the end date of back testcapital_base: initial fund to perform back testfreq: back test frequencies, measured in days, eg. 1 for daily and 7for weeklytax: tax ratecommission: commission rateslippage: slippage"""self.start_date = start_dateself.end_date = end_dateself.capital_base = capital_baseself.freq = freqself.benchmark = benchmarkself.universe = universeself.tax = taxself.commission = commissionself.slippage = slippageself.ini_dic = Noneself.benchmark_data = Noneself.trade_days = Noneself.order_days = Noneself.today_capital = Noneself.ret = None    #计算 return  收益率self.history_max = Noneself.drawdown_start = Noneself.drawdown_end = Noneself.capital = Noneself.cash = Noneself.today = Nonedef setup(self):self.ini_dic = {}self.benchmark_data = pd.DataFrame()self.ret = pd.DataFrame()  #收益率为 dfself.history_max = 0self.capital = []self.cash = capital_base#调用函数self.set_dic()    #调用不用写 selfself.set_days()   #调用不用写 selfdef set_dic(self):  #定义需要写 self# 根据股票池,初始化【股票字典】key为股票代码,value为data,的开盘价for stock in self.universe:#df = get_price("000001.XSHE")#print(df)# print(data) 日期为索引,开盘价,同一个股票代码为2列的【dataframe格式】# try:'''data = ssdata.get_data(secid=stock,start_date=self.start_date,end_date=self.end_date,field='open').sort_index()df = get_price('000001.XSHE', start_date='2015-01-01', end_date='2015-01-31 23:00:00', frequency='minute', fields=['open', 'close']) # 获得000001.XSHG的2015年01月的分钟数据, 只获取open+close字段''' data123 = get_price(stock,start_date=self.start_date,end_date=self.end_date,frequency='daily',fields=['open'],).sort_index()#print('data123', data123)#print(type(data123))self.ini_dic[stock] = data123except Exception:self.universe.remove(stock)print("Stock ", stock, " data unavailable.")try:'''data = ssdata.get_data(secid=self.benchmark,start_date=self.start_date,end_date=self.end_date,field='open').sort_index()'''data1 = get_price(self.benchmark,start_date=self.start_date,end_date=self.end_date,frequency='daily',fields=['open'],)['open'].sort_index()print(type(data1))#print('data1:',data1)#self.benchmark_data = self.benchmark_data.append(data1)self.benchmark_data = data1except Exception:print("Benchmark ", self.benchmark, " data unavailable.")def set_days(self):"""Set up the ini_dic, benchmark_data, trade_days and order_days.# 初始化2个日期 列表,交易日 和 下单日/调仓日# self.trade_days=[a for i in self.ini_dic[self.universe[0]].index a=i.strftime('%Y-%m-%d')]list121=[]for i in self.ini_dic[self.universe[0]].index:print(i)a=i.strftime('%Y-%m-%d')print(a)list121.append(a)self.trade_days=list121"""    self.trade_days = self.ini_dic[self.universe[0]].indexself.order_days = self.get_order_days()def get_order_days(self):# 根据 【交易日】和【调仓频率】,计算出【下单日/调仓日】"""Return the list of order days based on frequency."""tdays = list(self.trade_days)odays = []for i in range(len(tdays)):if i % self.freq == 0:odays.append(tdays[i])return odays

构建所需函数

###############################################################################
#                          Define framework functions                         #
###############################################################################def order_to(target):#传入保存 股票数量的序列global h_amountglobal account  #声明 全局变量trade_days = account.trade_daysorder_days = account.order_daystax = account.taxcommission = account.commissionini_dic = account.ini_dic  #获取价格#today_capital = account.today_capital 计算drawdownslippage = account.slippagedate = account.today #访问全局变量,调用时,今天的日期if date in order_days: #检测当天 是否 在 下单日 列表里print('下单函数中,输出调仓日期和 选中的股票',date.strftime('%Y-%m-%d'), list(target.index))t_amount = pd.DataFrame({'tamount': [0]}, index=list(target.index))# Sell stocks in holding but not in targetfor stock in list(h_amount.index):if stock not in list(target.index):stock_data = ini_dic[stock].loc[date.strftime('%Y-%m-%d')]# 获取 日期price = stock_data['open']  #获取开盘价#计算资金=数量*开盘价account.cash += h_amount.loc[stock, 'hamount'] * \(price - slippage) * (1 - tax - commission)print('order: ', stock, 'amount ',int(0 - h_amount.loc[stock, 'hamount']))h_amount=h_amount.drop(stock) #bug# Deal with stocks /in targetfor stock in list(target.index):stock_data = ini_dic[stock].loc[date.strftime('%Y-%m-%d')]price = stock_data['open'] #获取股票的开盘价# Buy stocks in target /but not in holdingif stock not in list(h_amount.index):h_amount = h_amount.append(pd.DataFrame({'hamount': [0],'price': [0],'value': [0],'percent': [0]},index=[stock]))# 下单 股票的数量t_amount.loc[stock, 'tamount'] = math.floor(target[stock] / 100) * 100# If hoding > target, sellif h_amount.loc[stock, 'hamount'] - t_amount.loc[stock, 'tamount'] \> 0:account.cash += (h_amount.loc[stock, 'hamount'] -t_amount.loc[stock, 'tamount']) \* (price - slippage) * (1 - tax - commission)# If hoding < target, buyif h_amount.loc[stock, 'hamount'] - t_amount.loc[stock, 'tamount'] \< 0:# Attention: buy hand by hand in case cash becomes negativefor number in range(int(t_amount.loc[stock, 'tamount'] / 100),0, -1):if account.cash - (number * 100 -h_amount.loc[stock, 'hamount']) * \(price + slippage) * (1 + commission) < 0:continueelse:account.cash -= (number * 100 -h_amount.loc[stock, 'hamount']) * \(price + slippage) * (1 + commission)t_amount.loc[stock, 'tamount'] = number * 100breakif h_amount.loc[stock, 'hamount'] - t_amount.loc[stock, 'tamount'] \!= 0:print('order: ', stock, 'amount ',int(t_amount.loc[stock, 'tamount'] -h_amount.loc[stock, 'hamount']))h_amount.loc[stock, 'hamount'] = t_amount.loc[stock, 'tamount']h_amount.loc[stock, 'price'] = priceh_amount.loc[stock, 'value'] = h_amount.loc[stock, 'price'] * \h_amount.loc[stock, 'hamount']h_amount['percent'] = h_amount['value'] / sum(h_amount['value'])# 把drawdown()独立成了函数# Output holding detailsh_amount.to_csv('position_details666.csv')def order_pct_to(pct_target): # 传入参数  买入股票的 百分比global account # 声明全局变量date = account.todayini_dic = account.ini_dic  #获取 股票的价格today_capital = account.today_capital #资金target = pd.Series()  #保存 股票数量的序列for stock in list(pct_target.index):stock_data = ini_dic[stock].loc[date.strftime('%Y-%m-%d')]price = stock_data['open'] #获取股票的开盘价,价格#计算股票的数量 = 资金/价格  #资金=今日资金量*百分比target[stock] = (pct_target[stock] * today_capital) / priceorder_to(target)# 传入目标股票数量def result_display(): # 结果 展示global account"""Display results, including the return curve and a table showing returns drawdown and drawdown intervals."""# account.ret.to_csv('return_details.csv')# strategy annual returnRa = (1 + (account.ret.iloc[-1].rev)) ** \(250 / len(list(account.trade_days))) - 1print('account.ret:',account.ret)results = pd.DataFrame({'benchmark return':'%.2f%%' % (account.ret.iloc[-1].benchmark * 100),'Strategy return':'%.2f%%' % (account.ret.iloc[-1].rev * 100),'Strategy annual return':'%.2f%%' % (Ra * 100),'Max drawdown':'%.2f%%' % (account.ret.iloc[-1].max_drawdown * 100),'Max drawdown interval':str(account.drawdown_start.strftime('%Y-%m-%d')+ ' to '+ account.drawdown_end.strftime('%Y-%m-%d'))},index=[''])results.reindex(['benchmark return','Strategy return','Strategy annual return','Max drawdown','Max drawdown interval'], axis=1)print(results.transpose())return results
'''# plot the resultsaccount.ret['rev'].plot(color='royalblue', label='strategy return')account.ret['benchmark'].plot(color='black', label='benchmark return')x = np.array(list(account.ret.index))plt.fill_between(x, max(max(account.ret.rev), max(account.ret.benchmark)),min(min(account.ret.rev), min(account.ret.benchmark)),where=((x <= account.drawdown_end) &(x >= account.drawdown_start)),facecolor='lightsteelblue',alpha=0.4)plt.legend()plt.show()'''
###############################################################################
#                   Parameters and functions set up manually                  #
###############################################################################def initialize(account):"""This is a function that runs only once, before the backtest begins."""passdef handle_data():#global account"""This is a function that runs every backtest frequency."""w=1# 增加 选股函数,返回列表 ,赋值给list, 【不修改 account.universe】#股票池固定为 14支银行股,如果修改account.universe,(只有3支股票)再次运行还需要初始化,与h_amount.index (14支股票)不一致list = GrahamStockFilter()positions = pd.Series()# 股票/仓位/百分比的序列for stock in list:#for stock in GrahamStockFilter(account):# positions[stock] = 0.5positions[stock] = 1 / len(list) *w    # 得到 股票所占仓位的平均百分比print(positions[stock])#for stock in account.universe:#positions[stock] = 0.5order_pct_to(positions)

构建最大回撤、收益率、回测函数

def drawdown():  # 必须在【每个交易日】计算最大回撤,【声明/访问/全局变量】或者【通过参数,传入date】global accountdate = account.todayprint('drawdown_date', date)date = account.todaytoday_capital = account.today_capital #获取当日的资金trade_days = account.trade_days      # 必须在每个交易日 计算最大回撤account.capital.append(today_capital) #将【今天的资金量】 累加到account.capital中#计算公式 前n-1天资金的最大值 减 第n天的资金 除以 第n天的资金try:drawdown = (max(account.capital[:-1]) - account.capital[-1]) / \max(account.capital[:-1])except Exception:drawdown = 0if drawdown > account.history_max:#大于历史最高,保存为最大,和日期account.drawdown_start = \trade_days[account.capital.index(max(account.capital[:-1]))]account.drawdown_end = \trade_days[account.capital.index(account.capital[-1])]account.history_max = drawdown #最大值保存#【计算收益率结果】
def ret():  # 必须在【每个交易日】【计算收益率结果】,【声明/访问/全局变量】或者【通过参数,传入date】global accountbenchmark = account.benchmark # 列索引#print(code1)#每个交易日计算 收益率的df,并累加到df#print(account.benchmark_data)date = account.today  #当天的日期trade_days = account.trade_daysprint('当天的日期为:',date)#print('当天的日期为:',date.strftime('%Y-%m-%d'))account.ret = account.ret.append(pd.DataFrame({'rev': (account.capital[-1] - account.capital[0]) / account.capital[0],'max_drawdown': account.history_max,'benchmark':(account.benchmark_data.loc[date, '000001.XSHE'] -account.benchmark_data.loc[trade_days[0],  '000001.XSHE']) /account.benchmark_data.loc[trade_days[0],  '000001.XSHE']},index=[date]))print('account.capital每天的资金量列表:',account.capital)###############################################################################
#                               Backtest begins                               #
###############################################################################
#
'''
#print("程序开始")
start_date = '2015-01-01'
end_date = '2016-01-01'freq = 1
benchmark = ['000001.XSHE']
# universe = ['600036.XSHG', '601166.XSHG']
universe = ['000001.XSHE', '002142.XSHE', '600000.XSHG', '600015.XSHG', '600016.XSHG','600036.XSHG', '601009.XSHG', '601166.XSHG', '601169.XSHG', '601328.XSHG', '601398.XSHG','601939.XSHG', '601988.XSHG', '601998.XSHG']
account = account_class(start_date=start_date, end_date=end_date,capital_base=capital_base, freq=freq,benchmark=benchmark, universe=universe)
account.setup()  # 继续初始化
initialize(account)  # pass#初始化,h_amount
h_amount = pd.DataFrame({'hamount': [0],'price': [0],'value': [0],'percent': [0]}, index=universe)
#初始化,h_amount的indexprint('首次初始化完毕')
'''# 初始化 函数,只执行一次。最初股票池的,获得的交易日,通过交易频率,得到调仓日,返回一个实例account 全局变量def backtest1(start_date1, end_date1, freq1):global capital_baseglobal accountglobal h_amount# global frequniverse = ['000001.XSHE', '002142.XSHE', '600000.XSHG', '600015.XSHG', '600016.XSHG','600036.XSHG', '601009.XSHG', '601166.XSHG', '601169.XSHG', '601328.XSHG', '601398.XSHG','601939.XSHG', '601988.XSHG', '601998.XSHG']benchmark = ['000001.XSHE']# account.start_date = start_date1# account.end_date = end_date1# account.capital_base=capital_base1#创建 对象account = account_class(start_date=start_date1, end_date=end_date1,capital_base=capital_base, freq=freq1,benchmark=benchmark, universe=universe)h_amount = pd.DataFrame({'hamount': [0],'price': [0],'value': [0],'percent': [0]},index=universe)# account.freq = freq1# account = account(start_date=start_date, end_date=end_date,# capital_base=capital_base)# freq=freq,benchmark=benchmark, universe=universe)account.setup()  # 根据 交易频率,初始化交易日initialize(account)  # passprint('初始化完毕')# return account# 在调仓日 进行回测# def backtest(account):# print(type(account), "开始回测") # 实例变量for date in account.trade_days:  # 按照 交易日,回测print('日期',date)# print('日期',date.strftime('%Y-%m-%d'))account.today = date  #.strftime('%Y-%m-%d')  # 更新当天的日期,将当天的日期 赋值给全局对象account# print(account.today)# test(account, h_amount)print('交易日')# 调仓日,初始化 持有仓位 df,计算当天的资金量account.today_capital = 0for stock in list(h_amount.index):stock_data = account.ini_dic[stock].loc[date] #.strftime('%Y-%m-%d')price = stock_data['open']#得到开盘价,价格account.today_capital += price * h_amount.loc[stock, 'hamount']account.today_capital += account.cash# 调仓日,初始化 持有仓位 df,计算当天的资金量,计算完毕# 【交易日,当天 初始化完毕】print('计算drawdown')drawdown()  # 遍历所有【交易日】,才能 计算最大回测print('计算收益率')ret()       # 在【每个交易日】计算收益率结果if date in account.order_days:  # 只在下单日,调仓日,选股,下单handle_data()  # 选股,调仓,# print(h_amount)  # 输出仓位print('ok')try:pass# print(h_amount)# result_display()except:pass# handle_data(account)  # 交易日,当天,调用 处理函数#backtest('2015-01-01', '2016-01-01', 20)
#result_display()
#print(h_amount)
#del account
#del h_amount

构建银行翻倍、选股函数

def GrahamStockFilter():today = account.today######################################################################### 14# stock_list = ['000001.SZ', '002142.SZ', '600000.SH', '600015.SH', '600016.SH', '600036.SH', '601009.SH',# '601166.SH', '601169.SH', '601328.SH', '601398.SH', '601939.SH', '601988.SH', '601998.SH']# 16# stock_list=['000001.SZ', '002142.SZ', '600000.SH', '600015.SH', '600016.SH', '600036.SH', '601009.SH', '601166.SH', '601169.SH', '601288.SH', '601328.SH', '601398.SH', '601818.SH', '601939.SH', '601988.SH', '601998.SH']########################################################################''''''stock_list = ['000001.XSHE', '002142.XSHE', '600000.XSHG', '600015.XSHG', '600016.XSHG','600036.XSHG', '601009.XSHG', '601166.XSHG', '601169.XSHG', '601328.XSHG', '601398.XSHG','601939.XSHG', '601988.XSHG', '601998.XSHG']df12 = pd.DataFrame()# df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB'))for stock in stock_list:# df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB'))# df1.append(df2)q = query(valuation.code,  # valuation.symbol,valuation.pb_ratio,  # valuation.pb,valuation.capitalization,  # 总股本valuation.market_cap,  # 总市值indicator.eps,  # income.basic_eps,indicator.roe,  # profit_one_season.roe,indicator.operating_profit,  # income_one_season.profit_from_operations,indicator.inc_operation_profit_annual  # growth_one_season.opt_profit_growth_ratio).filter(valuation.code == stock)df = get_fundamentals(q, today.strftime('%Y-%m-%d'))# 打印出总市值 2015q1# print(df['market_cap'][0])df12 = df12.append(df)# print(df12)df12 = df12.set_index(df12['code'])# 筛选ROE大于0的股票df12 = df12[df12['roe'] > 0]# 收盘价列表df12['close'] = list([float("nan")] * (len(df12.index)))# 有财务数据的股票列表true_list = list(df12.index)panel = get_price(true_list, start_date=today.strftime('%Y-%m-%d'),end_date=today.strftime('%Y-%m-%d'), frequency='daily', fields=None, skip_paused=False,fq='pre')df_close = panel['close']# 每股营业利润df12['pps'] = df12['operating_profit'] / df12['capitalization']# 将收盘价合并入之前的数据当中,方便之后筛选for stock in true_list:df12.loc[stock, 'close'] = df_close[stock].values[0]# 格氏成长公式df12['value'] = df12['pps'] * (27 + 2 * df12['inc_operation_profit_annual'] / 100)df12['outvalue_ratio'] = df12['value'] / df12['close']df12 = df12.sort_values("outvalue_ratio", ascending=False)df_value = df12  # [:30]# 小市值因子df_value = df_value.sort_values("market_cap", ascending=True)df_value = df_value[:10]df_value = df_value.sort_values("outvalue_ratio", ascending=False)df_value = df_value[:3]buylist_value = list(df_value['code'].values)# 翻倍期# import mathdf12['double_time'] = df12.apply(lambda row: round(math.log(2.0 * row['pb_ratio'], (1.0 + row['roe'] / 100)), 2),axis=1)df_double = df12.sort_values('double_time', ascending=True)df_double = df_double[:3]buylist_double = list(df_double['code'].values)# 取交集buylist = [v for v in buylist_value if v in buylist_double]# buylist=list(buylist_value)+list(buylist_double)# 如果交集为空,取银行翻倍股票if len(buylist) == 0:buylist = buylist_double# log.info(get_datetime().strftime('%Y-%m-%d')+'选股为'+ str(buylist)[1:-1])return buylist  # 修改样本量,返回 要买入的选股列表# 格式选股 函数 GrahamStockFilter1【未用】
def GrahamStockFilter1(account):# date = get_datetime()today = account.today.strftime('%Y-%m-%d')# signal = MarketSignal(account)# 得到全A股去除ST和停牌股票的股票列表# stk = list(get_all_securities('stock', date).index)stk = list(get_all_securities(['stock']).index)######################################################################### yesterday = get_last_datetime().strftime('%Y%m%d')q = query(valuation.code,# balance.total_equity,indicator.eps,  # income.basic_eps, #valuation.pb_ratio,  # valuation.pb,#valuation.market_cap,  #indicator.operating_profit,  # income_one_season.profit_from_operations, #valuation.capitalization,  #indicator.roe,  # profit_one_season.roe,  #indicator.inc_operation_profit_annual,  # growth_one_season.opt_profit_growth_ratio,#indicator.inc_net_profit_annual     # growth_one_season.net_profit_growth_ratio)\).filter(valuation.code.in_(stk))  # .order_by(valuation.symbol)df1 = get_fundamentals(q, today)df1 = df1.set_index(df1['code'])# 筛选ROE大于0的股票df1 = df1[df1['roe'] > 0]# 筛选净利润同比增长率大于0的股票 inc_net_profit_annual growth_one_season.net_profit_growth_ratio)df1 = df1[df1['inc_net_profit_annual'] > 0]# 收盘价列表df1['close'] = list([float("nan")] * (len(df1.index)))# 有财务数据的股票列表true_list = list(df1.index)# 收盘价赋值panel = get_price(true_list, start_date=account.today.strftime('%Y-%m-%d'),end_date=account.today.strftime('%Y-%m-%d'), frequency='daily', fields=None, skip_paused=False,fq='pre')close_p = panel['close']# close_p = history(true_list, ['close'], 1, '1d',# skip_paused=False, fq='pre', is_panel=0)# 将收盘价合并入之前的数据当中,方便之后筛选for stock in true_list:try:df1.loc[stock, 'close'] = close_p[stock].values[0]except:# log.info(stock)# log.info(close_p[stock])df1.loc[stock, 'close'] = 10000000000# 每股营业利润df1['pps'] = df1['operating_profit'] / df1['capitalization']# 格氏成长公式df1['value'] = df1['pps'] * \(27 + 2 * df1['inc_operation_profit_annual'] / 100)df1['outvalue_ratio'] = df1['value'] / df1['close']df1.dropna(inplace=True)df1 = df1.sort_values("outvalue_ratio", ascending=False)df1 = df1[:40]df1 = df1.sort_values("market_cap", ascending=True)[:20]buylist = list(df1['code'].values)return buylist  # 选出股票

回测实证分析

capital_base = 1000000    #资金
start_date = '2015-01-01' #起始日期
end_date = '2016-01-01'   #终止日期
freq = 1 # 调仓频率
#backtest( start_date , end_date, freq)
#backtest
print('start')backtest1('2015-01-01', '2016-01-01', 5)#print(h_amount)
#call(account1)
#调用输出结果函数
#print(result_display(account)) #df转为字典的函数: df.to_dict,结果:字典作为元素 组成的列表
print('end')

python搭建_简单_交易系统【转载】相关推荐

  1. python代理池_用Python搭建一个简单的代理池

    其实每次爬东西的时候,特怕IP被封,所以每次都要把时间延迟设置得长一点...这次用Python搭建一个简单的代理池.获取代理IP,然后验证其有效性.不过结果好像不是很理想,为什么西刺代理的高匿代理都能 ...

  2. 怎样用python搭建简单的系统_如何用Python搭建一个简单的推荐系统?

    推荐系统的相关知识我们已在前文中提到,在这篇文章中,我们会介绍如何用Python来搭建一个简单的推荐系统. 本文使用的数据集是MovieLens数据集,该数据集由明尼苏达大学的Grouplens研究小 ...

  3. python旅游推荐系统_如何用Python搭建一个简单的推荐系统?

    推荐系统的相关知识我们已在前文中提到,在这篇文章中,我们会介绍如何用Python来搭建一个简单的推荐系统. 本文使用的数据集是MovieLens数据集,该数据集由明尼苏达大学的Grouplens研究小 ...

  4. python哪个方向简单_现在学Python,哪个方向最简单?哪个方向最吃香 ?

    " 我想学Python,但是学完Python后都能干啥 ?" " 现在学Python,哪个方向最简单?哪个方向最吃香?" " -- " 相信 ...

  5. python仿真搭建_mock搭建——python——搭建一个简单的mock服务——简单版本

    1.无聊的背景.起源: 如今的业务系统越来越复杂庞大,各个功能直接的调用也是多如牛毛,但如果在联调的时候,恰好被调的接口正在开发,怎么办? 傻傻的等么,不存在的!这时会搭建一些server来进行moc ...

  6. python搭建web服务器_用Python建立最简单的web服务器

    利用Python自带的包可以建立简单的web服务器.在DOS里cd到准备做服务器根目录的路径下,输入命令:python -m Web服务器模块 [端口号,默认8000]例如:python -m Sim ...

  7. python ftp 设置代理_用Python搭建一个简单的代理池

    def get_user_agent(): ''' 随机获取一个用户代理 ''' user_agents=[ "Mozilla/4.0 (compatible; MSIE 6.0; Wind ...

  8. python搭建自动化测试平台_如何用python语言搭建自动化测试环境

    原标题:如何用python语言搭建自动化测试环境 技术分享:基于Python语言的Web自动化测试环境搭建 近期发现很多初学者在学习自动化的过程当中,在环境安装环节总是出现问题,所以详细的出一篇环境搭 ...

  9. python搭建https代理服务器_使用NGINX作为HTTPS正向代理服务器

    NGINX主要设计作为反向代理服务器,但随着NGINX的发展,它同样能作为正向代理的选项之一.正向代理本身并不复杂,而如何代理加密的HTTPS流量是正向代理需要解决的主要问题.本文将介绍利用NGINX ...

最新文章

  1. autoware定位:gnss定位与lidar定位(四)
  2. python07-函数与lambda表达式
  3. svn自动同步更新脚本(windows)
  4. s6-9 TCP 定时器
  5. 【Linux】一步一步学Linux——test命令(252)
  6. call和ret(f)指令
  7. 这种玩法闻所未闻,利用python编程自定义QQ的在线状态
  8. 关于有窗口元素和无窗口元素
  9. python圈出车牌字符_Python+OpenCV实现车牌字符分割和识别
  10. OpenGL基础53:阴影映射(下)
  11. 2.程序员的自我修养---编译和链接
  12. 论文笔记_S2D.05-2012-ECCV-从立体图像中提取与场景一致的三维对象和深度
  13. vba常用函数详细介绍及示例
  14. matlab 16qam误码率图,16QAM理论误码率与实际误码率MATLAB仿真程序(最新整理)
  15. 想要创业,却没货源?答应我,别只在阿里妈妈上找了好吗
  16. java爬取论坛信息_Java爬取校内论坛新帖
  17. nxp的wifi驱动调试
  18. linear regression and logistic regression 1
  19. 啊哈添柴挑战Java1223. 输出对勾
  20. 【课内学习】数字电路Flip-Flop

热门文章

  1. Microsoft Security Essentials Beta 出自微软的单机版缉毒尖兵
  2. 微信小程序:实现简单的拼券功能(uniCloud)
  3. Windows下实现快速访问GitHub
  4. 基于R语言股票市场收益的统计可视化分析
  5. 第三十六讲:神州无线AP胖AP模式配置与管理
  6. Altair Activate 2021.1 x64
  7. 学术文献翻译改写 F36(含心得)
  8. Java使用付费代理的两种实现方法
  9. 惊爆!重大秘密破解!宇宙,大脑,信息,三者之间存在惊天奥秘。道翰天琼认知智能三体论。
  10. openfoam计算旋转体滑移网格方法和MRF方法(附案例代码)