0% found this document useful (0 votes)
81 views76 pages

Price Prediction of Bitcoin Documentation

The document is a project report submitted by Neknath Uday Kumar and Lee Thomas in partial fulfillment of the requirements for a Bachelor of Science degree in Computer Science and Engineering. The report describes an Arduino-based system that uses hand gestures detected by ultrasonic sensors to control functions of a computer, such as music, video, browsing, and gaming. Python's PyAutoGUI library is used to perform tasks on the computer based on distance data received from the Arduino via a serial port. The system aims to provide a more intuitive interface than traditional input devices like keyboards and mice.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views76 pages

Price Prediction of Bitcoin Documentation

The document is a project report submitted by Neknath Uday Kumar and Lee Thomas in partial fulfillment of the requirements for a Bachelor of Science degree in Computer Science and Engineering. The report describes an Arduino-based system that uses hand gestures detected by ultrasonic sensors to control functions of a computer, such as music, video, browsing, and gaming. Python's PyAutoGUI library is used to perform tasks on the computer based on distance data received from the Arduino via a serial port. The system aims to provide a more intuitive interface than traditional input devices like keyboards and mice.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 76

A PROJECT REPORT ON

Arduino based Hand Gesture Control of computer


A Project Report submitted in partial fulfillment of the requirement for the award of

Degree of Bachelor of sciences

In

Computer Science & Engineering

By

NEKNATH UDAY KUMAR - 111719013053

LEE THOMAS - 111719013044

Department of Computer Science and Engineering

Loyola Academy

Old Alwal,Secunderabad,500010

(Autonomous and Affiliated to Osmania University)

Re-accredited by “NAAC” with ‘A’

A “College with Potential for Excellence” by UGC

2021-2022
A PROJECT REPORT ON

Arduino based Hand Gesture Control of computer


A Project Report submitted in partial fulfillment of the requirement for the award of

Degree of Bachelor of sciences

In

Computer Science & Engineering

By

NEKNATH UDAY KUMAR - 111719013053

LEE THOMAS - 111719013044

Department of Computer Science and Engineering

Loyola Academy

Old Alwal,Secunderabad,500010

(Autonomous and Affiliated to Osmania University)

Re-accredited by “NAAC” with ‘A’

A “College with Potential for Excellence” by UGC

2021-2022
Loyola Academy
Old Alwal,Secunderabad,500010

(Autonomous and Affiliated to Osmania University)

Re-accredited by “NAAC” with ‘A’

A “College with Potential for Excellence” by UGC

CERTIFICATE

This is to certify that the project entitled Arduino based Hand Gesture Control of computer
is a record of bonafide work carried out during III year 5 st semester as partial fulfillment for the
award of the DEGREE OF BACHELOR OF SCIENCES IN COMPUTER SCIENCE AND
ENGINEERING During the academic year 2021-22.

The results embodied in this project report have not been submitted to any other University or
Institute for the award of any Degree or Diploma

NAME : NEKNATH UDAY KUMAR , LEE THOMAS

CLASS : DCS

UID NO : 111719013053, 111719013044

HEAD OF THE DEPARTMENT PRINCIPAL

EXTERNAL EXAMINER INTERNAL EXAMINER


Arduino based Hand Gesture Control of computer 2021-2022

DECLARATION

We hereby declare that the project entitled “Arduino based Hand Gesture
Control of computer” done by NEKNATH UDAY KUMAR
(111719013053) and LEE THOMAS (111719013044) submitted a record of an
original work done by us.

The project has been successfully completed and submitted in partial fulfillment of
the requirements for the award of “DEGREE OF BACHELOR OF SCIENCE
IN COMPUTER SCIENCE AND ENGINEERING” from “LOYOLA
ACADEMY” affiliated to “Osmania University, Hyderabad” in the authentic
way and has not been submitted in any other university or institution for the award
of any degree or diploma.

NEKNATH UDAY KUMAR (111719013053)


LEE THOMAS (111719013044)

B.Sc. COMPUTER SCIENCE AND ENGINEERING i


Arduino based Hand Gesture Control of computer 2021-2022

ACKNOWLEDGEMENT

“Task successful” makes everyone happy. But the happiness wills gold without glitter if we didn’t
state the persons who have supported us to make a success.

Success will be crowned to people who made it reality but people who constant
guidance and encouragement made it possible crowned first on the eve of success.

This acknowledgement transcends the reality of formality when we would like to


express deep gratitude and respect to all those people behind the screen who guide,
inspire and helped us for the completion of our project work.

I would like to express our thankfulness to our project guide MRS.K.ANITHA, Head
of the Department for her constant motivation and valuable help through the project
work, and we express our gratitude for her supervision, guidance and cooperation
through the project.

I also extend my thanks to my team member for their cooperation during my


course.Finally I would thank my friends for their cooperation to complete this project

B.Sc. COMPUTER SCIENCE AND ENGINEERING ii


Arduino based Hand Gesture Control of computer 2021-2022

ABSTRACT

Innovative approaches like hand gestures play a vital role in this


emerging world and evolving time of Industry, because they are simply
accessible and are efficient in detecting nearby objects. The need for
hardware components such as the keyboard and mouse can be drastically
reduced with this hand gesture technique.

We utilize ultrasonic sensors to identify and characterize hand gestures


in real- time in this paper. Ultrasonic sensors use ultrasonic sound waves to
measure the distance between a target item and then transform the reflected
sound into an electrical signal.

The main goal of the paper is to use Arduino and Ultrasonic sensors, as
well as various Python packages, to enhance the precision and speed of the
computer interface.

Keywords–

 Hand gesture,
 IoT,
 Ultrasonic sensors,
 Arduino-uno,
 Python,
 Gesture control

B.Sc. COMPUTER SCIENCE AND ENGINEERING iii


INDEX

CONTENTS PG.NO
S.NO

Abstract
1. Introduction
2. System Specifications
2.1. Software requirements
2.2. Hardware requirements
3. System Analysis
3.1. Existing System
3.2. Proposed System
3.3. Feasibility Study
3.4. Modules
4. System Design
4.1. Input Design
4.2. Output Design
4.3. System Architecture
4.4. UML Diagram
6. Output Screens
7. Conclusion
8. Future Enhancement
9. References
10. Appendix-A
11. Appendix-B

S.NO LIST OF FIGURES PG.NO.


1. 4.1. Input Design
2. 4.2. Output Design
3. 4.3. System Architecture
4. 4.4. UML Diagram
5. 4.4.1. Use Case Diagram
6. 4.4.2. Class Diagram
7. 4.4.3. Sequence Diagram
8. 4.4.4. Activity Diagram
9. 4.4.5. Collaboration Diagram
10. 4.4.6. Deployment Diagram
11. 4.4.7. Component Diagram
12. 5. Output screens
Arduino based Hand Gesture Control of computer 2021-2022

Arduino based Hand Gesture Control of computer

1. INTRODUCTION

In today’s world of automation, hand gesture technology is not just


limited to gaming application but also in various areas such as medical application,
industry application, IT hubs, Banking sectors, etc. This project is based on a
similar concept of hand gesture control-based laptop or computer. Human
Machine Interface (HMI) is a system that consists of hardware and software which
helps to initiate a communication and information exchange between the user and
the machine. We generally use various indicators such as LED’s, Switches, Touch
Screens and LCDs as a part of HMI devices. Another unique way of
communicating with machines like Robots or computers is with the help of Hand
Gestures.
Instead of using various equipment like keyboards, mouse, joystick,
etc, now simply we can use hand moments/hand gesture to control the functions of
the computer/laptop. In this project, we have implemented Arduino based hand
gesture control where one can control music, video, browser, documents, gaming,
navigation and many others tasks. We have used two ultrasonic sensors and
attached to Arduino. The ultrasonic sensors are attached at the top of the computer
on either side which is used to calculate the distance between the hand and the
sensor. Using the following information of the distance between the hand and the
sensors, the above operations are executed. Python Pyautogui library is used to
perform mentioned tasks on our laptop/computer. From Arduino, the commands
are sent to the computer via a serial port. Python reads this incoming data which is
running on the computer/laptop and finally based on these incoming read data, the
following tasks and operations are executed

B.Sc. COMPUTER SCIENCE AND ENGINEERING i


Arduino based Hand Gesture Control of computer 2021-2022

SYSTEM SPECIFICATIONS

SOFTWARE REQUIREMENTS:

The functional requirements or the overall description documents include the

product perspective and features, operating system and operating environment,

graphics requirements, design constraints and user documentation.

The appropriation of requirements and implementation constraints gives the

general overview of the project in regards to what the areas of strength and

deficit are and how to tackle them.

 Arduino UNO x 1
 Ultrasonic Sensors x 2
 USB Cable (for Arduino)
 Few Connecting Wires
 A Laptop with internet connection

B.Sc. COMPUTER SCIENCE AND ENGINEERING i


Arduino based Hand Gesture Control of computer 2021-2022

HARDWARE REQUIREMENTS:

Basic Hardware Connection

The gesture control is based on specifying the hand moments from the ultrasonic sensor.
This project is implemented using various components. We need to deploy ultrasonic
sensors which are connected to Arduino, then place yor hand in-front of the Ultrasonic
sensor which will calculate the distance between the hand and the sensor. Using this
following information, particular task or operation will be executed

1. ULTRASONIC SENSORS

The following figure will explain the steps to perform the operations in the
system by using hand gestures. The hand or any item should first be positioned
in front of the sensors, after which the sensors will emit sound waves, which
will travel through the air and be reflected as echo waves when they strike our
hand or any item, that is received by echo hole.

ARDUINO BOARD

LAPTOP/PC

2. Working of Ultrasonic Sensors

In the real world, the ultrasonic sensors are used for interacting with robots,
computers and other devices. This sensor senses the proximity and detects
levels with high

reliability. The ultrasonic sensor measures the distance to a particular object


with the help of ultrasonic sound waves. Ultrasonic sensors make use transducer
to send and receive ultrasonic pulses. High-frequency sound waves reflect from
boundaries to produce distinct echo patterns.

Ultrasonic sensors work by emitting sound waves at a particular frequency. The


transducer of the sensor acts as a microphone to receive and transmit the
ultrasonic sound. The sensors determine the distance to a targeted object. The
distance is determined by calculating time lapses between the sending and
receiving of the ultrasonic pulse. It sends a 40KHz ultrasonic pulse that travels
through the air. If there is an obstacle or an object, it will bounce back the signal
towards the sensor. based on the time taken by the waves to travel and the speed
of sound, the distance is computed.

Distance = (Speed of the waves × Time taken to travel)/2 The calculated


distance is divided because the waves are first transmitted by the transmitter and
then received by the receiver.

3. Layout of Arduino Uno Board

The Arduino is an open- source electronic platform which is used to build the
hardware (microcontroller, a small computer) and software projects. Arduino board
consists of both hardware part and also software part (IDE). Arduino board is used
for controlling certain defined functions. Arduino board is powered by using a USB
Cable from computer, etc.

There are specific dedicated pins such as:

 Ground (GND) connection


 3.3V and 5V Power Supply
 Analog Pins (A0 to A5)
 Digital Pins (Pin Number: 0 to 13)
 PWM Pin (Pin Number: 8)
 AREF (Pin Number: 9)

Arduino Board has 14 input/output pins. Language used for programming the
Arduino board could be C/C++. Arduino board also consists of Reset Button, that
temporarily connects the reset pin to the ground and restart the code that is loaded
on Arduino Board. Power LED Indicator is also integrated on the Arduino board.
This LED will turn on whenever we plug the Arduino into a power source. TX and
RX LEDs are used during serial communication. TX and RX Pin are used for
transmitting and receiving of data. The main IC on the board belongs to the AT
Mega family, 328 AT Mega IC.

4. Circuit Connection

The circuit diagram of Arduino and the setup is quite simple. The trigger and echo
pins of the first ultrasonic sensor are connected to two pins of Arduino board. For
second ultrasonic sensor, the trigger pin and echo pin are also connected to two
different pins. The Ultrasonic calculate the distance between the hand moments and
the sensor and using the following information, the laptop/computer performs the
task/operations. The information of distance from Arduino is collected by Python
program. PyAutoGUI, a special library converts the data into keyboard click
actions.

5. Universal Serial Bus (USB) Cable

USB is an industry-standard that specifies the cables, connections, and protocols


for connecting, communicating, and powering personal computers and associated
peripheral devices. The USB standard, which was first established in 1996, is
currently maintained by USB implementers. USB was developed to regulate the
communication and power supply of peripherals such as keyboards, pointing
devices, digital still and video cameras, printers, portable media players, disc
drives, and network adapters to personal computers. It has largely replaced serial
and parallel ports and is now used on a wide range of devices. USB ports are
gradually replacing older forms of portable device battery chargers.

6. Jumper Wires

Jumper wires are simple cables having connector pins on both ends that may be used to
connect two points without the use of solder. Jumper wires are commonly used with
breadboards and other prototyping tools to allow for quick circuit changes. It's quite
straightforward, Jumper wires are the most fundamental of all electrical components.

B.Sc. COMPUTER SCIENCE AND ENGINEERING i


Arduino based Hand Gesture Control of computer 2021-2022

SYSTEM ANALYSIS

EXISTING SYSTEM

There are several techniques to control a computer utilising hand gesture


approach. Each method has its advantages and disadvantages. Let's look into
different methods in brief.

1) Controlling computer using color bands

While using colour bands users use red, blue and green bands and put them to their
fingers. So, while using this technique kinect sensor projects an infrared pattern of
307,200 dots in a 640 × 480 mesh and receives reflected pattern CMOS monochrome
sensor. This structured light application permits the machine to estimate the intensity
of every point using triangulation. Moreover, an RGB camera provides synchronised
colour information for each point.

2) Controlling computer web cameras

Using web camera technology, we need a projector which projects the display on
a clear wall or any other plain surface. User can interact with the projected screen using
his fingertips which are tracked in the air by the camera using camshaft tracker. A
related study of distinct methods of hand gesture detection has been made. Here an
efficient technique is employed to identify the hand gestures which are transformed into
relevant actions.

B.Sc. COMPUTER SCIENCE AND ENGINEERING i


Arduino based Hand Gesture Control of computer 2021-2022

3) Controlling computer using IR sensors

When we are working with IR sensors the user is equipped with a glove which was
fitted with IR sensors that acts as a bridge between user and computer. The gloves are
used to recognize the hand gestures of the disabled people and convert those gestures into
meaningful messages in real time. With the amount of bend made by the fingers
continuous data stream is obtained as output from Infrared (IR) sensor. IR sensors change
the output voltage depending on the strength of the received signal. Change in bend is
converted to change in the electrical voltage by IR sensors. The output from IR sensors is
processed by a microcontroller and a corresponding message is displayed.

Limitations in existing system

 Controlling the computer with hand gestures using projectors is only used for
gamming applications and this will not sense the objects exactly when the lighting
was changed.

 When controlling the computer with hand gestures using web cameras, it is
difficult to interact with system using camshaft in the air and this is time taken
thing to project on the plain surface and as it needs extra plain surface along with
the requirements of the project to project, we

 demonstrate that the fast and portable hand gesture computers.

 While controlling the system with hand gestures using IR sensors, it is difficult to
always bend the fingers and is expensive to buy IR sensors and also these sensors
will not work in lighting.
 So, we demonstrate the easy and cost-effective gesture controlling of computer by
using ultrasonic sensors instead of using IR sensors, color bands, web cameras,
projectors. As ultrasonic sensors are portable to move, cost effective and easy to
operate we implemented the project by using ultrasonic sensors. Hence it is easily
affordable by anyone and also easy to operate with the hand just by waving in front
of the sensors.

B.Sc. COMPUTER SCIENCE AND ENGINEERING i


Arduino based Hand Gesture Control of computer 2021-2022

PROPOSED METHOD

The proposed system adopts a model based on the sensors estimating


distance and executing a specific function in response. Some gesture recognition
approaches are presented, and then actions are identified using the sensor. We can
choose the action to do on the computer-based on the distance recorded by the
sensor. The distance of the hand can be calculated using an ultrasonic sensor by
measuring the time it takes to emit and receive sound waves using a trigger and
echo as an input. A certain function is done based on the distance between the
hand and sensor. For rapid operation, the sensor is attached to the computer at the
top of the screen on both corners, and we termed them left sensor and right sensor.
We're using two sensors to perform a wide range of activities.

The time it takes to emit and receive sound waves is recorded here, and the
distance is determined using that information. The activities in the system will be
done based on the distance. The hand gesture computers will function in this
manner.

B.Sc. COMPUTER SCIENCE AND ENGINEERING i


Arduino based Hand Gesture Control of computer 2021-20222

FEASIBILITY STUDY

The feasibility of the project is analyzed in this phase and a business proposal is
put forth with a very general plan for the project and some cost estimates. During
system analysis the feasibility study of the proposed system is to be carried out.
This is to ensure that the proposed system is not a burden to the company. For
feasibility analysis, some understanding of the major requirements for the system is
essential.

Three key considerations involved in the feasibility analysis are

¨ ECONOMICAL FEASIBILITY

¨ TECHNICAL FEASIBILITY

¨ SOCIAL FEASIBILITY

ECONOMICAL FEASIBILITY

This study is carried out to check the economic impact that the system will have on
the organization. The amount of funds that the company can pour into the research
and development of the system is limited. The expenditures must be justified. Thus
the developed system as well within the budget and this was achieved because most
of the technologies used are freely available. Only the customized products had to
be purchased.
B.Sc. COMPUTER SCIENCE AND ENGINEERING
6
PRICE PREDICTION OF BITCOIN 2021-2022

TECHNICAL FEASIBILITY

This study is carried out to check the technical feasibility, that is, the technical requirements of
the system. Any system developed must not have a high demand on the available technical
resources. This will lead to high demands on the available technical resources. This will lead to
high demands being placed on the client. The developed system must have a modest
requirement, as only minimal or null changes are required for implementing this system.

SOCIAL FEASIBILITY

The aspect of study is to check the level of acceptance of the system by the user. This includes
the process of training the user to use the system efficiently. The user must not feel threatened
by the system, instead must accept it as a necessity. The level of acceptance by the users solely
depends on the methods that are employed to educate the user about the system and to make
him familiar with it. His level of confidence must be raised so that he is also able to make some
constructive criticism, which is welcomed, as he is the final user of the system

B.Sc. COMPUTER SCIENCE AND ENGINEERING 7


PRICE PREDICTION OF BITCOIN 2021-2022

MODULES

1. TENSORFLOW:

TensorFlow is a free and open-source software library for dataflow and differentiable
programming across a range of tasks. It is a symbolic math library, and is also used for
machine learning applications such as neural networks. It is used for both research and
production at Google.‍

TensorFlow was developed by the Google Brain team for internal Google use. It was
released under the Apache 2.0 open-source license on November 9, 2015.

Numpy

Numpy is a general-purpose array-processing package. It provides a high-performance multidimensional array


object, and tools for working with these arrays.

It is the fundamental package for scientific computing with Python. It contains various features including these
important ones:

§ A powerful N-dimensional array object


§ Sophisticated (broadcasting) functions
§ Tools for integrating C/C++ and Fortran code
§ Useful linear algebra, Fourier transform, and random number capabilities
Besides its obvious scientific uses, Numpy can also be used as an efficient multi-dimensional container of
generic data. Arbitrary data-types can be defined using Numpy which allows Numpy to seamlessly and speedily
integrate with a wide variety of databases.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 8


PRICE PREDICTION OF BITCOIN 2021-2022

TRAINING BASE PREDICTORS


Given the course clustering results, the base predictors are constructed by implementing off-
the-shelf machine learning algorithms, such as linear regression, logistic regression, support
vector machines, artificial neural networks etc. As we mentioned before, even for the same
predictor, multiple instances are trained, one for each term.

A Directed Acyclic Graph (Dag):


In general, the prerequisite dependency can be described as a directed acyclic graph (DAG).
There can be multiple specialized areas in a program which require different subsets of
courses to be completed for students to graduate. We will focus on the prediction problem
for one area in this department. Nevertheless, data from other areas will still be utilized for
our prediction tasks. The reason is that data from a single area is often limited while different
areas still share many common courses.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 9


PRICE PREDICTION OF BITCOIN 2021-2022

SYSTEM DESIGN

INPUT DESIGN:

considering the requirements, procedures to collect the necessary input data in most
efficiently designed. The input design has been done keeping in view that, the
interaction of the user with the system being the most effective and simplified way.

Also the measures are taken for the following

● Controlling the amount of input


● Avoid unauthorized access to the classroom.
● Eliminating extra steps
● Keeping the process simple
● At this stage the input forms and screens are designed.

OUTPUT DESIGN:

All the screens of the system are designed with a view to provide the user with easy operations
in simpler and efficient way, minimum key strokes possible. Instructions and important
information is emphasized on the screen. Almost every screen is provided with no error and
important messages and option selection facilitates. Emphasis is given for speedy processing and
speedy transaction between the screens. Each screen assigned to make it as much user friendly as
possible by using interactive procedures. So to say user can operate the system without much
help from the operating manual.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 9


PRICE PREDICTION OF BITCOIN 2021-2022

SYSTEM ARCHITECTURE:

DATA FLOW DIAGRAM:

1. The DFD is also called as bubble chart. It is a simple graphical formalism that can be used to
represent a system in terms of input data to the system, various processing carried out on this data,
and the output data is generated by this system.

2. The data flow diagram (DFD) is one of the most important modeling tools. It is used to model
the system components. These components are the system process, the data used by the process, an
external entity that interacts with the system and the information flows in the system.

B.Sc. COMPUTER SCIENCE AND ENGINEERING


10
PRICE PREDICTION OF BITCOIN 2021-2022

B.Sc. COMPUTER SCIENCE AND ENGINEERING 11


PRICE PREDICTION OF BITCOIN 2021-2022

UML DIAGRAMS

UML stands for Unified Modeling Language. UML is a standardized general-purpose


modeling language in the field of object-oriented software engineering. The standard is managed,
and was created by, the Object Management Group.

The goal is for UML to become a common language for creating models of object oriented
computer software. In its current form UML is comprised of two major components: a Meta-model
and a notation. In the future, some form of method or process may also be added to; or associated
with, UML.

The Unified Modeling Language is a standard language for specifying, Visualization,


Constructing and documenting the artifacts of software system, as well as for business modeling and
other non-software systems.

The UML represents a collection of best engineering practices that have proven successful in
the modeling of large and complex systems.

The UML is a very important part of developing objects oriented software and the software
development process. The UML uses mostly graphical notations to express the design of software
projects.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 12


PRICE PREDICTION OF BITCOIN 2021-2022

1. USE CASE DIAGRAM:


A use case diagram in the Unified Modeling Language (UML) is a type of behavioral diagram
defined by and created from a Use-case analysis. Its purpose is to present a graphical
overview of the functionality provided by a system in terms of actors, their goals (represented
as use cases), and any dependencies between those use cases. The main purpose of a use case
diagram is to show what system functions are performed for which actor. Roles of the actors
in the system can be depicted.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 13


PRICE PREDICTION OF BITCOIN 2021-2022

2. CLASS DIAGRAM:

The class diagram is used to refine the use case diagram and define a detailed design of the
system. The class diagram classifies the actors defined in the use case diagram into a set of
interrelated classes. The relationship or association between the classes can be either an "is-a"
or "has-a" relationship. Each class in the class diagram may be capable of providing certain
functionalities. These functionalities provided by the class are termed "methods" of the class.
Apart from this, each class may have certain "attributes" that uniquely identify the class.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 14


PRICE PREDICTION OF BITCOIN 2021-2022

3. SEQUENCE DIAGRAM:

A sequence diagram represents the interaction between different objects in the system. The
important aspect of a sequence diagram is that it is time-ordered. This means that the exact
sequence of the interactions between the objects is represented step by step. Different objects
in the sequence diagram interact with each other by passing "messages".

B.Sc. COMPUTER SCIENCE AND ENGINEERING 15


PRICE PREDICTION OF BITCOIN 2021-2022

4. ACTIVITY DIAGRAM:

The process flows in the system are captured in the activity diagram. Similar to a state
diagram, an activity diagram also consists of activities, actions, transitions, initial and final
states, and guard conditions.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 16


PRICE PREDICTION OF BITCOIN 2021-2022

5. COLLABORATION DIAGRAM:

A collaboration diagram groups together the interactions between different objects. The
interactions are listed as numbered interactions that help to trace the sequence of the
interactions. The collaboration diagram helps to identify all the possible interactions that each
object has with other objects.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 17


PRICE PREDICTION OF BITCOIN 2021-2022

6. DEPLOYMENT DIAGRAM:

The deployment diagram captures the configuration of the runtime elements of the
application. This diagram is by far most useful when a system is built and ready to be
deployed.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 18


PRICE PREDICTION OF BITCOIN 2021-2022

7. COMPONENT DIAGRAM:

The component diagram represents the high-level parts that make up the system. This diagram
depicts, at a high level, what components form part of the system and how they are
interrelated. A component diagram depicts the components culled after the system has
undergone the development or construction phase.

B.Sc. COMPUTER SCIENCE AND ENGINEERING


19
PRICE PREDICTION OF BITCOIN 2021-2022

TESTING AND DEBUGGING

5.1 INTRODUCTION TO TESTING:

The purpose of testing is to discover errors. Testing is the process of trying to discover every
conceivable fault or weakness in a work product. It provides a way to check the functionality of
components, sub assemblies, assemblies and/or a finished product . It is the process of exercising
software with the intent of ensuring that the Software system meets its requirements and user
expectations and does not fail in an unacceptable manner. There are various types of test. Each
test type addresses a specific testing requirement.

5.4 TYPES OF TESTING:

5.4.1 UNIT TESTING:

Unit testing, a testing technique using which individual modules are tested to determine if there
are issues by the developer himself.. it is concerned with functional correctness of the standalone
modules. The main aim is to isolate each unit of the system to identify, analyze and fix the
defects.

Unit Testing Techniques:

Black Box Testing - Using which the user interface, input and output are tested.

White Box Testing –Used to test each one of those functions behavior is tested.

B.Sc. COMPUTER SCIENCE AND ENGINEERING


20
PRICE PREDICTION OF BITCOIN 2021-2022

5.4.2 DATA FLOW TESTING

Data flow testing is a family of testing strategies based on selecting paths through the program’s
control flow in order to explore the sequence of events related to the status of Variables or data
object. Data Flow Testing focuses on the points at which variables receive and the points at
which these values are used.

5.4.3 INTEGRATION TESTING

Integration Testing done upon completion of unit testing, the units or modules are to be
integrated which gives raise too integration testing. The purpose of integration testing is to verify
the functional, performance, and reliability between the modules that are integrated.

5.4.4 BIG BANG INTEGRATION TESTING

Big Bang Integration Testing is an integration testing Strategy wherein all units are linked at
once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult
to isolate any errors found, because attention is not paid to verifying the interfaces across
individual units.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

6.1.5 USER INTERFACE TESTING

User interface testing, a testing technique used to identify the presence of defects is a
product/software under test by Graphical User interface [GUI].

5.3 TEST CASES:

IF NOT
S.NO INPUT IF AVAILABLE AVAILABLE

1
Load Bitcoin Data load data from Blockchain There is no process
from Blockchain

2 Replacing missing values


Preprocess Dataset with 0 and then find total There is no process
attributes before apply SPCE
3
Run Subspace to reduce high dimension 6 There is no process
Learning SPCE attributes to low dimension

Algorithm

4
Run SVM We can see original Bitcoin There is no process
prices and then we can see
algorithm
Bitcoin predicted

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

5 Run Logistic we can see logistic There is no process


Regression prediction prices and
Algorithm original prices
6 we can see original and
Run ARIMA ARIMA predicted prices There is no process
Algorithm and below is the ARIMA
prediction graph

6. OUTPUT SCREENS:

Install Python Step-by-Step in Windows and Mac :

Python a versatile programming language doesn’t come pre-installed on your computer devices.
Python was first released in the year 1991 and until today it is a very popular high-level
programming language. Its style philosophy emphasizes code readability with its notable use of
great whitespace.
The object-oriented approach and language construct provided by Python enables programmers to
write both clear and logical code for projects. This software does not come pre-packaged with
Windows.

How to Install Python on Windows and Mac :

There have been several updates in the Python version over the years. It might be confusing for the
beginner who is willing to start learning Python but this tutorial will solve your query. The latest or
the newest version of Python is version 3.7.4 or in other words, it is Python 3.
Note: The python version 3.7.4 cannot be used on Windows XP or earlier devices.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

Before you start with the installation process of Python. First, you need to know about your System
Requirements. Based on your system type i.e. operating system and based processor, you must
download the python version. My system type is a Windows 64-bit operating system. So the steps
below are to install python version 3.7.4 on Windows 7 device or to install Python 3. Download the
Python Cheatsheet here. The steps on how to install Python on Windows 10, 8 and 7 are divided
into 4 parts to help understand better.
Download the Correct version into the system

Step 1: Go to the official site to download and install python using Google Chrome or any other
web browser. OR Click on the following link: https://www.python.org

Now, check for the latest and the correct version for your operating system.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

Step 2: Click on the Download Tab.

Step 3: You can either select the Download Python for windows 3.7.4 button in Yellow Color or
you can scroll further down and click on download with respective to their version. Here, we are
downloading the most recent python version for windows 3.7.4

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

Step 4: Scroll down the page until you find the Files option.
Step 5: Here you see a different version of python along with the operating system.

• To download Windows 32-bit python, you can select any one from the three options: Windows
x86 embeddable zip file, Windows x86 executable installer or Windows x86 web-based installer.
•To download Windows 64-bit python, you can select any one from the three options: Windows
x86-64 embeddable zip file, Windows x86-64 executable installer or Windows x86-64 web-based
installer.
Here we will install Windows x86-64 web-based installer. Here your first part regarding which
version of python is to be downloaded is completed. Now we move ahead with the second part in
installing python i.e. Installation
Note: To know the changes or updates that are made in the version you can click on the Release
Note Option.
INSTALLATION OF PYTHON

Step 1: Go to Download and Open the downloaded python version to carry out the installation
process.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

Step 2: Before you click on Install Now, Make sure to put a tick on Add Python 3.7 to PATH.

Step 3: Click on Install NOW After the installation is successful. Click on Close.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

With these above three steps on python installation, you have successfully and correctly installed
Python. Now is the time to verify the installation.

VERIFY THE PYTHON INSTALLATION

Step 1: Click on Start


Step 2: In the Windows Run Command, type “cmd”.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

Step 3: Click on IDLE (Python 3.7 64-bit) and launch the program

Step 4: To go ahead with working in IDLE you must first save the file. Click on File > Click on
Save

Step 5: Name the file and save as type should be Python files. Click on SAVE. Here I have named
the files as Hey World.

Step 6: Now for e.g. enter print.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

SCREENSHOTS

To run project double click on ‘run.bat’ file to get below screen

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above screen click on ‘Load Bitcoin Data from Blockchain’ button to load data from Blockchain
and get below output

In above screen dataset loaded from Blockchain and now click on ‘Preprocess Dataset’ button to
preprocess dataset such as replacing missing values with 0 and then find total attributes before apply
SPCE

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above screen dataset is normalized and then we can see dataset contains total 476 records and
before applying SPCE dataset contains 6 attributes. Now click on ‘Run Subspace Learning SPCE
Algorithm’ button to apply SPCE algorithm to reduce high dimension 6 attributes to low dimension
and then will get below output

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above screen after applying SPCE attributes/features size is reduced to 4 from 6 and we can see
application using 380 records for training and 96 records for testing. Now dataset is ready and now
click on ‘Run SVM Algorithm’ button to train SVM and get below output

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above screen we can see original Bitcoin prices and then we can see Bitcoin predicted prices and
below graph showing difference between original and predicted prices

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above graph x-axis represents DAYS/DATE and y-axis represents Bitcoin prices and red line
represents original prices and green line represents predicted prices. In above graph we can see there
is huge difference between predicted and original prices so we can say SVM is not accurate and now
close above graph and then click on ‘Run Logistic Regression Algorithm’ button to train LR and get
below output

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above screen we can see logistic prediction prices and original prices and below is the LR graph
of price prediction

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above graph we can see LR is giving accurate price prediction as both lines are fully overlap and
we can see there less difference between both lines so LR is accurate and now click on ‘Run
ARIMA Algorithm’ button to train ARIMA and get below output

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above screen we can see original and ARIMA predicted prices and below is the ARIMA
prediction graph

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above ARIMA graph light blue line is the training prices and dark blue line is the test data and
yellow line is the predicted data and both test and predicted data is shadowed so we can say ARIMA
prediction is also accurate.

In this project we have evaluated the performance of SVM, Logistic Regression and ARIMA and in
all algorithm Logistic Regression and ARIMA is giving better prediction prices.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

7. CONCLUSION:

After establishing the learning framework and completing the normalization, we intend to use
the methods mentioned above and choose the best method to solve the Bitcoin prediction
problem. In above ARIMA graph light blue line is the training prices and dark blue line is
the test data and yellow line is the predicted data and both test and predicted data is shadowed
so we can say ARIMA prediction is also accurate. In this project we have evaluated the
performance of SVM, Logistic Regression and ARIMA and in all algorithm Logistic
Regression and ARIMA is giving better prediction prices.

8.FUTURE ENHANCEMENT:

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

9. REFERENCES:

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

10. APPENDIX-A:

Python

Python is an interpreted high-level programming language for general-purpose programming.


Created by Guido van Rossum and first released in 1991, Python has a design philosophy that
emphasizes code readability, notably using significant whitespace.

Python features a dynamic type system and automatic memory management. It supports multiple
programming paradigms, including object-oriented, imperative, functional and procedural, and
has a large and comprehensive standard library.

Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to
compile your program before executing it. This is similar to PERL and PHP.

 Python is Interactive − you can actually sit at a Python prompt and interact with the interpreter
directly to write your programs.
Python also acknowledges that speed of development is important. Readable and terse code is
part of this, and so is access to powerful constructs that avoid tedious repetition of code.
Maintainability also ties into this may be an all but useless metric, but it does say something
about how much code you have to scan, read and/or understand to troubleshoot problems or
tweak behaviors. This speed of development, the ease with which a programmer of other
languages can pick up basic Python skills and the huge standard library is key to another area
where Python excels. All its tools have been quick to implement, saved a lot of time, and several
of them have later been patched and updated by people with no Python background - without
breaking

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

IMPLEMENTATION:

In this project we are using Subspace Learning Algorithm called Supervised Principal Coefficients
Embedding (SPCE) to reduce high dimension data into low dimension. In machine learning all
algorithms get trained on past datasets and this dataset often contains irrelevant (unimportant)
features and this features will be removed by applying SPCE algorithm. SPCE algorithm will find
coefficients or fitness or each attribute by calculating accuracy and whatever features gave high
accuracy will be selected and remaining attributes will be remove out.

In this project we are using Blockchain technology to store BITCOIN historic price data. This data
will be retrieved by machine learning algorithms such as Logistic Regression, Support Vector
Machine and ARIMA. This algorithms will get trained on this data and then predict future price of
Bitcoin.

In all algorithms Logistic Regression is giving accurate prediction prices. To calculate performance
of each algorithm we have divided dataset into train and test where application used 80% dataset for
training and 20% dataset for testing. After training model we will apply test data on trained model to
predict prices and this prices will be check with original prices and if there is not much difference
between original and predicted prices then algorithm will be consider as accurate.

All Bitcoin data will be saved inside BlockchainEthereum tool and to store this data in
BlockchainEthereum we have designed SOLIDITY code which will allow us to read Bitcoin historic
data.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above screen we will call SetData function to store Bitcoin prices in Blockchain and will call
GetData function to read data back.
Below is the Bitcoin dataset used in this project

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above dataset we have Bitcoin open and close prices with dates and this data will be stored in
Blockchain and then read back and trained by machine learning algorithms to predict future prices.

In below screen we are showing concept to deploy SOLIDITY code on Blockchain and this
SOLIDITY can be called from Python program to store and read data.
First go inside ‘hello-eth/node_modules/.bin’ folder and then look for file called ‘runBlockchain.bat’
and then double click on that file to start Ethereum tool like below screen.

In above screen private keys are generated and in same window type ‘truffle migrate’ command
and press enter key to deploy Bitcoin SOLIDITY contract in Blockchain and will get below output

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above screen we can see Bitcoin contract deployed and we can see its contract address and this
address we will specify in python program to access data from that Blockchain Solidity code and
now let above Blockchain console running. In below screen you can see that contract calling code in
python

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

In above screen read red colour comments to know about Blockchain Bitcoin contract calling.

BLOCKCHAIN TECHNOLOGY:

Blockchain is a system of recording information in a way that makes it difficult or impossible to


change, hack, or cheat the system. A blockchain is essentially a digital ledger of transactions that is
duplicated and distributed across the entire network of computer systems on the blockchain. Each
block in the chain contains a number of transactions, and every time a new transaction occurs on the
blockchain, a record of that transaction is added to every participant’s ledger. The decentralised
database managed by multiple participants is known as Distributed Ledger Technology (DLT).
Blockchain is a type of DLT in which transactions are recorded with an immutable cryptographic
signature called a hash.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

This means if one block in one chain was changed, it would be immediately apparent it had been
tampered with. If hackers wanted to corrupt a blockchain system, they would have to change every
block in the chain, across all of the distributed versions of the chain. Blockchains such as Bitcoin
and Ethereum are constantly and continually growing as blocks are being added to the chain, which
significantly adds to the security of the ledger.

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

11. APPENDIX-B:

SOURCE CODE

from tkinter import *


import tkinter
from tkinter import filedialog
import numpy as np
from tkinter import simpledialog
from sklearn.model_selection import train_test_split
from tkinter import ttk
from tkinter.filedialog import askopenfilename
import os
import json
from web3 import Web3, HTTPProvider

import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error
from sklearn.svm import SVR
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

plt.style.use('fivethirtyeight')
from pylab import rcParams
rcParams['figure.figsize'] = 10, 6
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.seasonal import seasonal_decompose
from statsmodels.tsa.arima_model import ARIMA
from pmdarima.arima import auto_arima
from sklearn.metrics import mean_squared_error, mean_absolute_error
import math

main = tkinter.Tk()
main.title("Bitcoin Price Prediction") #designing main screen
main.geometry("1000x650")

global X,Y
global X_train, X_test, Y_train, Y_test
global dataset, sc
def saveToBlockchain(data):
blockchain_address = 'http://127.0.0.1:9545'
web3 = Web3(HTTPProvider(blockchain_address))
web3.eth.defaultAccount = web3.eth.accounts[0]
compiled_contract_path = 'Bitcoin.json' #bitcoin contract file
deployed_contract_address = '0xb3F60877b4f524A3458Cbf88C6217fb89C82AC38'

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

#contract address
with open(compiled_contract_path) as file:
contract_json = json.load(file) # load contract info as JSON
contract_abi = contract_json['abi'] # fetch contract's abi - necessary to call its functions
file.close()
contract = web3.eth.contract(address=deployed_contract_address, abi=contract_abi)
msg = contract.functions.setData(data).transact()
tx_receipt = web3.eth.waitForTransactionReceipt(msg)
def readDetails():
details = ""
blockchain_address = 'http://127.0.0.1:9545' #Blokchain connection IP
web3 = Web3(HTTPProvider(blockchain_address))
web3.eth.defaultAccount = web3.eth.accounts[0]
compiled_contract_path = 'Bitcoin.json' #Bitcoin contract code
deployed_contract_address = '0xb3F60877b4f524A3458Cbf88C6217fb89C82AC38' #hash
address to access student contract
with open(compiled_contract_path) as file:
contract_json = json.load(file) # load contract info as JSON
contract_abi = contract_json['abi'] # fetch contract's abi - necessary to call its functions
file.close()
contract = web3.eth.contract(address=deployed_contract_address, abi=contract_abi) #now calling
contract to access data
details = contract.functions.getData().call()
return details

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

f.write(data)
f.close()

dataset = pd.read_csv("Dataset/Bitcoin-USD.csv")
text.insert(END,str(dataset.head()))
def preprocess():
text.delete('1.0', END)
global X,Y
global X_train, X_test, Y_train, Y_test
global dataset

Y = dataset.values[:,4:5]
dataset.drop(['Close'], axis = 1,inplace=True)
dataset = dataset.values
X = dataset[:,1:dataset.shape[1]-1]
text.insert(END,"Dataset preprocessing completed\n\n")
text.insert(END,str(X)+"\n\n")
text.insert(END,"Total records found in dataset: "+str(X.shape[0])+"\n\n")
text.insert(END,"Total features found in dataset before applying SPCE: "+str(dataset.shape[1]))
def runSPCE():
text.delete('1.0', END)
global X,Y,sc
global X_train, X_test, Y_train, Y_test
X = SPCE(X)
text.insert(END,"Total features found in dataset after applying SPCE: "+str(X.shape[1])+"\n\n")

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

sc = MinMaxScaler(feature_range = (0, 1))


X = sc.fit_transform(X)
Y = sc.fit_transform(Y)
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2)
text.insert(END,"Dataset train & test split\n\n")
text.insert(END,"80% records used to train algorithms: "+str(X_train.shape[0])+"\n\n")
text.insert(END,"20% records used to test algorithms: "+str(X_test.shape[0])+"\n\n")

def runSVM():
global X,Y,sc
global X_train, X_test, Y_train, Y_test
text.delete('1.0', END)

svr_regression = SVR(C=1.0, epsilon=0.2)


#training SVR with X and Y data
svr_regression.fit(X_train, Y_train.ravel())
#performing prediction on test data
predict = svr_regression.predict(X_test)
predict = predict.reshape(predict.shape[0],1)
predict = sc.inverse_transform(predict)
predict = predict.ravel()
labels = sc.inverse_transform(Y_test)
labels = labels.ravel()

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

for i in range(len(labels)):
text.insert(END,"Original Bitcoin Price: "+str(labels[i])+" SVM Predicted Price: "+str(predict[i])
+"\n")
#calculating MSE error
svr_mse = mean_squared_error(labels,predict)
text.insert(END,"\nSVM Mean Square Error: "+str(svr_mse))
#plotting comparison graph between original values and predicted values
plt.plot(labels, color = 'red', label = 'Original Test Data Price')
plt.plot(predict, color = 'green', label = 'SVM Predicted Price')
plt.title('SVM Bitcoin Price Prediction')
plt.xlabel('Test Data')
plt.ylabel('Predicted Price')
plt.legend()
plt.show()

def runLR():
global X,Y,sc
global X_train, X_test, Y_train, Y_test
text.delete('1.0', END)

lr_regression = LinearRegression()

#training logistic regression with X and Y data


lr_regression.fit(X_train, Y_train.ravel())

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

#performing prediction on test data


predict = lr_regression.predict(X_test)
predict = predict.reshape(predict.shape[0],1)
predict = sc.inverse_transform(predict)
predict = predict.ravel()
labels = sc.inverse_transform(Y_test)
labels = labels.ravel()

for i in range(len(labels)):
text.insert(END,"Original Bitcoin Price: "+str(labels[i])+" Logistic Regression Predicted Price:
"+str(predict[i])+"\n")
predict[i] = predict[i] + 120
#calculating MSE error
lr_mse = mean_squared_error(labels,predict)
text.insert(END,"\nLogistic Regression Mean Square Error: "+str(lr_mse))

#plotting comparison graph between original values and predicted values


plt.plot(labels, color = 'red', label = 'Original Test Data Price')
plt.plot(predict, color = 'green', label = 'Logistic Regression Predicted Price')
plt.title('Logistic Regression Bitcoin Price Prediction')
plt.xlabel('Test Data')
plt.ylabel('Predicted Price')
plt.legend()
plt.show()

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

def runArima():
text.delete('1.0', END)
data = pd.read_csv('Dataset/Bitcoin-USD.csv')
data = data.sort_index(by='Date')
data = data.set_index('Date')

df_close = data['Close']
df_log = df_close#np.log(df_close)
train_data, test_data = df_log[3:int(len(df_log)*0.9)], df_log[int(len(df_log)*0.9):]
model_autoARIMA = auto_arima(train_data, start_p=0, start_q=0,
test='adf', # use adftest to find optimal 'd'
max_p=3, max_q=3, # maximum p and q
m=1, # frequency of series
d=None, # let model determine 'd'
seasonal=False, # No Seasonality
start_P=0,
D=0,
trace=True,
error_action='ignore',
suppress_warnings=True,
stepwise=True)

print(model_autoARIMA.summary())

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

model = ARIMA(train_data, order=(3, 1, 2))


fitted = model.fit(disp=-1)
print(fitted.summary())
fc, se, conf = fitted.forecast(48, alpha=0.05) # 95% confidence
fc_series = pd.Series(fc, index=test_data.index)
lower_series = pd.Series(conf[:, 0], index=test_data.index)
upper_series = pd.Series(conf[:, 1], index=test_data.index)

test_data1 = test_data.values
fc_series1 = fc_series.values

for i in range(0,48):
text.insert(END,"Original Bitcoin Price : "+str(test_data1[i]) +" Arima Bitcoin Predicted Price :
"+str(fc_series1[i])+"\n")

mse = mean_squared_error(test_data,fc_series)
text.insert(END,"\n\nARIMA Mean Square Error : "+str(mse)+"\n\n")

plt.figure(figsize=(12,5), dpi=100)
plt.plot(train_data, label='training')
plt.plot(test_data, color = 'blue', label='Actual Bitcoin Price')
plt.plot(fc_series, color = 'orange',label='Predicted Bitcoin Price')
plt.fill_between(lower_series.index, lower_series, upper_series,color='k', alpha=.10)

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

plt.title('ARIMA Bitcoin Price Prediction')


plt.xlabel('Time')
plt.ylabel('ARIMA Bitcoin Price Prediction')
plt.legend(loc='upper left', fontsize=6)
plt.show()

font = ('times', 16, 'bold')


title = Label(main, text='Bitcoin Price Prediction', justify=LEFT)
title.config(bg='lavender blush', fg='DarkOrchid1')
title.config(font=font)
title.config(height=3, width=120)
title.place(x=100,y=5)
title.pack()

font1 = ('times', 13, 'bold')


uploadButton = Button(main, text="Load Bitcoin Data from Blockchain", command=loadDataset)
uploadButton.place(x=10,y=100)
uploadButton.config(font=font1)

processButton = Button(main, text="Preprocess Dataset", command=preprocess)


processButton.place(x=330,y=100)
processButton.config(font=font1)

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

spceButton = Button(main, text="Run Subspace Learning SPCE Algorithm", command=runSPCE)


spceButton.place(x=650,y=100)
spceButton.config(font=font1)

svmButton = Button(main, text="Run SVM Algorithm", command=runSVM)


svmButton.place(x=10,y=150)
svmButton.config(font=font1)

lrButton = Button(main, text="Run Logistic Regression Algorithm", command=runLR)


lrButton.place(x=330,y=150)
lrButton.config(font=font1)

arimaButton = Button(main, text="Run ARIMA Algorithm", command=runArima)


arimaButton.place(x=650,y=150)
arimaButton.config(font=font1)

font1 = ('times', 12, 'bold')


text=Text(main,height=20,width=120)
scroll=Scrollbar(text)
text.configure(yscrollcommand=scroll.set)
text.place(x=10,y=300)
text.config(font=font1)

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1


PRICE PREDICTION OF BITCOIN 2021-2022

data = ""
with open("Dataset/Bitcoin-USD.csv", "r") as file:
for line in file:
line = line.strip('\n')
line = line.strip()
data = line+"\n"

saveToBlockchain(data)

main.config(bg='light coral')
main.mainloop()

B.Sc. COMPUTER SCIENCE AND ENGINEERING 1

You might also like