protected ApiFund MapFund(IFund fund) { return(new ApiFund() { Name = fund.Name, DisplayName = fund.DisplayName, Category = fund.Category, Description = fund.Description, Token = new ApiToken() { Symbol = fund.Token.Symbol, Decimals = fund.Token.Decimals, Address = fund.Token.ContractAddress.Address }, CirculatingSupply = fund.CirculatingSupply, Nav = new ApiNav() { Value = fund.Nav.Value, ValuePerToken = fund.Nav.ValuePerToken, DiffDaily = fund.Nav.DiffDaily, DiffWeekly = fund.Nav.DiffWeekly, DiffMonthly = fund.Nav.DiffMonthly }, Market = MapMarket(fund.Market), Assets = fund.Assets .Select(a => new ApiAsset() { Holding = new ApiHolding() { Name = a.Holding.Name, IsCoin = a.Holding.IsCoin, Symbol = a.Holding.Symbol ?? "-", ContractAddress = a.Holding.ContractAddress?.Address, HexColour = a.Holding.HexColour, Decimals = a.Holding.Decimals, Links = new ApiHoldingLinks() { [nameof(ApiHoldingLinks.Link)] = a.Holding.Link, [nameof(ApiHoldingLinks.ImageLink)] = a.Holding.ImageLink, [nameof(ApiHoldingLinks.MarketLink)] = a.Holding.MarketLink, } }, PricePerToken = a.PricePerToken, Quantity = a.Quantity, Total = a.Total, Share = a.Share }) .ToList(), Links = new ApiFundLinks() { [nameof(ApiFundLinks.Self)] = new Uri(AppSettings.HostUrl.OriginalString.TrimEnd('/') + $"/api/v1/funds/{fund.Token.Symbol}", UriKind.Absolute), ["Lite"] = fund.LitepaperUri, [nameof(ApiFundLinks.Fact)] = fund.FactSheetUri, [nameof(ApiFundLinks.External)] = fund.InvictusUri } }); }
public decimal GetTotalFundValuation(IFund fund) { try { return(Math.Round(_fund.CurrentValuation, 2)); } catch (Exception) { throw; } }
public static FundModel ToFundModel(this IFund fund) { var result = new FundModel( fund.Id, fund.Name, fund.ShortName, fund.Ticker ); return(result); }
static void Main(string[] args) { string market = Properties.Settings.Default.Market; string className = $"AbstractFactory.{market}Factory"; IFactory factory = (IFactory)Assembly.Load("AbstractFactory").CreateInstance(className); IStock stock = factory.CreateStock(); stock.Buy(); stock.Sell(); IFund fund = factory.CreateFund(); fund.Buy(); fund.Sell(); Console.Read(); }
public IFund CreateFund(string fundName, IRepo <IStockPosition> fundRepo, IRepo <IBenchmark> benchmarkRepo, ILogger logger = null) { if (fundRepo == null) { throw new Exception("fund repository is not inilialised"); } if (logger != null) { _logger = logger; } try { _fund = new Fund(fundName, fundRepo); _benchmarkRepo = benchmarkRepo; return(_fund); } catch (Exception) { throw; } }
// *************************************************************************************************************************** // **************************************************** METHODS ******************************************************** // *************************************************************************************************************************** /// <summary> /// Gets the control number. /// </summary> /// <param name = "fund" > /// The fund. /// </param> /// <param name = "fy" > /// The fy. /// </param> /// <returns> /// </returns> private IControlNumber GetControlNumber(IFund fund, IBudgetFiscalYear fy) { if (fund != null && fy != null) { try { var connection = new ConnectionBuilder(Source.ControlNumbers, Provider.SQLite); var args = new Dictionary <string, object> { [$"{Field.FundCode}"] = fund.GetCode(), [$"{Field.BFY}"] = BFY.GetFirstYear(), [$"{Field.RcCode}"] = RC.GetCode() }; var sqlstatement = new SqlStatement(connection, args, SQL.SELECT); var query = new Query(connection, sqlstatement); return(new ControlNumber(query)); } catch (Exception ex) { Fail(ex); return(default);
public void AddFund(StockType stock, double quantity, double price) { IFund fund = CreateFund(stock, quantity, price); MyFund.Add(fund); }
public void Resolve(IFund fund) { this.Result = fund.ToFundModel(); }
public FundViewModel(IFundFactory fundFactory) { _fund = fundFactory.GetFund(); }
public FundManager(IFund fund, IRepo <IBenchmark> benchmarkRepo) { _fund = fund; _benchmarkRepo = benchmarkRepo; }
public FundManager(IFund fund) { _fund = fund; }
public SpotTradeService(IOrder om, IFund fm) { _apiOrder = om; _fund = fm; }
public OrderBuilder WithFund(IFund fund) { _editableData.Fund = fund; return(this); }