修改schedule的start_date

Oracle version:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0

SQL> desc dbms_scheduler.create_schedule
Parameter       Type                     Mode Default? 
--------------- ------------------------ ---- -------- 
SCHEDULE_NAME   VARCHAR2                 IN            
START_DATE      TIMESTAMP WITH TIME ZONE IN   Y        
REPEAT_INTERVAL VARCHAR2                 IN            
END_DATE        TIMESTAMP WITH TIME ZONE IN   Y        
COMMENTS        VARCHAR2                 IN   Y        


SQL> desc dbms_scheduler.set_attribute;
Parameter Type                           Mode Default? 
--------- ------------------------------ ---- -------- 
NAME      VARCHAR2                       IN            
ATTRIBUTE VARCHAR2                       IN            
VALUE     BOOLEAN                        IN            
NAME      VARCHAR2                       IN            
ATTRIBUTE VARCHAR2                       IN            
VALUE     VARCHAR2                       IN            
VALUE2    VARCHAR2                       IN   Y        
NAME      VARCHAR2                       IN            
ATTRIBUTE VARCHAR2                       IN            
VALUE     DATE                           IN            
NAME      VARCHAR2                       IN            
ATTRIBUTE VARCHAR2                       IN            
VALUE     TIMESTAMP                      IN            
NAME      VARCHAR2                       IN            
ATTRIBUTE VARCHAR2                       IN            
VALUE     TIMESTAMP WITH TIME ZONE       IN            
NAME      VARCHAR2                       IN            
ATTRIBUTE VARCHAR2                       IN            
VALUE     TIMESTAMP WITH LOCAL TIME ZONE IN            
NAME      VARCHAR2                       IN            
ATTRIBUTE VARCHAR2                       IN            
VALUE     INTERVAL DAY TO SECOND         IN  

SQL> desc dbms_scheduler.set_scheduler_attribute;
Parameter Type     Mode Default? 
--------- -------- ---- -------- 
ATTRIBUTE VARCHAR2 IN            
VALUE     VARCHAR2 IN   

set_attribute():需要修改 PROGRAM、 JOB、 SCHEDULE  则用此过程,例如修改schedule的start_date,就只能用此过程,示例如下 :

SQL> EXEC dbms_scheduler.set_attribute ('SEVEN_SCHEDULE','start_date',to_timestamp('20140629 14:25:00','yyyymmdd hh24:mi:ss'));

修改完schedule的start_date后,必须要重新激活使用此schedule的job,否则job不实际运行。

SQL> EXEC  DBMS_SCHEDULER.disable('JOB_DATATRACE');
SQL> EXEC  DBMS_SCHEDULER.enable('JOB_DATATRACE');


SET_SCHEDULER_ATTRIBUTE :此过程能修改的属性,如下所列

Parameters

Table 129-97 SET_SCHEDULER_ATTRIBUTE Procedure Parameters

Parameter Description

attribute

The name of the Scheduler attribute. Possible values are:

  • 'default_timezone': Repeating jobs and windows that use the calendaring syntax retrieve the time zone from this attribute when start_date is not specified. See "Calendaring Syntax" for more information.

  • 'email_server': The SMTP server address that the Scheduler uses to send e-mail notifications for job state events. E-mail notifications cannot be sent if this attribute is NULL.

  • 'email_sender': The default e-mail address of the sender of job state e-mail notifications.

  • 'email_server_credential': The schema and name of an existing credential object that SYS has execute object privileges on. Default is NULL. The username and password stored in this credential are used to authenticate with the e-mail server when sending e-mail notifications.

    This functionality is available with Oracle Database 11g Release 2 (11.2.0.2).

  • 'email_server_encryption': This attribute indicates whether or not encryption is enabled for this email server connection, and if so, at what point encryption starts, and with which protocol. Values are:

    • NONE: the default, indicating no encryption used

    • SSL_TLS: indicating that either SSL or TLS are used, from the beginning of the connection

    • STARTTLS:indicating that the connection starts unencrypted, but the command STARTTLS is sent to the e-mail server and starts encryption

    This functionality is available starting with Oracle Database 11g Release 2 (11.2.0.2).

  • 'event_expiry_time': The time, in seconds, before a job state event generated by the Scheduler expires from the Scheduler event queue. If NULL, job state events expire after 24 hours.

  • 'log_history': The number of days that log entries for both the job log and the window log are retained. Default is 30 and the range of valid values is 0 through 1000000.

  • 'max_job_slave_processes': This Scheduler attribute is not used.

value

The new value of the attribute


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27661381/viewspace-1199842/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/27661381/viewspace-1199842/

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、付费专栏及课程。

余额充值