public void GivenTheFixedIncomeClosePrices(Table table) { var rows = TableHelpers.ToEnumerableDictionary(table); foreach (var row in rows) { var item = new SecurityTimeBarQuerySubResponse { Identifiers = new SecurityIdentifiers { Ric = row["_FixedIncomeSecurity"], Isin = row["_FixedIncomeSecurity"], Sedol = row["_FixedIncomeSecurity"], ExternalIdentifiers = row["_FixedIncomeSecurity"] }, Timebars = { new TimeBar { CloseAsk = double.Parse(row["ClosePrice"]), CloseBid = double.Parse(row["ClosePrice"]), CurrencyCode = "GBP", EpochUtc = DateTime.Parse(row["Date"]).ToUniversalTime().ToTimestamp() } } }; _ruleRunner.FixedIncomeClosePriceMock.Add(item); } }
public void GivenTheEquityClosePrices(Table table) { var rows = TableHelpers.ToEnumerableDictionary(table); foreach (var row in rows) { var item = new FactsetSecurityDailyResponseItem { Epoch = DateTime.Parse(row["Date"], null, DateTimeStyles.AssumeUniversal), ClosePrice = Convert.ToDecimal(row["ClosePrice"]), Figi = IdentifierHelpers.ToIsinOrFigi(row["_EquitySecurity"]), Currency = "GBP", DailyVolume = row.ValueOrNull("DailyVolume") != null?Convert.ToInt64(row.ValueOrNull("DailyVolume")) : 0 }; _ruleRunner.EquityClosePriceMock.Add(item); } }
public void GivenTheAllocations(Table table) { var rows = TableHelpers.ToEnumerableDictionary(table); _ruleRunner.AllocationCsvContent = MakeCsv(rows); }
public void GivenTheOrders(Table table) { var rows = TableHelpers.ToEnumerableDictionary(table); // expand special columns foreach (var row in rows) { if (row.ContainsKey("_Date")) { var value = row["_Date"]; row.AddIfNotExists("OrderPlacedDate", value); row.AddIfNotExists("OrderBookedDate", value); row.AddIfNotExists("OrderAmendedDate", value); row.AddIfNotExists("OrderFilledDate", value); } if (row.ContainsKey("_Volume")) { var value = row["_Volume"]; row.AddIfNotExists("OrderOrderedVolume", value); row.AddIfNotExists("OrderFilledVolume", value); } if (row.ContainsKey("_EquitySecurity")) { var value = row["_EquitySecurity"]; var identifier = IdentifierHelpers.ToIsinOrFigi(value); row.AddIfNotExists("MarketType", "STOCKEXCHANGE"); row.AddIfNotExists("OrderCurrency", "GBP"); row.AddIfNotExists("OrderType", "MARKET"); row.AddIfNotExists("InstrumentIsin", identifier); row.AddIfNotExists("InstrumentFigi", identifier); row.AddIfNotExists("MarketIdentifierCode", "XLON"); row.AddIfNotExists("InstrumentCfi", "e"); } if (row.ContainsKey("_FixedIncomeSecurity")) { var value = row["_FixedIncomeSecurity"]; row.AddIfNotExists("MarketType", "STOCKEXCHANGE"); row.AddIfNotExists("OrderCurrency", "GBP"); row.AddIfNotExists("OrderType", "MARKET"); row.AddIfNotExists("InstrumentRic", value); row.AddIfNotExists("MarketIdentifierCode", "RDFI"); row.AddIfNotExists("MarketName", "RDFI"); row.AddIfNotExists("InstrumentCfi", "d"); var identifier = IdentifierHelpers.ToIsinOrFigi(value); row.AddIfNotExists("InstrumentIsin", identifier); } } _ruleRunner.TradeCsvContent = MakeCsv(rows); // default allocations if (_ruleRunner.AllocationCsvContent == null) { var allocationRows = rows.Select(x => new Dictionary <string, string> { ["OrderId"] = x["OrderId"], ["Fund"] = "", ["Strategy"] = "", ["ClientAccountId"] = "", ["OrderFilledVolume"] = x.ValueOrNull("OrderFilledVolume") }); _ruleRunner.AllocationCsvContent = MakeCsv(allocationRows); } }