Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python~ Read a little about bitcoin and pick out some currencies you are interested in tracking in addition to bitcoin (you can track an additional

Python~

Read a little about bitcoin and pick out some currencies you are interested in tracking in addition to bitcoin (you can track an additional coin as one of final options). Make sure you can look up the price (for example, on Coin Market Cap) and also look for/peruse exchanges where you can trade it (like Binance). Identify some crypto news sites (like Coindesk). You do not have to join anything, buy anything, or do anything, just look.

We are going to assume that you each have $20,000 to invest. For this project we assume you only are going to be dealing with one currency: bitcoin (BTC).

Make a menu

Design a text based menu or a string based menu. If you did a text based menu for the horse racing try to do a string based menu on this.

1. The user can ask for the current value of bitcoin (just use a default value initially of 25000k, once you get that working change it so that Get Live value class generates a random price/range to simulate current market fluctuations).

price

2. They can buy bitcoin.

buy 0.5

Would buy you half a bitcoin. Make sure they have enough money to buy what they want to buy. Another acceptable way you could do this would be to have them say

buy 3000

Which would let them by 3K of bitcoin (you get the current price and figure out how much they can buy for that price)

3. They can sell bitcoin.

sell 0.5

Would sell half a bitcoin. Make sure they have enough bitcoin in their wallet to sell what they want to sell. Another option would be to have them say

sell 3000

Which would let them sell 3K worth of their bitcoin at the current price.

4. They can print their balance (show their current USD, the number of bitcoins they have, and USD value of the bitcoins they have)

balance

5. They can print the history of their buy and sell transactions out. This should have the time, which you can format however you want ie: bought 1 bitcoin on September 12, 2019.

history

There are functions available to get the current date and time. We will go over this. We will be using rand/random to generate a (fake) live value of bitcoin. Initially you can just use 25000 as the value when you first get started. We will use an array list (Java) or vectors (C+) or list or dictionary (Python) to store the command history and we will also cover making the classes for this in lecture

Lets say that you buy 1.5 bitcoin on September 15th at a market price of $10,000 per coin. Your cash balance would go down from 20K to 5K and the bitcoins in your wallet would go from none, up to 1.5. If you sold half a bitcoin for 6K dollars, your cash balance would go up to 11,000 and your number of bitcoins go down to 1.0.

Make a Class called Wallet

We need a class to store our imaginary coins in. Well, we can declare our own class, called Wallet, to help us get something done for this project. 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 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

We are going to use ArrayList(Java) Vectors(C++) List or 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

It all sounds very complicated but really we are just keeping track of how many coins we actually have, as well as how much US dollars we have. 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. The variable that stores your actual US dollars (USD) does not really need to be in a class if you dont want it to be.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions

Question

9. Mohawk Industries Inc.

Answered: 1 week ago