python QUANTOPIAN-QUANDL检查了PORTFOLIOVISUALIZER(?)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python QUANTOPIAN-QUANDL检查了PORTFOLIOVISUALIZER(?)相关的知识,希望对你有一定的参考价值。
# checked against Portfoliovisualizer (different)
# https://www.quantopian.com/algorithms/581b0739ca188f3011000203
from zipline import run_algorithm
from zipline.api import get_datetime, symbols, schedule_function, date_rules, time_rules
from datetime import datetime
import pytz
def initialize(context):
context.AAPL = symbols('AAPL')[0]
schedule_function(
get_monthly_returns,
date_rules.month_end(),
time_rules.market_close()
)
def get_monthly_returns(context, data):
h = data.history(context.AAPL, ['open', 'high', 'low', 'close', 'volume', 'price'], 252, '1d')
h_m = h.resample('M', how='last').price
m_returns = h_m.pct_change() * 100
print ('\n\n{} MONTHLY RETURNS\n\n{}'.format(get_datetime(), m_returns))
capital_base = 10000
start = datetime(2010, 12, 30, 0, 0, 0, 0, pytz.utc)
end = datetime(2011, 12, 4, 0, 0, 0, 0, pytz.utc)
result = run_algorithm(start = start, end = end, initialize=initialize,\
capital_base=capital_base, \
bundle = 'quantopian-quandl')
以上是关于python QUANTOPIAN-QUANDL检查了PORTFOLIOVISUALIZER(?)的主要内容,如果未能解决你的问题,请参考以下文章
python如何检听声卡是不是有声音进来
Python科学计算——检包络与去包络
秒表检定仪和日差检定仪建标方案以及设备选用
秒表检定仪和瞬时日差检定仪使用介绍
iOS 碰撞检測以及事件响应
Python: scikit-image Blob detection