QuantConnect / QuantConnect/Lean
Improve Dictionary and Enumerable Python Handling
Open
Nobody has claimed this yet.
consistency
- Dominant language
- C#
- Stars
- 21.7k
- Forks
- 5.3k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 34
Description
Expected Behavior
- Error messages are informative and helpful
- Minimize the pure C# types in Python, and when absolutely required extend with common interface methods (len, items, keys)
Actual Behavior
markets = qb.BrokerageModel.DefaultMarketMap
<System.Collections.ObjectModel.ReadOnlyDictionary...
bars = qb.History[TradeBar](ibm.Symbol, start, end, Resolution.Minute)
<QuantConnect.Util.MemoizingEnumerable[TradeBar] object at 0x7...
Potential Solution
- Make the method return a naitve python type if possible -- in PythonNet if required.
- If not possible; provide common APIs for each one. len, append, items, keys etc.
- Catch the Memoizing enumerable / readonly dictionary error messages and provide a more informative error message.
Reproducing the Problem
Python History API Calls
Checklist
- I have completely filled out this template
- I have confirmed that this issue exists on the current
masterbranch - I have confirmed that this is not a duplicate issue by searching issues
- I have provided detailed steps to reproduce the issue
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python History API calls and the returned ReadOnlyDictionary and MemoizingEnumerable examples described in the issue. Determine whether PythonNet can provide native Python types or whether common methods and clearer error messages are required. Done means Python callers receive usable collection behavior and informative errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100