2013-06-27 3 views
0

나는 여기에 설명 된대로 주가 지수 일의 값 변경을 계산 에 노력하고 있습니다 : http://www.codeproject.com/Articles/37550/Stock-quote-and-chart-from-Yahoo-in-C요일 값 변경 계산 방법은 무엇입니까?

어떻게 하나 계산이 C#에서?

+0

게시 한 링크 ... C#의 예를 보여줍니다. 당신이 찾고있는 것이 무엇입니까? – Rahul

+0

방금 ​​내가 굵은 글씨로 강조한 부분은 –

+0

입니다. 긴 기사의 어느 부분에 "주가 지수 변경 계산"에 대한 설명이 포함되어 있는지 인라인하십시오. 지금까지이 질문은 링크를 질문으로 게시하지 않는 SO 지침을 충족하지 못합니다. 또한 모든 종류의 감사 노트/새로운 여기/그와 같은 발언은 일반적으로 * 정보 *를 게시물에 추가하지 않으므로 많은 검색을 피하십시오. –

답변

0

기사에서 GetQuote 메서드 재 작성 ...이 메서드에 심볼을 전달하면 날짜 값 변경이 반환됩니다.

public string GetDaysValueChange(string symbol) 
{ 
    // Set the return string to null. 
    string result = null;    
    try 
    { 
     // Use Yahoo finance service to download stock data from Yahoo 
     // Note that f=w1 tells the service we just want the Days Value Change 
     string yahooURL = @"http://download.finance.yahoo.com/d/quotes.csv?s=" + 
          symbol + "&f=w1"; 

     // Initialize a new WebRequest. 
     HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(yahooURL); 
     // Get the response from the Internet resource. 
     HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse(); 
     // Read the body of the response from the server. 
     StreamReader strm = 
      new StreamReader(webresp.GetResponseStream(), Encoding.ASCII); 

     result = strm.ReadLine().Replace("\"", ""); 
     strm.Close(); 
    } 
    catch 
    { 
     // Handle exceptions. 
    } 
    // Return the stock quote data in XML format. 
    return result; 
} 
관련 문제