Open
Conversation
- Changed margin check from total cash to available cash (cash - margin_used) - Prevents overleveraging when existing margin is already tied up - Added test case for available_cash scenario - Closes #418
The previous implementation computed std() of only the negative excess returns, which overstates downside risk by excluding zero-return periods and applying Bessel's correction. The standard Sortino ratio uses target downside deviation: sqrt(mean(min(excess, 0)^2)) across all periods.
fix: use target downside deviation in Sortino ratio
…t-margin-available-cash
Bare `except:` catches all BaseException subclasses including KeyboardInterrupt, SystemExit, and MemoryError, making it impossible to interrupt the program and silently hiding parsing errors. Replace all 5 bare `except:` in api.py with `except Exception as e:` and add logger.warning() calls so parse failures are visible in logs. This addresses issue #448 where users see "Error in analysis, using default" with no diagnostic information. Closes #448
…ls.py 1. get_model() silently returns None for ALIBABA, META, and MISTRAL providers because no elif branch handles them. Callers then call None.invoke() raising an opaque AttributeError. Add an explicit else branch that raises ValueError with a clear message listing all supported providers. 2. Remove duplicate `from langchain_openai import ChatOpenAI` on line 9 (already imported on line 8).
The Financial Datasets API does not always return an `author` field in company news responses. This causes a Pydantic validation error that prevents the news sentiment agent from processing any articles, ultimately leading to an UnboundLocalError crash downstream. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Cache class had zero test coverage. These tests verify: - Initialization with empty stores - Global singleton behavior (get_cache) - Deduplication logic in _merge_data - All five cache types (prices, financial metrics, line items, insider trades, company news) - Key-field based deduplication preserves original values - Independent ticker isolation
Initialize the sentiment aggregation state before branching on the fetched company news and normalize missing responses to an empty list. This prevents an UnboundLocalError when get_company_news() returns None or no articles while downstream logic still references the classification counters and aggregated results. Co-Authored-By: GPT 5.4 <codex@openai.com>
Fix news sentiment handling when news is missing
Adds Kimi (Moonshot) alongside the existing providers so users can run the hedge fund on kimi-k2 / kimi-latest / moonshot-v1-128k without going through OpenRouter. - ModelProvider.KIMI + LLMModel.is_kimi() - get_model() branch using ChatOpenAI with base_url (https://api.moonshot.ai/v1 by default; MOONSHOT_BASE_URL / KIMI_BASE_URL override, e.g. https://api.moonshot.cn/v1 for mainland China) - Accepts MOONSHOT_API_KEY or KIMI_API_KEY - Three entries in api_models.json (kimi-k2-0905-preview, kimi-latest, moonshot-v1-128k) - Surfaces the new key in .env.example and the frontend API-keys panel Closes #578 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat(llm): add Moonshot Kimi as a model provider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )