Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Common/Util/CashAmountUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public static class CashAmountUtil
public static bool ShouldAddCashBalance(CashAmount balance, string accountCurrency)
{
// Don't add zero quantity currencies except the account currency
return balance.Amount != 0 || balance.Currency == accountCurrency;
// we do add 'BNFCR' even if zero as it's used to track brokerage fees, we need lean to setup conversion rates for it
return balance.Amount != 0 || balance.Currency == accountCurrency || balance.Currency == "BNFCR";
}
}
}
}
3 changes: 3 additions & 0 deletions Tests/Engine/Setup/BrokerageSetupHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ public void ZeroQuantityCurrenciesAreNotAddedToCashBook()
{
new CashAmount(0, "USD"),
new CashAmount(0, "EUR"),
new CashAmount(0, "BNFCR"),
new CashAmount(123, "ETH")
});

Expand All @@ -639,6 +640,8 @@ public void ZeroQuantityCurrenciesAreNotAddedToCashBook()
Assert.IsFalse(algorithm.Portfolio.CashBook.ContainsKey("EUR"));
// ETH should be present
Assert.IsTrue(algorithm.Portfolio.CashBook.ContainsKey("ETH"));
// special case used in binance future fees
Assert.IsTrue(algorithm.Portfolio.CashBook.ContainsKey("BNFCR"));
}

private void TestLoadExistingHoldingsAndOrders(IAlgorithm algorithm, Func<List<Holding>> getHoldings, Func<List<Order>> getOrders, bool expected)
Expand Down
Loading