#NEWLINE# def test_quickstart( ) : #NEWLINE# #INDENT# prophet = Prophet ( ) #NEWLINE# prophet . set_universe ( [ 'AAPL' , 'XOM' ] ) #NEWLINE# price_generator = YahooData ( 'Adj Close' , 'prices' , cache_path = CACHE_PATH ) #NEWLINE# prophet . register_data_generators ( price_generator ) #NEWLINE# prophet . set_order_generator ( OrderGenerator ( ) ) #NEWLINE# backtest = prophet . run_backtest ( start = datetime ( 2010 , 1 , 1 ) , end = datetime ( 2014 , 11 , 21 ) ) #NEWLINE# prophet . register_portfolio_analyzers ( default_analyzers ) #NEWLINE# analysis = prophet . analyze_backtest ( backtest ) #NEWLINE# assert ( round ( analysis [ 'sharpe' ] , 10 ) == 1.1083876014 ) #NEWLINE# assert ( round ( analysis [ 'average_return' ] , 10 ) == 0.0010655311 ) #NEWLINE# assert ( round ( analysis [ 'cumulative_return' ] , 10 ) == 2.2140809296 ) #NEWLINE# assert ( round ( analysis [ 'volatility' ] , 10 ) == 0.0152607097 ) #NEWLINE# today = datetime ( 2014 , 11 , 10 ) #NEWLINE# expected_orders = Orders ( Order ( symbol = 'AAPL' , shares = 100 ) ) #NEWLINE# assert ( prophet . generate_orders ( today ) == expected_orders )