Coder Social home page Coder Social logo

forex-trading-simulator's Introduction

Forex Trading Simulator

Overview

Buy and trade currencies with an automated, updated FX Market Price feed. The Price feed was created using a Price class, with price adjustments added to each currency instrument, -0.1% for bid price, +0.1% for ask price. The price feed was designed with currently only 3 instruments, EUR/USD, EUR/JPY and GBP/USD. The price feed continuously adjusts and runs these prices, with an update timestamp. It will run as follows in the background, so that the console can be used for user interaction.

fx market feed

In order to allow a "buy" and "sell" interaction, I have created a User class which utilises methods for these actions. I have used the term "Balance" or "Currency Balance" to signify the amount of currency that has currently been purchased, and "Funds" or "Available funds" as the amount the user has that can be used to purchase more currency. Currently, for simplicity, the balance and funds are just floating numbers, during buying and selling, there is currently no other conversion from the users funds into any currencies. This would definitely be the next step in improving this application to make it more realistic. All numbers have been adjusted to be rounded up to 4 decimal places.

Using as series of multiple nested switch statements, a user interaction in the console has been designed in order to allow the user to add funds to their account and buy and sell currencies. The user first adds their name in order to create an instance of the User object, and can add an amount to their funds.

created user 1
The user can then choose from 5 options, to pick one of the three instruments, to check their balance or funds, or to exit and terminate the application.
If the user chooses one of the three instruments, they are presented with the current prices at the most current price stamp, and the options to either buy and sell the currency, or to go back and choose another. If Buy is selected, the user can specify what amount of their funds they would like to allocate to the purchase, and will receive an update about the amounts in their accounts after the purchase.

se,e

The user can continuously buy and sell currencies so long as they have the available funds and balance needed. The app has been designed to also handle situtations in which the user may have insufficient amounts for their chosen transaction.

insufficient amounts

forex-trading-simulator's People

Contributors

kirstytheproud avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.