CS计算机代考程序代写 python Programming in Python

Programming in Python



You can work on it either alone or in duo’s
Add the name of your partner in google spreadsheet
You will not be quoted differently if you make the project alone
You can work on the code together, however, I expect an individual paper per person
The code should be available on Bitbucket as a private repository!
The project deadline is 10th of March at midnight (so before 11th)
The peer evaluation deadline is 15th of March at midnight (so before 16th)
The points are distributed as follows
8 points on the code
8 points on paper
4 points the peer-evaluation



The code should be placed on bitbucket
I highly recommend using git and not just putting it there in the end
Use the programming types (FP & OOP) and keep a clear structure in your code
DOCUMENT(!!) your code AND project (readme)
it should be clear what you do by just reading the actual code
Try to follow the pep8 coding style guide
(pycharm will let you know as well)
Part 1 should be submitted to bitbucket by 20/02/2021 at midnight
Part 2 should be submitted to bitbucket by 27/02/2021 at midnight
Part3 and Part 4 should be handed in 10th of March at midnight together with the INDIVIDUAL paper
Make sure to add me (GertDeGeyterToulouse) your two peer evaluators (see spreadsheet)
Can not be adjusted after!



LINK TO YOUR REPOSITORY!!!!!!!!!!!!!!!!!!!!!!
Around 3-5 pages (not including title page and references) explaining how you solved the problem
If you had any problems solving the project, explain what your problem was, how you’ve tried to solve it etc.
Graphs of results, diagrams of your program structure …
Should contain references to sites, papers, etc. that you have used
Place it on the google drive folder in your group on the day of the deadline!
Your paper should be called Firstname_Lastname_Unamur_paper.pdf




Everyone will receive two names: see https://docs.google.com/spreadsheets/d/1MfHOfpskCmewdj4nLK1zw-XaKYqeRSCK52qqsG09x_s/edit?usp=sharing
(the peers tab will be visible after all students have assigned a group)
After the deadline of the project everyone will have to evaluate 3 people
2 fellow students:
Write about half a page per student on things you’ve liked and disliked
Keep in mind everything (paper, coding style, method, structure,…)
Give a grade 10 on project and 10 on the paper
Self assessment: (DON’T FORGET YOURSELF!!!)
Now that you have seen the other projects how would you grade yourself?
What did you do well and what would you do different now?
Grade yourself as well
The grades you give will NOT be used
Place it on the google drive folder in your group:
Your peer evaluation should be called Firstname_Lastname_Unamur_peer.pdf
The peer evaluation deadline is 15th of March at midnight

Peer Evaluation



20/02: Fill in group, name, email and bitbucket the spreadsheet AND Submit part 1 to bitbucket
27/02: Submit part 2 to bitbucket
10/03: Deadline for code and individual paper (3-5 pages):
Submit part 3 and part 4 to bitbucket. Use the timestamp of the final submission in your paper.
Invite GertDeGeyterToulouse (gert.de-geyter@tsm-education.fr)
and your two peers to the PRIVATE repo
Your paper should be called Firstname_Lastname_TSM_paper.pdf
Place your paper in your group folder on the google drive folder:
Code can not be adjusted after
In case of emergency (and failing technology) mail to gertdegeyter@gmail.com

15/03: Deadline for Peer-evaluation paper place in your OWN group folder on google drive
Your peer evaluation should be called Firstname_Lastname_TSM_peer.pdf





Disclaimer: In this project we’ll write a simulation of several types of investors. Obviously, there will be a lot of assumptions made in this project and it should in no way be seen as a realistic modelling tool rather than programming exercise. Should you want to make any adjustment to make the case more realistic you are invited to do so, however, don’t get lost in this and make sure that you focus on the main goal of this project: using, understanding and structuring Python code.

The goal will be to model three types of investors: aggressive, defensive and mixed. There are two types of investments: stocks and bonds. Aggressive investors only investigate in stocks, defensive investors only in bonds. Mixed investors are a combination of both extremes. The process will be split up as follows. In Part1 we will start by modelling two types of bonds: long term and short term. In Part2 the goal will be to use pandas to read in stock data and model stocks. Part 3 will consists out of creating the three types of investors and setting up everything correctly. In part 4 you will be asked to simulate a few scenario’s and show that you have written your code in such a way that you can easily provide a solution without much changes.


In this part we will start by modelling the bonds. It will be up to you to decide how you structure this given that you will have to incorporate what you do here in the further stages.
Create a new repository on bitbucket and make sure you have setup everything
Bonds have the following characteristics: a term that we’ll invest in them, a certain amount that will be invested, a minimum price of the bond, a minimum term and yearly interest rate
Short term bonds have a minimum term of 2 years, a minimum amount of 250$ and a yearly interest of 1.5%
Long term bonds have a minimum term of 5 years, a minimum amount of 1000$ and a yearly interest of 3%
Both bonds are compounded yearly and have a way to calculate the compounded interest for a certain time t
Make a plot of the evolution of the investment of the minimum allowed invested amount for both bonds over a period of 50 years.


In this part we will start by modelling the stocks. You are free to either use the data provided in the CSV files . The names of the stocks in scope are : ‘FDX’, ‘GOOGL’,’XOM’, ‘KO’, ‘NOK’, ‘MS’, ‘IBM‘ from a period of 09/01/2016 to 01/01/2021
Stocks have the following criteria: a term during which the investment will be done, a certain invested amount, a stockname (see above), the number of stocks bought and the date on which they we’re bought (notice only business days are possible).
We will assume that we can buy and sell them without additional transaction fees.
Use the ’High’ column as the price of the stocks.
It should be possible to (given the start and enddate) to get the price of the stock and return on investment. If a start and end date is not a business day take the closest possible business day before the the given date.
Make a plot of all stocks for the entire period

PArt3: Investors

Here we start taking everything together.
An investor will start with a certain given budget, an investor mode (aggressive, defensive or mixed)
A defensive investor will only invest in short and long term bonds. He will randomly invest (50-50) in long and short term bonds as long as he has at least enough money to pay for a short term bond.
An aggressive investor will only invest in stocks. First a randomly chosen stock will be selected. Then, depending on the investor remaining budget, a random amount of stocks between 0 and the maximum of stocks that investor would be able to buy is bought. This is repeated until he has less than 100$ available.
A mixed investor will invest first have a 25-75 chance of buying a bond or stocks. If he buys a bond it is distributed 50-50 in long and short. If he buys a stock, the same rules apply as the aggressive investor. In this case the mixed investor will keep on investing until the has not enough to buy the short term bond.
Model 500 aggressive investors, 500 mixed investors and 500 defensive investors with a starting budget of 5000. What do you conclusions can you draw from this?
For now you can assume bonds are kept even after their minimum term.


Now let’s see how we can use the code written before to easily model the following scenario’s or answer the following questions. Make a separate file called Simulations.py to model these results.
If you have written your code in a robust way it should not take too much effort to adjust the following:
When taking the same input parameters as above (part3) and again modelling the same number of investors with that starting capital, plot the means for every year in the given dataset (always going from 01/01 to 31/12)
From now on, mixed investors redistribute their budget randomly again when their bond periods end
(again 25-75 bonds vs stocks, 50-50 long term short, …) what is the impact? What if we switch 75-25 bonds vs stocks
Do you notice a change when multiplying all starting budgets by 10?


What was on average the best year for an aggressive investor (always going from 01/01 to 31/12)
Model the same number of investors but now have starting budget randomly from a normal distribution centered around 20000 with a standard deviation of 5000 (keep in mind the tails to the lower side).
What was the best stock to have in 2007?

Leave a Reply

Your email address will not be published. Required fields are marked *