通过这些文章,您将了解到:波动率预测(Volatility Forecasting)期权回测(Options Backtesting)风险管理(Risk Management)期权定价模型(Option Pricing Models)希腊字母(Option Greeks)各种策略如跨式(Straddle)、蝶式(Butterfly)、铁秃鹫(Iron Condor
code是股票代码,startDate,endDate是起始日期,rootPath是保存路径,flag是日d,周w,月m标识符 def saveStockData(code,startDate,endDate,rootPath,flag): rs = bs.query_history_k_data_plus(code, "date,code,open,high,low,close,volume", start_date=start...
fundamentals.stockcode.in_(context.hs300) ).limit(10) fund = get_fundamentals(q) # 行列内容以及索引一起进行转置 # print(fund.T) context.stock_list = fund.T.index # before_trading此函数会在每天策略交易开始前被调用,当天只会被调用一次 def before_trading(context): pass # 你选择的证券的数据...
import pandas as pd# 导入DataFrame数据import stock #导入股票数据模块import 画K线import macd策略# 导入数据股票代码='002191'天数 = 500截止日期="20210312"股票数据 = stock.读取csv数据(股票代码,天数,截止日期)def 读取数据(股票日线数据): # 导入股票数据 股票日线数据 = stock.读取csv数据(股票...
量化交易(Quantitative trading) 1.1 定义 量化交易(量化投资)是指借助现代统计学和数学(机器学习)的方法,利用计算机技术来进行交易的证券投资方式。 量化交易从庞大的历史数据中海选能带来超额收益的多种“大概率”事件以制定策略,用数量模型验证及固化这些规律和策略,然后严格执行已固化的策略来指导投资,以求获得可以持...
Everything you need to start using Python for quant finance, algorithmic trading, and market data analyis. Inside you'll find real-time answers, code to get you started, and hundreds of people for networking, sharing ideas, and accelerating your progress. To maximize your investment, you'll ...
def init(context): # 在context中保存全局变量 context.s1 = "000001.XSHE" # context.s2 = "601390.XSHG" # 获取行业 # context.stock_list = industry("C39") # 获取指数成分股 context.hs300 = index_components("000300.XSHG") def before_trading(context): logger.info(context.hs300) logger.inf...
# 图形绘制# show_nontrading:是否显示非交易日,默认False# savefig:导出图片,填写文件名及后缀mpf.plot(df, **绘图参数,style=s, show_nontrading=False)mpf.show()代码运行效果:源码格式如下:stock.py数据接口源码:import pandas as pdcode="002191" #股票代码dayss=100 #截止日期之前天数dayend=...
deftrading_strategy(market_data):# 示例策略:假设我们选择价格低于某个阈值的股票threshold_price=100forstockinmarket_data['stocks']:ifstock['price']<threshold_price:print(f"建议买入股票:{stock['name']}价格:{stock['price']}")returnstock['code']# 返回建议买入的股票代码returnNone ...
chinesestockapi - 获取A股数据 exchange - 获取最新的汇率报价 ticks - 命令行程序,获取股票报价 pybbg - 彭博终端COM的Python接口 ccy - 获取外汇数据 tushare - 获取中国股票,基金,债券和期货市场的历史数据,最新版是tushare pro需要网站注册后才能使用 ...