재무에서 쓰이는 옵션가격 결정 모델 중에 하나인데
하나 하나 수작업으로 하자니 너무 힘들어서 source code 로 구글검색해서 이게 나왔는데
먼가 컴퓨터 프로그램같긴 한데 어떻게 응용파일에 넣어서 구동시켜야되는지를 모르게써
제발 알려줘..ㅠㅠ
어디다가 집어넣으면 되는거야? 무슨 프로그램? 아니면ㅇ ㅣ걸로는 안돼?
tell application “Microsoft Excel”
activate worksheet “Sheet1″
set N_step_count to 1
set N_branch_count to 3
set N_node_count to 0
set N to the text returned of (display dialog “enter the number of tree branches” default answer “5″) as integer
display dialog “Trinomial Step Count Set to ” & N
(* start node and bringing steps to +1*)
set Start_price to the text returned of (display dialog “Enter Start Price” default answer “5″) as number
display dialog “Start Price ” & Start_price
set Strike_price to the text returned of (display dialog “Enter Strike Price” default answer “5″) as number
display dialog “Strike Price ” & Strike_price
set Option_type to the text returned of (display dialog “Option type” default answer “Call”) as text
display dialog “Option type ” & Option_type
set Risk_free_rate to the text returned of (display dialog “Risk free rate” default answer “%”) as number
display dialog “Risk free rate ” & Risk_free_rate
set Security_yield to the text returned of (display dialog “Security yield” default answer “%”) as number
display dialog “Security yield ” & Security_yield
set Volatility to the text returned of (display dialog “Volatility” default answer “%”) as number
display dialog “Volatility ” & Volatility
set Time_to_maturity to the text returned of (display dialog “Days to Maturity” default answer “100″) as integer
display dialog “Days to Maturity ” & Time_to_maturity
set trinomial_parameters to {“Trinomial Steps”, “Start_price”, “Strike_price”, “Option type”, “Risk free rate”, “Security yield”, “Volatility”, “Days to Maturity”}
set trinomial_user_inputs to {N, Start_price, Strike_price, Option_type, (Risk_free_rate / 100), (Security_yield / 100), (Volatility / 100), Time_to_maturity}
set trinomial_cell_reference to {“$B$1″, “$B$2″, “$B$3″, “$B$4″, “$B$5″, “$B$6″, “$B$7″, “$B$8″}
set trinomial_variable to {“u”, “d”, “p(u)”, “p(d)”, “p(d)”}
set trinomial_formulas to {“=EXP(” & (item 7 of trinomial_cell_reference) & “*((2*(” & (item 8 of trinomial_cell_reference) & “/365)/” & (item 1 of trinomial_cell_reference) & “)^(0.5)))”, ¬
“=1/EXP(” & (item 7 of trinomial_cell_reference) & “*((2*(” & (item 8 of trinomial_cell_reference) & “/365)/” & (item 1 of trinomial_cell_reference) & “)^(0.5)))”, ¬
“=((EXP((” & (item 5 of trinomial_cell_reference) & “-” & (item 6 of trinomial_cell_reference) & “)*(((” & (item 8 of trinomial_cell_reference) & “)/365/” & (item 1 of trinomial_cell_reference) & “)*(0.5)))-EXP(-” & (item 7 of trinomial_cell_reference) & “*((((” & (item 8 of trinomial_cell_reference) & “)/365/” & (item 1 of trinomial_cell_reference) & “)*(0.5))^0.5)))/(EXP(” & (item 7 of trinomial_cell_reference) & “*((((” & (item 8 of trinomial_cell_reference) & “)/365/” & N & “)*(0.5))^0.5))-EXP(-” & (item 7 of trinomial_cell_reference) & “*((((” & (item 8 of trinomial_cell_reference) & “)/365/” & (item 1 of trinomial_cell_reference) & “)*(0.5))^0.5))))^2″, ¬
“=((EXP(” & (item 7 of trinomial_cell_reference) & “*((((” & (item 8 of trinomial_cell_reference) & “)/365/” & (item 1 of trinomial_cell_reference) & “)*(0.5))^0.5))-EXP((” & (item 5 of trinomial_cell_reference) & “-” & (item 6 of trinomial_cell_reference) & “)*(((” & (item 8 of trinomial_cell_reference) & “)/365/” & (item 1 of trinomial_cell_reference) & “)*(0.5))))/(EXP(” & (item 7 of trinomial_cell_reference) & “*((((” & (item 8 of trinomial_cell_reference) & “)/365/” & (item 1 of trinomial_cell_reference) & “)*(0.5))^0.5))-EXP(-” & (item 7 of trinomial_cell_reference) & “*((((” & (item 8 of trinomial_cell_reference) & “)/365/” & (item 1 of trinomial_cell_reference) & “)*(0.5))^0.5))))^2″, ¬
“=1-E3-E4″}
set row_counter to 1
repeat with i in trinomial_parameters
set value of cell (get address of cell row_counter of column 1) of worksheet “Sheet1″ to (item row_counter of trinomial_parameters)
set value of cell (get address of cell row_counter of column 2) of worksheet “Sheet1″ to (item row_counter of trinomial_user_inputs)
set row_counter to row_counter + 1
end repeat
set row_counter to 1
repeat with i in trinomial_variable
set value of cell (get address of cell row_counter of column 4) of worksheet “Sheet1″ to (item row_counter of trinomial_variable)
set value of cell (get address of cell row_counter of column 5) of worksheet “Sheet1″ to (item row_counter of trinomial_formulas)
set row_counter to row_counter + 1
end repeat
set N to N + 1
if Option_type = “Call” then
set Option_price to {“=MAX(” & (get value of cell (get address of cell 3 of column 5)) & “*”, ¬
“+” & (get value of cell (get address of cell 4 of column 5)) & “*”, ¬
“+” & (get value of cell (get address of cell 5 of column 5)) & “*”, ¬
“,”, ¬
“-” & Strike_price}
else
set Option_price to {“=MAX(” & (get value of cell (get address of cell 3 of column 5)) & “*”, ¬
“+” & (get value of cell (get address of cell 4 of column 5)) & “*”, ¬
“+” & (get value of cell (get address of cell 5 of column 5)) & “*”, ¬
“,-”, ¬
“+” & Strike_price}
end if
repeat N times
set value of cell (get address of cell (1 + (N) * 3) of column N_step_count) of worksheet “Sheet1″ to “=” & (item 2 of trinomial_cell_reference)
set value of cell (get address of cell (2 + (N) * 3) of column N_step_count) of worksheet “Sheet1″ to ¬
((get item 1 of Option_price) & (get address of cell ((N) * 3 – 1) of column (N_step_count + 2)) & ¬
(get item 2 of Option_price) & (get address of cell ((N) * 3 + 5) of column (N_step_count + 2)) & ¬
(get item 3 of Option_price) & (get address of cell (2 + (N) * 3) of column (N_step_count + 2)) & ¬
(get item 4 of Option_price) & (get address of cell (1 + (N) * 3) of column N_step_count) & ¬
(get item 5 of Option_price))
repeat N_node_count times
set value of cell (get address of cell (1 + (N) * 3 – (N_branch_count)) of column N_step_count) of worksheet “Sheet1″ to ¬
“=” & ((get address of cell ((N) * 3 – (N_branch_count) + 4) of column (N_step_count – 2))) ¬
& “*” & ¬
((get address of cell 1 of column 5))
set value of cell (get address of cell (2 + (N) * 3 – (N_branch_count)) of column N_step_count) of worksheet “Sheet1″ to ¬
((get item 1 of Option_price) & (get address of cell ((N) * 3 – (N_branch_count) – 1) of column (N_step_count + 2)) & ¬
(get item 2 of Option_price) & (get address of cell ((N) * 3 – (N_branch_count) + 5) of column (N_step_count + 2)) & ¬
(get item 3 of Option_price) & (get address of cell (2 + (N) * 3 – (N_branch_count)) of column (N_step_count + 2)) & ¬
(get item 4 of Option_price) & (get address of cell (1 + (N) * 3 – (N_branch_count)) of column N_step_count) & ¬
(get item 5 of Option_price))
set value of cell (get address of cell (1 + (N) * 3 + (N_branch_count)) of column N_step_count) of worksheet “Sheet1″ to ¬
“=” & ((get address of cell ((N) * 3 + (N_branch_count) – 2) of column (N_step_count – 2))) ¬
& “*” & ¬
((get address of cell 2 of column 5))
set value of cell (get address of cell (2 + (N) * 3 + (N_branch_count)) of column N_step_count) of worksheet “Sheet1″ to ¬
((get item 1 of Option_price) & (get address of cell ((N) * 3 + (N_branch_count) – 1) of column (N_step_count + 2)) & ¬
(get item 2 of Option_price) & (get address of cell ((N) * 3 + (N_branch_count) + 5) of column (N_step_count + 2)) & ¬
(get item 3 of Option_price) & (get address of cell (2 + (N) * 3 + (N_branch_count)) of column (N_step_count + 2)) & ¬
(get item 4 of Option_price) & (get address of cell (1 + (N) * 3 + (N_branch_count)) of column N_step_count) & ¬
(get item 5 of Option_price))
set N_branch_count to N_branch_count + 3
end repeat
set N_branch_count to 3
set N_step_count to N_step_count + 2
set N_node_count to N_node_count + 1
end repeat
end tell
제발도아줘
리플전나 달면 형들이 이걸 읽어줄까
리플전나 달면 형들이 이걸 읽어줄까
노원 노원 데어? 헬프미.. 프리즈 갓
야근이야? 아니면 왜 내 글이 제목이 재미가 없어보여서 조회수가 이런거야 왜인데 왜
읽어줘...
vbscript같은데