Ejemplo n.º 1
0
        public string GetConfirms(IgSessionModel igSession, string dealReference)
        {
            string action = $"/confirms/{dealReference}";

            IgHttpClient igHttpClient = new IgHttpClient();

            return(igHttpClient.Get(igSession, action, 1));;
        }
Ejemplo n.º 2
0
        public IgAccountModels Get(IgSessionModel igSession)
        {
            string       action       = "/accounts";
            IgHttpClient igHttpClient = new IgHttpClient();
            string       json         = igHttpClient.Get(igSession, action, 1);

            return(JsonConvert.DeserializeObject <IgAccountModels>(json));
        }
Ejemplo n.º 3
0
        public string Get(IgSessionModel igSession)
        {
            string action = "/positions";

            IgHttpClient igHttpClient = new IgHttpClient();


            return(igHttpClient.Get(igSession, action, 1));
        }
Ejemplo n.º 4
0
        public MarketSearchModel Get(IgSessionModel igSession, string term, bool getDetail)
        {
            string action = "/markets?searchTerm=" + term;


            string            json   = igHttpClient.Get(igSession, action, 1);
            MarketSearchModel result = JsonConvert.DeserializeObject <MarketSearchModel>(json);

            if (result.Markets != null && getDetail)
            {
                foreach (var market in result.Markets)
                {
                    string ticker = string.Empty;
                    if (!IgEpicMapper.TryLookupCode(market.Epic, out ticker))
                    {
                        IgEpicModel epicModel = GetEpic(igSession, market.Epic);
                        if (!string.IsNullOrWhiteSpace(epicModel.instrument.chartCode))
                        {
                            if (epicModel.instrument.country != "US")
                            {
                                if (epicModel.instrument.country == "GB")
                                {
                                    epicModel.instrument.country = "LON";
                                }

                                epicModel.instrument.chartCode += "." + epicModel.instrument.country;
                            }

                            IgEpicMapper.AddCode(market.Epic, epicModel.instrument.chartCode);
                            ticker = epicModel.instrument.chartCode;
                        }
                    }

                    market.Ticker = ticker;
                    Console.WriteLine($"{market.Ticker} {market.InstrumentName}");
                }
            }

            return(result);
        }