Skip to content

A Terminal Based Cryptocurrency Trading Simulator

Notifications You must be signed in to change notification settings

RamtinTJB/Terade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terade

A terminal based cryptocurrency trading simulator.

Motivation

For my honor's project for the CISC 187: Data Structures in C++ I chose to create a cryptocurrency trading simulator, as a way to integrate my interest in the cryptocurrencies and the knowledge I acquired in the class about data structures.

Screenshots

Libraries/APIs Used

All the necessary data for the simulation were downloaded from the CoinGecko API and is copied to the directory that contains the executable file. Due to technical difficulties and limited time, the program does not retrieve the data from the API at execution. All the information is pre-downloaded and stored in src/data folder and is transferred to the appropriate directory when the program is built. In the future I might modify the program to either retrieve the data online at runtime, or write a bash script to run curl commands and comminucate with Terade.

Command used to download one of the data files:

curl -X 'GET' 'https://api.coingecko.com/api/v3/coins/bitcoin/market_chart/range?id=bitcoin&vs_currency=usd&from=&1514851200to=1577923200' > data/bitcoin.json

I used this JSON library to parse the data from the CoinGeko API and also to save and load the state of the simulation.

  • NCurses

view.h defines an interface for the UI of the program. The view_curses class implements this interface and uses the NCurses library to present the data unto the console. Other classes could also implement the view interface and use different ways to display the data. For instance, to display the data using the SDL library, we would declare the following class,

class view_sdl: public view {
	// override all the necessary functions
}

and set an instance of the view_sdl as the main view in the game object:

g.set_view(std::unique_ptr<view>(new view_sdl));

Build & Run

Requirements

  • C++17

The ranged-for loops used to iterate through map elements, use in-place unpacking which is not supported in earlier versions of c++.

for (const auto& [key, value]: mymap) { }
  • CMake 3.11+

FetchContent is not supported in earlier versions of CMake.

  • NCurses

NCurses is probably already installed on most Linux distributions. Here are some tutorials on how to install NCurses on MacOS, Windows, and Linux.

Build

git clone https://github.com/ramtintjb/terade
cd terade
cmake -B build
cd build
make
cd src
./Terade

Credits

I want to give special thanks to David Parillo, who guided me every step of the way and shared best practices and great resources with me.

License

The project is licensed under the MIT License:

Copyright © 2022 Ramtin Tajbakhsh

About

A Terminal Based Cryptocurrency Trading Simulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published