MA323财经数学pytho算法
Posted athsr70
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MA323财经数学pytho算法相关的知识,希望对你有一定的参考价值。
MA323 Computational Methods in Financial Mathematics
Assessed Coursework (2023)
02/03/2023
1 Guidelines
1.1 Submission
Your coursework must be submitted by
Monday 17th April 2023, 4pm (UK time).
All consequences regarding late submission can be found on the School’s website
https://info.lse.ac.uk/Staff/Divisions/Academic-Registrars-Division/
Teaching-Quality-Assurance-and-Review-Office/Assets/Documents/Calendar/
GeneralAcademicRegulations.pdf
Note in particular: Five marks (out of 100) will be deducted for coursework submitted late
within 24 hours of the deadline and a further five marks will be deducted for each subsequent
24-hour period until the coursework is submitted.
After five working days, coursework will only be accepted with the permission of the Chair
of the Sub-Board of Examiners.
Please submit your complete report together with all files to E.P.Moonien@lse.ac.uk.
Include “MA323 submission” in the subject line.
For the submission please only submit one zip-file that contains all your files except
the Plagiarism Statement, which you should submit in the same email. Your zip-
file should have the following name: If your candidate number is 123456, then name your
zip-file MA323 CN123456.zip.
Your zip-file must contain your Jupyter Notebook (please provide an ipynb file, which the
examiners can run, and a pdf version of it.) You should name these files according to your
course code and candidate number, e.g., MA323 CN123456report.ipynb.
The content of your work must remain anonymous, so do not write your name on anything ex-
cept the Plagiarism Statement. Instead, you must identify your work with your Examination
Candidate Number. You can check your candidate number on ‘LSE for You’.
1.2 Academic integrity
When you submit the coursework you must submit a completed and signed copy of the
Plagiarism Statement (available on Moodle).
You are required to read the information on plagiarism on the following website:
https://info.lse.ac.uk/Staff/Divisions/Academic-Registrars-Division/
Teaching-Quality-Assurance-and-Review-Office/Assets/Documents/Calendar/
RegulationsAssessmentOffences-Plagiarism.pdf
1
Note in particular the first paragraph on this website:
“All work for classes and seminars (which could include, for example, written assignments,
group work, presentations, and any other work, including computer programs) must be the
student’s own work. Direct quotations from other work must be placed properly within
quotation marks or indented and must be cited fully. All paraphrased material must be
clearly acknowledged. Infringing this requirement, whether deliberately or not, or passing off
the work of others as the student’s own work, whether deliberately or not, is plagiarism.”
You must take this assessment completely alone and not show or discuss it with anyone else.
This is an open book assessment and you are allowed to use any material made available on
Moodle for MA323 and any academic literature as long as you cite the material that you use
fully.
You are not permitted to: consult any other person or AI tool about the content of the
assessment; allow any other person or AI tool to edit or proofread your work; submit any
ideas or phrasing that are not your own (without appropriate citation).
You should not include any writing of your own that has been submitted for a different
summative assessment.
The examiners may conduct vivas to check that you were the author of your submitted
assessment.
1.3 Specific guidelines on report
The coursework consists of four problems. Your answers to all four problems will count
towards the final mark.
Write a report and not just a question-answer style exercise set solution to answer the ques-
tions. Your report should contain all results and their derivation, interpretation and discus-
sion. Use complete sentences throughout. Give detailed arguments to explain your ideas and
carefully justify your answers.
The only acceptable programming languages are Python 3.7, 3.8, 3.9, 3.10, or 3.11.
Please provide only one notebook. Separate answers to the different questions clearly in this
notebook.
Your submitted Jupyter notebook should run completely without any error messages.
In particular, note that your Jupyter notebook should NOT ask the user to enter variables
needed for the computation. Choose reasonable default parameters yourself and make clear
in your instructions what the meaning and the names of the variables are such that the
examiners can test several examples.
Add appropriate comments to your code to explain what your code is doing.
Your figures should be well formatted, with good axis labelling and appropriate titles.
1.4 Assessment
The coursework will be marked in line with the departmental assessment criteria which are available
on pages 19/20 of your student handbook:
https://www.lse.ac.uk/Mathematics/assets/documents/Handbooks/2022-23/
22-0201-UG-Mathematics-Handbook-Final.pdf
? LSE 2023 2
2 Coursework Description
If you use a random number generator for any of the problems below, seed the generator so that
the results are reproducible.
Problem 1. Consider the two integrals.
(a) Describe a numerical method to approximate the value of I1 such that the approximation error
is guaranteed to be bounded by 1/100. Implement this method in Python and provide the value
of the approximation.
(b) Explain how one can approximate the integral I2 using a Monte-Carlo estimator. Implement
the Monte-Carlo estimator in Python and provide a figure that plots a Monte-Carlo estimate
against the number of samples (as we have done in the lectures and programming sessions).
Describe a variance-reduction technique that can be applied here and discuss how well this
technique works in this example.
(c) Develop and implement a Monte-Carlo estimator in Python to approximate the sum S.
Problem 2. Consider the function f : R→ R given by
f(x) =
3
2(x? 1)2, if x ∈ (0, 2),
0, if x /∈ (0, 2).
(a) Suppose you would like to generate a sample from f using von Neumann’s acceptance-rejection
algorithm. Specify a probability density function g ?= f that can be used for this purpose
and describe in detail how you can obtain a sample from f by sampling from g using von
Neumann’s acceptance-rejection algorithm. For your choice of g what is the best possible
proportion of numbers that your algorithm accepts? Implement von Neumann’s acceptance-
rejection algorithm in Python to obtain 10000 samples from f and plot a histogram of the
samples.
(b) An alternative to von Neumann’s acceptance-rejection algorithm from part (a) for sampling
from f would be to use the inverse transform method. Implement it in Python and draw again
a histogram of the samples. Which of these two methods do you think is more suitable for
generating a sample from f and why?
Hint: If you get a Python runtime warning, the following discussion might help:
https://stackoverflow.com/questions/45384602/
numpy-runtimewarning-invalid-value-encountered-in-power
? LSE 2023 3
Problem 3. We consider a financial market consisting of three assets (one riskless asset and two
stocks). The riskless asset has time-t price Bt = e
rt, where r ≥ 0 is the constant interest rate, and
the two stocks have time-t prices
0 > 0 are the initial stock prices, σ > 0 and η > 0 are the volatilities, and
(WAt )t≥0 and (WBt )t≥0 are independent Brownian motions under the risk-neutral measure. (In
Latex, η is written as \\eta.)
Consider a European option with payoff H at the maturity date T > 0 given by
H = maxSAT , SBT .
(a) Write down a Monte-Carlo estimator for the time-0 price of this option. Justify your answer.
(b) Explain in detail how one can generate the random variables that are used in your Monte-
Carlo estimator in part (a).
(c) Write Python code that computes the approximation of the time-0 price of the option using a
Monte-Carlo estimator.
(d) Use your Python code to compute the time-0 price of the option for the model parameters
SA0 = 4, S
B
0 = 3, r = 0.01, σ = 0.2, η = 0.4, T = 2 using the Monte-Carlo estimator.
? LSE 2023 4
Problem 4. We now consider a financial market consisting of two assets (one riskless asset and
one stock). We still assume that the time-t price of the riskless asset is given by Bt = e
rt with
r ≥ 0. We now assume that the dynamics under the risk-neutral measure of the risky asset are
given by
dSt = rStdt+ σ(St ? 1)dWt,
where (Wt)t≥0 is again a Brownian motion under the risk-neutral measure and σ > 0. We assume
S0 > 1.
(a) Explain how you can generate a sample path of S = (St)t≥0 on the discrete time grid 0 < h <
2h < . . . < nh for h > 0, n ∈ N. Write Python code that provides samples of ST for T > 0.
Create a plot with ten sample paths of (St) for S0 = 4, r = 0.01, σ = 0.2, and T = 1 with
h = 1/250.
(b) Consider a European call option with strike K = 4erT , i.e, an option whose payoff H at the
maturity date T > 0 is given by
H = (ST ? 4erT )+.
Write down a Monte-Carlo estimator for the price of this option. Justify your answer.
(c) Write Python code that computes the approximation of the time-0 price of the option using a
Monte-Carlo estimator together with an asymptotic confidence interval. Use your Python code
to compute the time-0 price of the option for the model parameters S0 = 4, r = 0.01, σ = 0.2,
T = 1 using the Monte-Carlo estimator. Provide a 95%-asymptotic confidence interval for
the time-0 price of the option. Discuss your results.
(d) Specify a variance-reduction technique for approximating the time-0 price of the option in part
(b) and implement it in Python. Discuss your findings.
WX:codehelp mailto: thinkita@qq.com
代做公式选股指标公式帮做代做公式选股30分钟均线模型-文华财经公式
内容:
依据30分钟线交易。
5天线大于10天线同时10天金叉20天线做多,
5天线死叉10天线平多,5天线小于10天线同时10天线死叉20天线做空,
5天线金叉10天线平空。
如果同一根K线满足平空做多或平多做空则合并执行。
模型编写如下,请您参考:
MA5:MA(C,5);
MA10:MA(C,10);
MA20:MA(C,20);
MA5>MA10CROSS(MA10,MA20)CROSS(MA5,MA10),BPK;
MA5MA10CROSS(MA10,MA20),BK;
CROSS(MA10,MA5),SP;
MA5CROSS(MA5,MA10),BP;
AUTOFILTER;1、蓝蝴蝶软件工作室,现已经为客户定做500多套软件,本店专业定做ERP、OA、进销存管理系统、数据统计和分析 、数据库维护、API对接。
2、大数据处理与分析(10G文本文件)和excel处理等.
3、Acesss、MSSQL、SQLServer、Oracle数据库的维护和数据库设计、升迁等.
4、通达信,金字塔、TB等指标公式,量化开发。
5、诚心诚意为你服务是本工作室的宗旨。
如有需要,请加QQ:88652583 或微信:
以上是关于MA323财经数学pytho算法的主要内容,如果未能解决你的问题,请参考以下文章