欢迎光临散文网 会员登陆 & 注册

现货期权交易所开发源码,现货期权交易所系统开发(海外版)

2023-02-22 21:56 作者:bili_88076104257  | 我要投稿

The development technology of digital currency exchange is a decentralized consensus mechanism to maintain a complete,distributed and tamper-proof ledger database.It enables participants in the blockchain to achieve a unified ledger system without establishing trust relationships. As a new information and network technology,blockchain uses encryption technology,distributed network and consensus mechanism to ensure that the information recorded by each node in the network is true and effective.Blockchain is constantly penetrating into all walks of life and has shown a good development trend. huobipro=ccxt.huobipro({ 'apiKey':'', 'secret':'', })开发流程I35分析7O98源码O7I8 先使用ccxt获取交易所的实例,然后获取历史k线,得到的数据使用dataframe格式接受 huobipro.fetch_ohlcv(symbol=symbol,limit=limit_num,timeframe=timeframe) 然后利用pandas提供的函数计算MA, df['median_short']=df['close'].rolling(n_short,min_periods=1).mean() df['median_long']=df['close'].rolling(n_long,min_periods=1).mean() 需求及逻辑开发:mrsfu123 然后再找出买入卖出信号, #找出买入信号 condition1=df['median_short']>df['median_long']#短均线上穿长均线 condition2=df['median_short'].shift(1)<=df['median_long'].shift(1) df.loc[condition1&condition2,'signal']=1#产生买入信号的k线标记为1 #找出卖出信号 condition1=df['median_short']<df['median_long']#短均线上穿长均线 condition2=df['median_short'].shift(1)>=df['median_long'].shift(1) df.loc[condition1&condition2,'signal']=0#产生卖出信号的k线标记为0 有了交易信号,就可以获取信号,再判断进行下单(huobipro.create_limit_buy/sell_order()了) 第五步:其实第四步就可以交易了,第五步是回测,一般来说先回测再根据回测结果选用策略,最后才进行实盘 回测分析的相关有很多种,在这方面我也不是很懂,目前我还是习惯用累计利润来进行分析, #由signal计算出实际的每天持仓 df['pos']=df['signal'].shift() df['pos'].fillna(method='ffill',inplace=True) df['pos'].fillna(value=0,inplace=True) 到这里持仓信号就有了,就可以根据持仓和历史k线的价格计算累计利润了, df['change']=df['close'].pct_change(1)#根据收盘价计算涨跌幅 df['by_at_open_change']=df['close']/df['open']-1#开盘买入到收盘的涨跌幅 df['sell_next_open_change']=df['open'].shift(-1)/df['close']-1#这根收盘到下根开盘的涨跌幅 df.at[len(df)-1,'sell_next_open_change']=0#补全空值df.a

现货期权交易所开发源码,现货期权交易所系统开发(海外版)的评论 (共 条)

分享到微博请遵守国家法律