//Respones in private methods. internal void ExchangeRate(IAPIProspect result, APIConfiguration config) { if (result is RealtimeCurrencyExchange) { var res = (result as RealtimeCurrencyExchange).RealtimeCurrencyExchangeRate; "Exchange Currency ".Write(ConsoleTextStyle.INVERSE); "Information Received...".WriteLine(ConsoleTextStyle.SUCCESS); $@" >> From {res?.FromCurrencyName}({res?.FromCurrencyCode}) to {res?.ToCurrencyName}({res?.ToCurrencyCode}) => Exchange Rate: {res?.ExchangeRate}" .WriteLine(ConsoleTextStyle.WARNING); //if (_exchangeCountry > 2) config?.Cancel(); //Cancellation Token used. //if (_exchangeCountry > 2) config?.CancelCurrentRepeat(); //Cancellation only for current Repeated API. if (_exchangeCountry < _currencies.Length) { config?.UpdateObjectParams(new ExchangeCurrency { ToCurrency = _currencies[_exchangeCountry++] }, new StockQuoteSymbols { Symbols = "DIS,AXP" }); } config?.InsertObjectParam(res); } }
internal void StockQuotes(IAPIProspect result) { if (result is StockQuoteMaster) { var res = (result as StockQuoteMaster).StockQuotes; "Stock Quotes ".Write(ConsoleTextStyle.SATISFACTORY); " Information Received...".WriteLine(ConsoleTextStyle.INFORMATION); $@" >> Price Volume: {res?.Sum(r => r.Price?.ToDouble())} ".WriteLine(ConsoleTextStyle.FAILURE); } }
public void Reponses(IAPIProspect resultProspect, APIConfiguration config) { ExchangeRate(resultProspect, config); StockQuotes(resultProspect); }
public void Final(IAPIProspect result) { Console.WriteLine(); "API Call is completely done.".WriteLine(ConsoleTextStyle.COMPLETE); }