Context.PROVIDER_URL的写法

WebSphere:             
Context.INITIAL_CONTEXT_FACTORY             
  "com.ibm.websphere.naming.WsnInitialContextFactory         "             
Context.PROVIDER_URL             
  "iiop://localhost:900         "             
  
  
Weblogic:             
Context.INITIAL_CONTEXT_FACTORY             
          "weblogic.jndi.WLInitialContextFactory         "             
Context.PROVIDER_URL             
          "t3://127.0.0.1:7001         "                                                               
      
          J2EE         SDK(J2EE         RI):             
Context.INITIAL_CONTEXT_FACTORY             
          "com.sun.jndi.cosnaming.CNCtxFactory         "             
Context.PROVIDER_URL             
          "iiop://127.0.0.1:1050         "             
      
SilverStream:             
Context.INITIAL_CONTEXT_FACTORY             
  "com.sssw.rt.jndi.AgInitCtxFactory         "             
Context.PROVIDER_URL             
  "sssw://localhost:80         "             
  
      
          
OC4J     
Context.INITIAL_CONTEXT_FACTORY     
"com.evermind.server.rmi.RMIInitialContextFactory "     
Context.PROVIDER_URL     
"ormi://127.0.0.1/ "     
  
          
      
  
  
JBOSS的:     
java.naming.factory.initial     
"org.jnp.interfaces.NamingContextFactory "     
java.naming.provider.url     
"localhost:1099 "     
  
          
  
          
WAS5:     
Context.INITIAL_CONTEXT_FACTORY             
  "com.ibm.websphere.naming.WsnInitialContextFactory         "             
Context.PROVIDER_URL             
  "iiop://localhost:2809"  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
import numpy as np import pandas as pd import talib def initialize(context): context.symbol = 'BTCUSDT' context.window_size = 5 context.deviation = 1 context.trade_size = 0.01 context.stop_loss = 0.05 context.take_profit = 0.1 schedule_function(rebalance, date_rules.every_day(), time_rules.market_open()) def rebalance(context, data): price = data.history(context.symbol, 'close', context.window_size + 1, '1d') signal = mean_reversion_signal(price, context.window_size, context.deviation) current_position = context.portfolio.positions[context.symbol].amount if signal[-1] == 1 and current_position <= 0: target_position_size = context.trade_size / data.current(context.symbol, 'close') order_target_percent(context.symbol, target_position_size) elif signal[-1] == -1 and current_position >= 0: order_target(context.symbol, 0) elif current_position > 0: current_price = data.current(context.symbol, 'close') stop_loss_price = current_price * (1 - context.stop_loss) take_profit_price = current_price * (1 + context.take_profit) if current_price <= stop_loss_price or current_price >= take_profit_price: order_target(context.symbol, 0) def moving_average(x, n): ma = talib.SMA(x, timeperiod=n) return ma def std_deviation(x, n): std = talib.STDDEV(x, timeperiod=n) return std def mean_reversion_signal(price, window_size, deviation): ma = moving_average(price, window_size) std = std_deviation(price, window_size) upper_band = ma + deviation * std lower_band = ma - deviation * std signal = np.zeros_like(price) signal[price > upper_band] = -1 # 卖出信号 signal[price < lower_band] = 1 # 买入信号 return signal ''' 运行回测 ''' start_date = pd.to_datetime('2019-01-01', utc=True) end_date = pd.to_datetime('2021-01-01', utc=True) results = run_algorithm( start=start_date, end=end_date, initialize=initialize, capital_base=10000, data_frequency='daily', bundle='binance' ) ''' 查看回测结果 ''' print(results.portfolio_value)运行有错误
最新发布
05-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值