mirror of
https://github.com/we-promise/sure.git
synced 2026-05-29 23:39:03 +00:00
Add Interactive Brokers Provider (#1722)
* Display multi-currency holdings correctly * Implement IBKR provider * Fix: Use historical exchange rate for historical prices * Add brokerage exchange rate for trades * Sync historical balances from IBKR * Add logos in activity history * Fix privacy mode blur in account view * Improve IBKR XML Flex report parser errors
This commit is contained in:
committed by
GitHub
parent
3c4c32584a
commit
ce5d7dd736
@@ -129,6 +129,36 @@ class SnaptradeAccountProcessorTest < ActiveSupport::TestCase
|
||||
assert_equal 0, @account.holdings.count
|
||||
end
|
||||
|
||||
test "processor trusts API total for multi-currency holdings" do
|
||||
security = securities(:aapl)
|
||||
Account.any_instance.stubs(:set_current_balance)
|
||||
|
||||
@snaptrade_account.update!(
|
||||
currency: "CHF",
|
||||
current_balance: BigDecimal("15000.00"),
|
||||
cash_balance: BigDecimal("1000.00"),
|
||||
raw_holdings_payload: [
|
||||
{
|
||||
"symbol" => {
|
||||
"symbol" => { "symbol" => security.ticker, "description" => security.name }
|
||||
},
|
||||
"units" => "10",
|
||||
"price" => "150.00",
|
||||
"currency" => "USD",
|
||||
"average_purchase_price" => "125.50"
|
||||
}
|
||||
],
|
||||
raw_activities_payload: []
|
||||
)
|
||||
|
||||
SnaptradeAccount::Processor.new(@snaptrade_account).process
|
||||
|
||||
@account.reload
|
||||
assert_equal BigDecimal("15000.00"), @account.balance
|
||||
assert_equal BigDecimal("1000.00"), @account.cash_balance
|
||||
assert_equal "CHF", @account.currency
|
||||
end
|
||||
|
||||
# === ActivitiesProcessor Tests ===
|
||||
|
||||
test "activities processor maps BUY type to Buy label" do
|
||||
|
||||
Reference in New Issue
Block a user