Skip to content

Commit

Permalink
Fix matching (#47)
Browse files Browse the repository at this point in the history
Untested, let's try :)
  • Loading branch information
VibeNL authored Oct 30, 2023
1 parent 4f7d409 commit 814489d
Show file tree
Hide file tree
Showing 21 changed files with 152 additions and 109 deletions.
2 changes: 1 addition & 1 deletion ConsoleHelper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static void Main(string[] args)
new ScalableCapitalParser(api),
new Trading212Parser(api),
});
//t.DoWork().Wait();
t.DoWork().Wait();
t = new MarketDataMaintainerTask(logger, api, cs);
t.DoWork().Wait();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task ConvertActivitiesForAccount_TestFileSingleOrder_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("IE00B3XXRP09", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("IE00B3XXRP09", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/DeGiro/Example1/TestFileSingleOrder.csv" });
Expand Down Expand Up @@ -85,8 +85,8 @@ public async Task ConvertActivitiesForAccount_TestFileMultipleOrders_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("IE00B3XXRP09", null)).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("NL0009690239", null)).ReturnsAsync(asset2);
api.Setup(x => x.FindSymbolByIdentifier("IE00B3XXRP09", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("NL0009690239", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset2);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/DeGiro/Example3/TestFileMultipleOrders.csv" });
Expand Down Expand Up @@ -126,7 +126,7 @@ public async Task ConvertActivitiesForAccount_TestFileDividend_WithTax_Converted
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("NL0009690239", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("NL0009690239", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/DeGiro/Example4/TestFileDividend.csv" });
Expand Down Expand Up @@ -156,7 +156,7 @@ public async Task ConvertActivitiesForAccount_TestFileDividend_NoTax_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("NL0009690239", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("NL0009690239", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/DeGiro/Example5/TestFileDividendNoTax.csv" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task ConvertActivitiesForAccount_TestFileSingleOrder_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.USD)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Generic/Example1/Example1.csv" });
Expand Down Expand Up @@ -70,7 +70,7 @@ public async Task ConvertActivitiesForAccount_TestFileLifecycle_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.USD)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Generic/Example2/Example2.csv" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public async Task ConvertActivitiesForAccount_TestFileMultipleOrders_ReferalPend
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("USDC", It.IsAny<Func<IEnumerable<Asset>, Asset>>())).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("BTC", It.IsAny<Func<IEnumerable<Asset>, Asset>>())).ReturnsAsync(asset2);
api.Setup(x => x.FindSymbolByIdentifier("USDC", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("BTC", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset2);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Nexo/Example1/Example1.csv" });
Expand Down Expand Up @@ -84,8 +84,8 @@ public async Task ConvertActivitiesForAccount_TestFileMultipleOrders_ReferalAppr
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("USDC", It.IsAny<Func<IEnumerable<Asset>, Asset>>())).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("BTC", It.IsAny<Func<IEnumerable<Asset>, Asset>>())).ReturnsAsync(asset2);
api.Setup(x => x.FindSymbolByIdentifier("USDC", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("BTC", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset2);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Nexo/Example2/Example2.csv" });
Expand Down Expand Up @@ -135,7 +135,7 @@ public async Task ConvertActivitiesForAccount_TestCashback_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("BTC", It.IsAny<Func<IEnumerable<Asset>, Asset>>())).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("BTC", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Nexo/Example3/Cashback.csv" });
Expand Down Expand Up @@ -178,8 +178,8 @@ public async Task ConvertActivitiesForAccount_TestExchangeCoins_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("USDC", It.IsAny<Func<IEnumerable<Asset>, Asset>>())).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("BTC", It.IsAny<Func<IEnumerable<Asset>, Asset>>())).ReturnsAsync(asset2);
api.Setup(x => x.FindSymbolByIdentifier("USDC", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("BTC", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset2);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Nexo/Example4/ExchangeCoins.csv" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task ConvertActivitiesForAccount_Example1_OrderOnly()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("IE00077FRP95", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("IE00077FRP95", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/ScalableCapital/Example1/WUMExample1.csv" });
Expand Down Expand Up @@ -82,7 +82,7 @@ public async Task ConvertActivitiesForAccount_Example1_DividendOnly()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("US92343V1044", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("US92343V1044", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/ScalableCapital/Example1/RKKExample1.csv" });
Expand Down Expand Up @@ -113,8 +113,8 @@ public async Task ConvertActivitiesForAccount_Example1_Both()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("IE00077FRP95", null)).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("US92343V1044", null)).ReturnsAsync(asset2);
api.Setup(x => x.FindSymbolByIdentifier("IE00077FRP95", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("US92343V1044", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset2);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] {
Expand Down Expand Up @@ -158,8 +158,8 @@ public async Task ConvertActivitiesForAccount_Example2_NotDuplicateFeesAndDivide
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("IE00077FRP95", null)).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("US92343V1044", null)).ReturnsAsync(asset2);
api.Setup(x => x.FindSymbolByIdentifier("IE00077FRP95", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset1);
api.Setup(x => x.FindSymbolByIdentifier("US92343V1044", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset2);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task ConvertActivitiesForAccount_TestFileSingleOrder_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Trading212/Example1/TestFileSingleOrder.csv" });
Expand Down Expand Up @@ -80,7 +80,7 @@ public async Task ConvertActivitiesForAccount_TestFileMultipleOrdersUS_Converted
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Trading212/Example2/TestFileMultipleOrdersUS.csv" });
Expand Down Expand Up @@ -121,7 +121,7 @@ public async Task ConvertActivitiesForAccount_TestFileSingleOrderUK_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("GB0007188757", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("GB0007188757", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Trading212/Example3/TestFileSingleOrderUK.csv" });
Expand Down Expand Up @@ -150,7 +150,7 @@ public async Task ConvertActivitiesForAccount_TestFileSingleDividend_Converted()
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("US0378331005", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("US0378331005", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Trading212/Example4/TestFileSingleDividend.csv" });
Expand Down Expand Up @@ -180,7 +180,7 @@ public async Task ConvertActivitiesForAccount_TestFileSingleOrderUKNativeCurrenc
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("GB0007188757", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("GB0007188757", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] { "./FileImporter/TestFiles/Trading212/Example5/TestFileSingleOrderUKNativeCurrency.csv" });
Expand Down Expand Up @@ -209,7 +209,7 @@ public async Task ConvertActivitiesForAccount_TestFileSingleOrderMultipleTimes_C
var account = fixture.Build<Account>().With(x => x.Balance, Balance.Empty(DefaultCurrency.EUR)).Create();

api.Setup(x => x.GetAccountByName(account.Name)).ReturnsAsync(account);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", null)).ReturnsAsync(asset);
api.Setup(x => x.FindSymbolByIdentifier("US67066G1040", It.IsAny<Currency>(), It.IsAny<AssetClass?[]>(), It.IsAny<AssetSubClass?[]>())).ReturnsAsync(asset);

// Act
account = await parser.ConvertActivitiesForAccount(account.Name, new[] {
Expand Down
22 changes: 0 additions & 22 deletions GhostfolioSidekick/FileImporter/CryptoRecordBaseImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,5 @@ protected async Task<Money> GetCorrectUnitPrice(Money originalUnitPrice, Asset?
var price = await api.GetMarketPrice(symbol, date);
return price;
}

protected Asset? ParseFindSymbolByISINResult(string assetName, string symbol, IEnumerable<Asset> assets)
{
var cryptoOnly = assets.Where(x => x.AssetSubClass == "CRYPTOCURRENCY");
var asset = cryptoOnly.FirstOrDefault(x => assetName == x.Name);
if (asset != null)
{
return asset;
}

asset = cryptoOnly.FirstOrDefault(x => symbol == x.Symbol);
if (asset != null)
{
return asset;
}

asset = cryptoOnly
.OrderBy(x => x.Symbol.Length)
.FirstOrDefault();

return asset;
}
}
}
7 changes: 6 additions & 1 deletion GhostfolioSidekick/FileImporter/DeGiro/DeGiroParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ public DeGiroParser(IGhostfolioAPI api) : base(api)
return Array.Empty<Model.Activity>();
}

var asset = string.IsNullOrWhiteSpace(record.ISIN) ? null : await api.FindSymbolByIdentifier(record.ISIN);
var asset = string.IsNullOrWhiteSpace(record.ISIN) ? null : await api.FindSymbolByIdentifier(
record.ISIN,
account.Balance.Currency,
new Model.AssetClass?[] { Model.AssetClass.EQUITY },
new Model.AssetSubClass?[] { Model.AssetSubClass.STOCK, Model.AssetSubClass.ETF }
);
var fee = GetFee(record, allRecords);
var taxes = GetTaxes(record, allRecords);

Expand Down
6 changes: 5 additions & 1 deletion GhostfolioSidekick/FileImporter/Generic/GenericParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ public GenericParser(IGhostfolioAPI api) : base(api)

protected override async Task<IEnumerable<Model.Activity>> ConvertOrders(GenericRecord record, Model.Account account, IEnumerable<GenericRecord> allRecords)
{
var asset = string.IsNullOrWhiteSpace(record.Symbol) ? null : await api.FindSymbolByIdentifier(record.Symbol);
var asset = string.IsNullOrWhiteSpace(record.Symbol) ? null : await api.FindSymbolByIdentifier(
record.Symbol,
account.Balance.Currency,
null,
null);

if (string.IsNullOrWhiteSpace(record.Id))
{
Expand Down
7 changes: 5 additions & 2 deletions GhostfolioSidekick/FileImporter/Nexo/NexoParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ protected override async Task<IEnumerable<Activity>> ConvertOrders(NexoRecord re
return null;
}

return await api.FindSymbolByIdentifier(assetName, x =>
ParseFindSymbolByISINResult(assetName, assetName, x));
return await api.FindSymbolByIdentifier(
assetName,
account.Balance.Currency,
new AssetClass?[] { AssetClass.CASH },
new AssetSubClass?[] { AssetSubClass.CRYPTOCURRENCY });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static string DetermineKey(BaaderBankRKKRecord x)

foreach (var record in wumRecords)
{
var order = await ConvertToOrder(record, rkkRecords);
var order = await ConvertToOrder(account.Balance.Currency, record, rkkRecords);
if (order != null)
{
list.TryAdd(GetKey(order), order);
Expand All @@ -94,7 +94,7 @@ static string DetermineKey(BaaderBankRKKRecord x)
foreach (var record in rkkRecords)
{
BaaderBankRKKRecord r = record.Value;
var order = await ConvertToOrder(r);
var order = await ConvertToOrder(account.Balance.Currency, r);
if (order != null)
{
list.TryAdd(GetKey(order), order);
Expand All @@ -111,15 +111,19 @@ static string DetermineKey(BaaderBankRKKRecord x)
return account;
}

private async Task<Activity?> ConvertToOrder(BaaderBankRKKRecord record)
private async Task<Activity?> ConvertToOrder(Currency expectedCurrency, BaaderBankRKKRecord record)
{
var orderType = GetOrderType(record);
if (orderType == null)
{
return null;
}

var asset = await api.FindSymbolByIdentifier(record.Isin.Replace("ISIN ", string.Empty));
var asset = await api.FindSymbolByIdentifier(
record.Isin.Replace("ISIN ", string.Empty),
expectedCurrency,
new AssetClass?[] { AssetClass.EQUITY },
new AssetSubClass?[] { AssetSubClass.STOCK });

var quantity = decimal.Parse(record.Quantity.Replace("STK ", string.Empty), GetCultureForParsingNumbers());
var unitPrice = record.UnitPrice.GetValueOrDefault() / quantity;
Expand All @@ -136,9 +140,13 @@ static string DetermineKey(BaaderBankRKKRecord x)
);
}

private async Task<Activity> ConvertToOrder(BaaderBankWUMRecord record, ConcurrentDictionary<string, BaaderBankRKKRecord> rkkRecords)
private async Task<Activity> ConvertToOrder(Currency expectedCurrency, BaaderBankWUMRecord record, ConcurrentDictionary<string, BaaderBankRKKRecord> rkkRecords)
{
var asset = await api.FindSymbolByIdentifier(record.Isin);
var asset = await api.FindSymbolByIdentifier(
record.Isin,
expectedCurrency,
new AssetClass?[] { AssetClass.EQUITY },
new AssetSubClass?[] { AssetSubClass.STOCK });

var fee = FindFeeRecord(rkkRecords, record.Reference);

Expand Down
Loading

0 comments on commit 814489d

Please sign in to comment.