amor71 / LiuAlgoTrader

Framework for algorithmic trading
MIT License
785 stars 130 forks source link

Tradier #317

Closed amor71 closed 2 years ago

sonarcloud[bot] commented 2 years ago

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 10 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sourcery-ai[bot] commented 2 years ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.29%.

Quality metrics Before After Change
Complexity 5.93 ⭐ 5.90 ⭐ -0.03 👍
Method Length 52.28 ⭐ 52.45 ⭐ 0.17 👎
Working memory 9.04 🙂 9.08 🙂 0.04 👎
Quality 72.12% 🙂 71.83% 🙂 -0.29% 👎
Other metrics Before After Change
Lines 9365 9403 38
Changed files Quality Before Quality After Quality Change
examples/quickstart/momentum_long_simplified.py 11.09% ⛔ 11.14% ⛔ 0.05% 👍
examples/scanners/my_scanner.py 92.17% ⭐ 92.17% ⭐ 0.00%
examples/skeleton-strategy/my_strategy.py 60.18% 🙂 60.18% 🙂 0.00%
liualgotrader/init.py 100.00% ⭐ 100.00% ⭐ 0.00%
liualgotrader/consumer.py 61.28% 🙂 61.17% 🙂 -0.11% 👎
liualgotrader/enhanced_backtest.py 54.43% 🙂 54.53% 🙂 0.10% 👍
liualgotrader/producer.py 74.08% 🙂 74.20% 🙂 0.12% 👍
liualgotrader/scanners_runner.py 71.06% 🙂 71.06% 🙂 0.00%
liualgotrader/analytics/analysis.py 63.44% 🙂 62.79% 🙂 -0.65% 👎
liualgotrader/analytics/consolidate.py 12.21% ⛔ 12.21% ⛔ 0.00%
liualgotrader/common/concurrency.py 85.34% ⭐ 85.34% ⭐ 0.00%
liualgotrader/common/config.py 60.61% 🙂 59.13% 🙂 -1.48% 👎
liualgotrader/common/data_loader.py 70.82% 🙂 68.33% 🙂 -2.49% 👎
liualgotrader/common/exceptions.py 100.00% ⭐ 100.00% ⭐ 0.00%
liualgotrader/common/market_data.py 72.35% 🙂 68.67% 🙂 -3.68% 👎
liualgotrader/common/tracer.py 89.71% ⭐ 89.71% ⭐ 0.00%
liualgotrader/common/types.py 70.29% 🙂 68.75% 🙂 -1.54% 👎
liualgotrader/data/alpaca.py 65.35% 🙂 65.30% 🙂 -0.05% 👎
liualgotrader/data/data_base.py 90.55% ⭐ 90.55% ⭐ 0.00%
liualgotrader/data/data_factory.py 82.11% ⭐ 79.32% ⭐ -2.79% 👎
liualgotrader/data/finnhub.py 81.51% ⭐ 82.19% ⭐ 0.68% 👍
liualgotrader/data/gemini.py 74.09% 🙂 74.09% 🙂 0.00%
liualgotrader/data/polygon.py 72.39% 🙂 72.45% 🙂 0.06% 👍
liualgotrader/fincalcs/vwap.py 59.99% 🙂 59.43% 🙂 -0.56% 👎
liualgotrader/models/keystore.py 93.42% ⭐ 93.42% ⭐ 0.00%
liualgotrader/scanners/momentum.py 74.57% 🙂 74.57% 🙂 0.00%
liualgotrader/trading/alpaca.py 71.00% 🙂 70.95% 🙂 -0.05% 👎
liualgotrader/trading/base.py 96.65% ⭐ 96.65% ⭐ 0.00%
liualgotrader/trading/gemini.py 74.11% 🙂 73.66% 🙂 -0.45% 👎
liualgotrader/trading/trader_factory.py 78.03% ⭐ 70.68% 🙂 -7.35% 👎
tests/test_alpaca_basic.py 88.06% ⭐ 88.06% ⭐ 0.00%
tests/test_alpaca_crypto_data_loader.py 89.44% ⭐ 89.45% ⭐ 0.01% 👍
tests/test_alpaca_data_loader.py 86.63% ⭐ 86.37% ⭐ -0.26% 👎
tests/test_alpaca_data_loader_concurrency.py 70.94% 🙂 70.97% 🙂 0.03% 👍
tests/test_alpaca_data_loader_multi.py 59.39% 🙂 59.40% 🙂 0.01% 👍
tests/test_alpaca_data_loader_perf.py 70.46% 🙂 70.46% 🙂 0.00%
tests/test_analysis.py 97.13% ⭐ 97.15% ⭐ 0.02% 👍
tests/test_consolidate.py 91.59% ⭐ 84.18% ⭐ -7.41% 👎
tests/test_cpu_load_avg.py 89.23% ⭐ 89.23% ⭐ 0.00%
tests/test_create_scanner.py 89.34% ⭐ 89.34% ⭐ 0.00%
tests/test_gemini_basic.py 83.91% ⭐ 83.91% ⭐ 0.00%
tests/test_gemini_data_loader.py 81.51% ⭐ 81.45% ⭐ -0.06% 👎
tests/test_gemini_trader.py 84.28% ⭐ 84.30% ⭐ 0.02% 👍
tests/test_load_scanner.py 89.34% ⭐ 89.34% ⭐ 0.00%
tests/test_market_data.py 72.48% 🙂 74.38% 🙂 1.90% 👍
tests/test_portfolio.py 86.81% ⭐ 86.81% ⭐ 0.00%
tests/test_resample.py 56.80% 🙂 59.31% 🙂 2.51% 👍
tests/test_support_resistance.py 68.03% 🙂 72.13% 🙂 4.10% 👍
tests/test_tracer.py 96.99% ⭐ 96.98% ⭐ -0.01% 👎
tests/test_trader_calendar.py 88.66% ⭐ 88.66% ⭐ 0.00%
tests/test_trends.py 65.94% 🙂 67.36% 🙂 1.42% 👍
tests/legacy/test_finnhub_basic.py 92.31% ⭐ 92.31% ⭐ 0.00%
tests/legacy/test_finnhub_data_loader.py 87.23% ⭐ 87.24% ⭐ 0.01% 👍
tests/legacy/test_polygon_basic.py 92.22% ⭐ 92.22% ⭐ 0.00%
tests/legacy/test_polygon_data_loader.py 87.18% ⭐ 87.19% ⭐ 0.01% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
examples/quickstart/momentum_long_simplified.py MomentumLongV3.run 87 ⛔ 1120 ⛔ 45 ⛔ 0.44% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
liualgotrader/analytics/consolidate.py trades 32 😞 628 ⛔ 21 ⛔ 12.21% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
liualgotrader/analytics/analysis.py calc_symbol_trades_returns 27 😞 228 ⛔ 18 ⛔ 23.33% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
liualgotrader/enhanced_backtest.py do_strategy_result 16 🙂 267 ⛔ 15 😞 31.72% 😞 Try splitting into smaller methods. Extract out complex expressions
liualgotrader/consumer.py order_inflight 16 🙂 210 ⛔ 17 ⛔ 32.82% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!