Saturday, January 25, 2020

Helix Paper Trading

Hello Everyone,

This is Rohit currently pursuing my B.tech(CSE) from St.Martin's Engineering College.
This is my first project, I have developed a simple application named as 'Helix Paper Trading' which is similar to that of a Virtual Trading Software.I am very interested in Stock market ,Since my School days I always wondered how the whole market works ,how the price of a company shares goes Up /Down.I got my project idea from searching and reading various stock market articles on web.

We have developed this application in C language with the help of external library graphics.h .



PROJECT IDEA:
   
Our idea is about making an app for trading,which contains virtual money .
Virtual Money in Account=Rs.5,00,000
That money can be used by user for doing trade of Shares.The user can practice trading till he has money left in his account.The basic idea of implementing this is to learn & practice trading.
  • How the market works.Before buying or selling, a user must have known the basics of fundamental and technical analysis.Graph comes under technical Analysis.
  • Learn about trader psychology like Time management (When to enter & when to leave the stock)
  • Learn how  not be greedy (or)guilty of loosing money in the market.
  • Learn to be Patient .Once the trader learns all of this ,he can go to a real account and earn money
Description:

The brief description or the overview is explained as follows:
  • Main Section.

         1)Login Page(It Contains username & password)
               2)Signup Page(Taking all the details of a new user and creating his account)
  • User Section.
  • Account Section.(where a user can know ,How much he has gained(or)lost money,also can know about his performance)
  • Transaction History.(where a user can see all his trade)
  • Watch List(Currently interested in a stock ,watching it to invest in future)
  •  Stock Lists(Stock Section where a user can find a stock and add it to watch list of his!)
  • Portfolio Section(Place where Buyed stocks are kept in exchange of money)
  • Fundamental Analysis(Knowing about the company ,their foundation as well as their Performance)It also contains like P/E ratio,ROE,EPS,Dividend etc...Line Graphs.
          (Knowing the current price of Stock & investing in it, Depends upon the user)
  • Logout. 
  • Well pretty much few screenshots of the project are shown:

The one below shows an example of a random graph of stock prices:
Account details:
Pie chart:


The following one is a helper section which helps the user using the application
               
 When u choose to exit!...it confirms if u really want to exit the page as shown below!


            The below screen  appears when you are successfully logged out.


So those were only the screenshots of the basic content  and a small overview that we have gone through above.The complete project can be viewed through the video uploaded in the following content of the post.It took almost a month for me and Rishika to finish the project.So here we would like to share how and what all we did in developing it.  
  • Basically we used 3 files namely:
  1. project_data.txt -  To store the user related details like name and password(used for login and sign up pages).                                           
  2. company_data.txt - This file is used to store the company details like their name,starting  price & no of shares available....This file is updated every time ,when a user buys or sells shares of a particular company.
  3. prices_list.txt - This file is used to store the random number generated by thread  function..Every time when the price is updated ,This file is opened and the random number are added with current price and displayed to the user.This file is also responsible for showing the graph of a particular company...(In a sequential order..)
  • A Thread function is being used: (We have used multi-threading concept in c) This thread function will generate random number and store it in a file in a systematic order.
>Our project's main problem was automatic updating of  prices and the graph section..
The rest of the sections were easy to implement...
>When we told our idea to Abhijith bhaiya ,He asked us to do it in Multi-threading for updating the prices. That's when we referred to the concept of multi-threading in C.Our updating prices problem was solved.As in multi-threading one processor will continue to do the thread function & the other processor will serve the user.
Here one more problem arises about: when to read the random number from the file and when not to,because if we try to retrieve a number which is not written in a file that process terminates the program abnormally.
So,We came up with the solution of 2 static pointers, which are initialized to zero at first,
Once when the thread function will complete writing its random numbers in a file ,first static variable is incremented ...and again in updating point we put a condition accordingly and
then  it is read (or else )left undisturbed.
After reading second static variable , if its equal to first variable ...at the end of the updating point statement, we call a new thread that goes to the thread function and starts it's work again.
This process is repeated till the user terminates its process .

Graph Section :-

This was the interesting  part of the project ,which took almost three days, i guess as we wanted how a graph is drawn  by using C-graphics.
1st day :-It took for searching where and which c-graphics library to be used and how to implement them in codeblocks and make some required changes.
2nd day :-It took for learning how to draw a line,rectangle,circle etc ,how to open and how to close a graph and how to write a sentence or word in a graphics mode and wrote few functions which take input and i had to deal with pretty much many logical errors!(Oh! man , that was so frustrating some times).
3rd day :-It took for creating an equation for choosing the correct coordinates to print the text and how to read the data from the file and setting the condition for upward and downward movement of the line ..(price)and printing the prices on the graph.
After finishing the graph and updating price section ,
The rest of the sections were easy to do .

Structure Used:-

At first we thought of using 8 to 9 struct lists but after the completion of  graph section we thought of combining the structure's. Then finally grouped'em and used five structure lists namely described as follows:
1)record:- 
      This contains all the information about the user data ,that when he had bought  when he had sold the shares ,their respective times etc...
2)company_data(cmp_data):-
  This structure is used to store the data which is retrieved from the company data file and displays it in Stock list.
3)account_details:-
This structure is used to store the user account information that ,How many funds are available, name,total no of transactions etc..
This account_details  must be constant  for every user that is why i didn't group it with record... where as once a particular record used is completed it is moved from one place to another.
4)user_details: This struct controls all the data present in previous structure.
5)database:    This struct is used to store all the user data ,user_details in a linked list order.  


Here is a video of Working of the Project:





We almost took about a month to finish the project. During the project it was very interesting for us to learn new things like C graphics, multi-threading concept and few more things like that. At first we chose to do the graphics part in Allegro but it really took most of my time in implementing the text based stuffs like taking input and showing the user in a certain required pattern ,as allegro is mostly used for games and we were not that comfortable with it ,we finally decided to do it in C graphics. In this whole process i personally came to know the importance of coding and learning new things which is really very exciting and may also be frustrating sometimes and that's when you really need to challenge yourself and move on without being vexed up! Challenging yourself  may be the  toughest  part but only then you can feel the satisfaction of the incredible work that you have done which makes you work n times effective and confident than you were before! So never ever give up.
                                          


Here is the link to refer the source code of the project: 


Finally! yes guys ,we are done ! 
Oh, that was a long post , thank you for being so patient and reading it.

                                                    HAPPY CODING :).....
                                   

No comments:

Post a Comment