Question
In Python, please help! We are going to assume that you each have $20,000 to invest. Make a menu Design a string based menu. 1.
In Python, please help!
We are going to assume that you each have $20,000 to invest.
Make a menu
Design a string based menu.
1. The user can type price for the current value of bitcoin (just use a default value initially of 25000, once you get that working change it so that Get Live value class explained below that generates a random price/range to simulate current market fluctuations).
2. They can buy bitcoin (float).
buy 0.5
Would buy you half a bitcoin. Make sure they have enough money to buy what they want to buy.
3. They can sell bitcoin (float).
sell 0.5
Would sell half a bitcoin. Make sure they have enough bitcoin in their wallet to sell what they want to sell.
4. They can print their balance by typing balance (show their current USD, the number of bitcoins they have, and USD value of the bitcoins they have)
5. They can print the history of their buy and sell transactions out by typing history. This should have the time, which you can format however you want ie: bought 1 bitcoin on September 12, 2019.
You need the following classes for this project:
Make a Class called Wallet
Our wallet class is going to help us store our information on a single cryptocurrency.
For our Wallet class, we need to store a few things
1) We need to store the ticker symbol (BTC) for the coin 2) We need to store how many coins we currently have 3) We also need a print method in the class that will print the information out. So, this method will print out the ticker symbol (BTC) for the coin and the number of coins currently in the wallet.
Make a Class called Ledger
We need a class that is going to turn our transactions into a string and store them for our history.
1) It will store the transaction strings just so we have a record of the buy sell commands 2) It will be able to print out the transaction history if requested
Use Dict (Python) for this.
Make a Class called MyDate
This class will call the library routines to get the current date. It will have a function in it that returns that date as a string. We need this for our transaction history.
Make a Class called GetLive
This is going to fetch the current live value of bitcoin. (For now we fake it by generating a random number between 10k and 12k (or whatever makes sense when you get this assignment since bitcoin price is all over the place).
Putting it all together
When you buy coins your US dollars go down and the number of bitcoins goes up accordingly. When you sell coins your US balance goes up and the number of coins you have goes down.
Any help would be appreciated. Thank you!
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