Skip to content

Commit

Permalink
Add name, assetclass & subclass for manual symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
VibeNL committed Oct 30, 2023
1 parent 31b0adc commit 28937c9
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions GhostfolioSidekick/Ghostfolio/API/GhostfolioAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ public async Task CreateManualSymbol(Model.Asset asset)
["symbol"] = asset.Symbol,
["isin"] = asset.ISIN,
["name"] = asset.Name,
["assetclass"] = asset.AssetClass,
["assetsubclass"] = asset.AssetSubClass,
["assetClass"] = asset.AssetClass,
["assetSubClass"] = asset.AssetSubClass,
["currency"] = asset.Currency.Symbol,
["datasource"] = asset.DataSource
};
Expand All @@ -216,6 +216,32 @@ public async Task CreateManualSymbol(Model.Asset asset)
throw new NotSupportedException($"Creation failed {asset.Symbol}");
}

// Set name and assetClass (BUG / Quirk Ghostfolio?)
o = new JObject
{
["name"] = asset.Name,
["assetClass"] = asset.AssetClass,
["assetSubClass"] = asset.AssetSubClass,
["comment"] = string.Empty,
["comment"] = string.Empty,
["scraperConfiguration"] = new JObject(),
["symbolMapping"] = new JObject()
};
res = o.ToString();

try
{
r = await restCall.DoPatch($"api/v1/admin/profile-data/{asset.DataSource}/{asset.Symbol}", res);
if (!r.IsSuccessStatusCode)
{
throw new NotSupportedException($"Creation failed on update {asset.Symbol}");
}
}
catch (Exception ex)
{
throw new NotSupportedException($"Creation failed on update {asset.Symbol}.");
}

logger.LogInformation($"Created symbol {asset.Symbol}");
}

Expand Down

0 comments on commit 28937c9

Please sign in to comment.