Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic benchmarking/profiling tool #59

Closed
femtotrader opened this issue Jun 25, 2016 · 1 comment
Closed

Basic benchmarking/profiling tool #59

femtotrader opened this issue Jun 25, 2016 · 1 comment

Comments

@femtotrader
Copy link
Contributor

According to discussion #20
a basic benchmarking/profiling tool is necessary

nose-timer can provide this kind of basic results automatically and we can simply have a look at Travis build logs

See for example this log https://travis-ci.org/qstraders/qstrader/jobs/140184530

With Python 3.5

examples.test_examples.TestExamples.test_mac_backtest: 6.9505s
examples.test_examples.TestExamples.test_sp500tr_buy_and_hold_backtest: 5.6768s
qstrader.scripts.test_scripts.TestScripts.test_generate_simulated_prices: 3.6915s
examples.test_examples.TestExamples.test_strategy_backtest: 0.0416s
test_statistics.TestSimpleStatistics.test_calculating_statistics: 0.0290s
test_price_handler.TestPriceHandlerSimpleCase.test_stream_all_ticks: 0.0288s
test_price_handler.TestPriceHandlerSimpleCase.test_get_best_bid_ask: 0.0235s
test_price_handler.TestPriceHandlerSimpleCase.test_subscribe_unsubscribe: 0.0228s
test_position.TestRoundTripPGPosition.test_calculate_round_trip: 0.0008s
test_portfolio.TestAmazonGooglePortfolio.test_calculate_round_trip: 0.0007s
test_portfolio_handler.TestSimpleSignalOrderFillCycleForPortfolioHandler.test_convert_fill_to_portfolio_update_basic_check: 0.0003s
test_position.TestRoundTripXOMPosition.test_calculate_round_trip: 0.0003s
test_portfolio_handler.TestSimpleSignalOrderFillCycleForPortfolioHandler.test_on_signal_basic_check: 0.0002s
test_portfolio_handler.TestSimpleSignalOrderFillCycleForPortfolioHandler.test_place_orders_onto_queue_basic_check: 0.0002s
test_portfolio_handler.TestSimpleSignalOrderFillCycleForPortfolioHandler.test_create_order_from_signal_basic_check: 0.0002s

with Python 2.7

https://travis-ci.org/qstraders/qstrader/jobs/140184526

examples.test_examples.TestExamples.test_mac_backtest: 23.5531s
examples.test_examples.TestExamples.test_sp500tr_buy_and_hold_backtest: 6.4959s
qstrader.scripts.test_scripts.TestScripts.test_generate_simulated_prices: 2.6450s
examples.test_examples.TestExamples.test_strategy_backtest: 0.0447s
test_statistics.TestSimpleStatistics.test_calculating_statistics: 0.0417s
test_price_handler.TestPriceHandlerSimpleCase.test_stream_all_ticks: 0.0324s
test_price_handler.TestPriceHandlerSimpleCase.test_get_best_bid_ask: 0.0251s
test_price_handler.TestPriceHandlerSimpleCase.test_subscribe_unsubscribe: 0.0241s
test_portfolio.TestAmazonGooglePortfolio.test_calculate_round_trip: 0.0147s
test_position.TestRoundTripPGPosition.test_calculate_round_trip: 0.0033s
test_position.TestRoundTripXOMPosition.test_calculate_round_trip: 0.0033s
test_portfolio_handler.TestSimpleSignalOrderFillCycleForPortfolioHandler.test_convert_fill_to_portfolio_update_basic_check: 0.0024s
test_portfolio_handler.TestSimpleSignalOrderFillCycleForPortfolioHandler.test_on_signal_basic_check: 0.0002s
test_portfolio_handler.TestSimpleSignalOrderFillCycleForPortfolioHandler.test_place_orders_onto_queue_basic_check: 0.0002s
test_portfolio_handler.TestSimpleSignalOrderFillCycleForPortfolioHandler.test_create_order_from_signal_basic_check: 0.0002s

We can see here that Python 2.7 is much slower with test_mac_backtest

@mhallsmoore
Copy link
Owner

Wow - I'm amazed at the difference. I've love to know where the issues are. It would be useful to run some profiling regardless, using standard cProfile and find out where the bottlenecks are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants