GitHub 地址:https://github.com/pythonstock/stock 它具备以下特点:1)可以直接使用 docker 本地部署...
order_target(stock, target=0) else: trades[trade].append(stock) context.longs, context.shorts = len(trades[1]), len(trades[-1]) if context.longs > context.min_positions and context.shorts > context.min_positions: for stock in trades[-1]: order_target_percent(stock, -1 / context.shor...
设置动作和奖励空间的示例: from finrl.env.env_stocktrading import StockTradingEnv env = StockTradingEnv(df = processed_df, stock_dim = len(ticker_list), hmax = 100, initial_amount = 1000000, transaction_cost_pct = 0.001, reward_scaling = 1e-4) 定制环境 FinRL 允许定制交易环境以匹配特定的...
As you can see, the bands try to wrap the price, but some particular events occur when the price breaks them and we can use such events for building many trading strategies. Strategies with Bollinger Bands Let’s see some trading setups that can be spotted with Bollinger Bands. ...
deftrading_strategy(market_data):# 示例策略:假设我们选择价格低于某个阈值的股票threshold_price=100forstockinmarket_data['stocks']:ifstock['price']<threshold_price:print(f"建议买入股票:{stock['name']}价格:{stock['price']}")returnstock['code']# 返回建议买入的股票代码returnNone ...
量化交易(Quantitative trading) 1.1 定义 量化交易(量化投资)是指借助现代统计学和数学(机器学习)的方法,利用计算机技术来进行交易的证券投资方式。 量化交易从庞大的历史数据中海选能带来超额收益的多种“大概率”事件以制定策略,用数量模型验证及固化这些规律和策略,然后严格执行已固化的策略来指导投资,以求获得可以持...
追涨杀跌交易策略评估代码:import jy #详见系列文章“交易类”import stock #详见系列文章“数据接口类import pandas as pdimport 画K线 def 追涨杀跌交易策略(股票代码,最低价,最高价,收盘价,number,number1): number=number/100 #将参数换成百分比 number1=number1/100 i,s,flag=0,0,0 ...
我的最佳趋势跟踪策略(外汇和股票交易系统)(中英文字幕)My Best Trend Following Strategy (Forex & Stock ecat2010 1259 0 用枢轴点确定目标的最佳交易讲座(中英文字幕)Best Trading Lecture on Determining Targets by Using Pivot ecat2010 1481 0 为今年的交易成功做准备(中英文字幕)Prepping for Trading ...
Learn to use Python for analyzing data and trade in Stock Markets There are so many different trading or investing approaches as people in the market. Many existing tools support the most common ones, but if you really want to success with an innovative practice, you have to build it on yo...
import pandas as pd# 导入DataFrame数据import stock #导入股票数据模块import 画K线import macd策略# 导入数据股票代码='002191'天数 = 500截止日期="20210312"股票数据 = stock.读取csv数据(股票代码,天数,截止日期)def 读取数据(股票日线数据): # 导入股票数据 股票日线数据 = stock.读取csv数据(股票...