public static void PlaceOrder(IgOrderModel igOrder) { IgWorkingOrder igWorkingOrder = new IgWorkingOrder(); var response = igWorkingOrder.Post(session, igOrder); Console.WriteLine(response); response = new IgConfirms().GetConfirms(session, igOrder.dealReference); Console.WriteLine(response); }
public string Post(IgSessionModel igSession, IgOrderModel igOrder) { string action = "/workingorders/otc"; HttpClient httpClient = ClientFactory.Create(igSession, 2); string json = JsonConvert.SerializeObject(igOrder); Console.WriteLine(json.FormatJson()); var content = new StringContent(json, Encoding.UTF8, "application/json"); string result = igHttpClient.Post(igSession, action, 2, content); return(result); }
private static int Order(OrderOptions options) { SwitchAccount(options.Account); IgOrderModel igOrder = new IgOrderModel { epic = options.Epic, size = options.PositionSize, currencyCode = "GBP", level = options.Level, limitDistance = options.LimitDistance, stopDistance = options.StopDistance, direction = options.Direction.ToUpper(), dealReference = $"NMCQReference{1}", expiry = options.Expiry }; IgMarkets igMarkets = new IgMarkets(); IgEpicModel epic = igMarkets.GetEpic(session, options.Epic); Console.WriteLine($"Market Code {epic.instrument.newsCode} {epic.instrument.marketId} {epic.instrument.chartCode} Bid: {epic.snapshot.bid}"); PlaceOrder(igOrder); return(0); }