Wolfram Computation Meets Knowledge

How do I use FinancialDerivative with FinancialData?

You can combine the functions FinancialData and FinancialDerivative to price derivatives. For example, to calculate the price of an American put option on the S&P 500, collect the index’s closing values.

sp500data = FinancialData["SP500", {{2011, 1, 20}, {2011, 4, 23}}];

FinancialData returns a list of pairs. Each pair represents a date and the closing value of the index on that date. Using FinancialDerivative, you can write a function that calculates the value of an example option on sp500data.

americanPutPrice[{date_, currentPrice_}] :=
     FinancialDerivative[{"American", "Put"}, {"StrikePrice" -> 1190,
        "Expiration" -> {2011, 9, 20}}, {"CurrentPrice" -> currentPrice,
        "Dividend" -> 0.03, "Volatility" -> 0.4, "InterestRate" -> 0.05,
        "ReferenceTime" -> date}]

Mapping the price function onto the data returns a list of the values for the option on each day.

putPrice = Map[americanPutPrice, sp500]

This list, however, does not contain any of the dates that are in the original data. Financial plotting functions such as RenkoChart need these dates to work. Each element in their input must be a pair. The first value must be the date and the last value must be the price of the American option. Take the dates from the original data source by evaluating sp500[[All, 1] and interleave it with the list of option values using the Transpose function.

Transpose[{sp500[[All, 1]], putPrice}]

RenkoChart can use this as input.

 RenkoChart[Transpose[{sp500[[All, 1]], putPrice}]]

설명이 도움이 되었나요?
아니오

하실 말씀이 있습니까?

피드백 감사합니다.

제출하기

지원 문의

청구서, 제품 동기화에 관한 질문에서 기술적인 질문까지 부담없이 문의하세요.

1-800-WOLFRAM (국제 전화는 +1-217-398-0700)

고객 지원

월요일 - 금요일
8am–5pm 중부 표준시

  • 제품 등록 및 동기화
  • 구매 전 정보 및 주문
  • 설치 및 동작

고급 기술지원 (해당 고객을 대상으로)

월요일 - 목요일
8am–7pm 중부 표준시

금요일
8:30–10am & 11am–5pm 중부 표준시

  • 우선적 기술지원
  • Wolfram 전문가들의 제품 지원
  • Wolfram 프로그래밍
  • 고급 설치 지원