3) return 均线def bull(收盘价, 均线, 参数): std = 收盘价.rolling(参数).std() up_bb = 均线 + std * 2 low_bb = 均线 - std * 2 up_bb,low_bb=round(up_bb,3),round(low_bb,3) return up_bb, low_bb def 布林线交易策略(code,close,ma20,num,up_bb,low...
Name)): with open("stock_data_%s_%s_days.csv" % (Code, Name), "a+", encoding='utf-8') as f: f.write("时间,开盘价,收盘价,最高价,最低价,成交量(手),成交额,振幅,涨跌幅,涨跌额,换手率\n") for i in
for trading datafor trading fundamentalfor macro datafor classifying datafor macro datafor referencemoneyflow_hsgt:沪深港通资金流向for shiborfor tushare proapifor LHBfor utilsfor fund datafor trader APIfor futures APIpython模块源码 其中有一个get_k_data函数,下面来讲一下它的用法。 get_k_data(code...
).filter( 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 # 你选择...
find( {'date': adjust_date, 'pe': {'$lt': 30, '$gt': 0}, 'index':False, 'is_trading': True}, sort=[('pe', ASCENDING)], projection={'code': True}, limit=100 ) codes = [x['code'] for x in daily_cursor] this_phase_codes = [] if len(last_phase_codes) > 0: ...
Source code for Algorithmic Trading with Python (2020) by Chris Conlan. Paperback available for purchaseon Amazon. Useful resources These stand-alone resources can be useful to researchers with or without the accompanying book. The rest of the material in this repository depends on explanation and ...
lg = bs.login() # 显示登陆返回信息 print('login respond error_code:'+lg.error_code) print('login respond error_msg:'+lg.error_msg) #获取股票的代码,你可以加入多个股票序列 StockCodes=['000001','600017','000015'] for code in StockCodes: #6开头的是上证 if code[0]=='6': code="sh...
Code This branch is147 commits behindChandlercjy/OnePy:master. README MIT license Onepy Onepy is an event-driven algorithmic trading Python library. 知乎专栏:OnePy-基于Python的量化回测框架 更新日志:Change Log Install Onepy is developed usingPython 3.x. You can install by pip and make sure they...
Very few traders can handle huge drawdowns. As a result, they do the opposite of what they should do: They buy into strength because ofFOMO, and sell into weakness because of fear. They make cognitive mistakes (please click here forwhat is bias in trading). ...
tf-quant-finance - High-performance TensorFlow library for quantitative finance. 指标Indicators pandas_talib - 整合Pandas和Talib,用pandas计算技术指标 finta - 用Pandas计算常见的技术指标 Tulipy - 技术指标库(tulipindicators的Python绑定) 量化交易/回溯检验Trading & Backtesting ...