Wolverine, RBI and TDAmeritrade fee models charge no fees

Open Beginner friendly
#9,953 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend

Research direction

Open Common/Orders/Fees/WolverineFeeModel.cs, RBIFeeModel.cs and TDAmeritradeFeeModel.cs and compare GetOrderFee against the base FeeModel.GetOrderFee signature to see why the methods hide rather than override. Add override to each, then fix the unsupported-security-type message in Common/Messages/Messages.Orders.Fees.cs to print the value instead of nameof(securityType). Build and run the existing fee model tests to confirm the $0.005/share and $0.65/contract amounts and that the CS0114 warnings are gone.

Written by the indexing model from the issue text.

Description

Expected Behavior

Orders placed with WolverineBrokerageModel or RBIBrokerageModel are charged $0.005 per share by default, and option orders placed with TDAmeritradeBrokerageModel are charged $0.65 per contract, as WolverineFeeModel, RBIFeeModel and TDAmeritradeFeeModel describe.

Actual Behavior

Every order is charged 0 USD. The three fee models declare GetOrderFee without the override keyword, so they hide FeeModel.GetOrderFee instead of overriding it (compiler warning CS0114). Lean calls fee models through IFeeModel, which dispatches to the base FeeModel.GetOrderFee and returns 0 USD.

Potential Solution

Add override to GetOrderFee in Common/Orders/Fees/WolverineFeeModel.cs, RBIFeeModel.cs and TDAmeritradeFeeModel.cs. The TDAmeritrade unsupported security type message in Common/Messages/Messages.Orders.Fees.cs also prints nameof(securityType) instead of the value.

Reproducing the Problem
var security = /* SPY equity security */;
var order = new MarketOrder(security.Symbol, 1000, DateTime.UtcNow);
IFeeModel feeModel = new WolverineBrokerageModel().GetFeeModel(security);
var fee = feeModel.GetOrderFee(new OrderFeeParameters(security, order));
// fee.Value.Amount is 0, expected 5 (1000 shares x $0.005)

The same happens with RBIBrokerageModel (expected 5) and with TDAmeritradeBrokerageModel for 10 option contracts (expected 6.5).

System Information

Ubuntu x86_64, .NET SDK 10.0.403, master at 22404ea28b8d3f3c9eb74d6ed9f0444426f8e417.

Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
Dominant language
C#
Stars
22.3k
Forks
5.4k
Avg merge
2d 9h
Merged PRs (30d)
52

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantConnect/Lean

All issues in QuantConnect/Lean

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.