Question
Use Python to implement the following vanilla investment strategy: Put $1 in each investment machine for 10 times to see which one returns more money
-
Use Python to implement the following vanilla investment strategy:
-
Put $1 in each investment machine for 10 times to see which one returns more money (thus, you
have invested a total of 20 times). Break tie whatever way you prefer.
-
For the remaining money, always invest half (of the current remaining total money) in the more
profitable machine discovered each time, for the last 10 times of investment.
-
Simulate this strategy for 1000 times. Print out the average amount of return, the standard deviation, and the Sharpe Ratio you end up with using this strategy.
The standard deviation measures how spread out a set of numbers is. (see sample code below to learn how to calculate std with the python numpy module). The Sharpe Ratio is a way to evaluate the performance of investment by adjusting for its risk. The ultimate goal of the investment is to maximize the Sharpe Ratio, defined as follows:
(average gain) / (standard deviation + 1), where average gain = average return - risk free amount (in this case: the risk free amount = $100). That is, we seek for a higher return, with relatively low volatility. To avoid the rare situation where the standard deviation is 0, we add 1 in the demometer.
Then design and implement a better investment strategy (with a larger Sharpe Ratio) than the vanilla one above.
Useful background info: In artificial intelligence (AI), the first step in the vanilla approach above is often called exploration which uses trial-and-error to see which option is best. The second step is often called exploitation which exploits the newly learned best option to make a maximum profit. Exploration and exploitation can be interleaved and integrated in sophisticated and intelligent ways to achieve an optimal outcome.
In real-world, things are often much more complicated. For example, there are usually more investments to choose from, each with an unknown distribution of returns which may vary over time, and so on. This type of problems in this assignment do have widespread important applications. The investments can be the restaurants you are exploring and enjoying in a new city, different subjects you try to choose in universities, or different jobs/career you want to work for in your life. The assignment may also be helpful to improve your rational decision-making under uncertainty.
You must define and use the following functions in your final submission:
-
Define and use the main function
-
Define and use a function for repeated investment of a fixed amount in one machine. The function should take three arguments: the machine number, the money you invest each time, and total times you invest with the fixed amount. You will see the benefit of defining such a function, which is an abstraction for repeated calculations.
-
Define and use a function for repeated investment of a fixed percentage of the current total money you have in one machine. The function should take three arguments: the machine number, the percentage you invest each time, and total times you invest with the fixed percentage.
-
You can define any other functions if needed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started