Git Product home page Git Product logo

tsimulator's Introduction

TSimulator

what is TSimulator?

TSimulator is a program (proof of concept) made to simulate the traffic of a website trading just one stock. For the sake of simplicity, it assumes that the bids come through four connections, although this can be changed with little modification to the code. It uses a sorted list, as well as multithreading with background data synchronization. The binary could be found here.

usage

To build the program,

$ msbuild TSimulator.sln

usage

To run the program,

$ ./TSimulator.exe history input output stream1 stream2 stream3 stream4

history

  • This file contains the sorted bids for the previous day.
  • The first line contains an integer n: the number of bids in the file.
  • The n following lines each contain an integer b: a bid value.
  • These lines are sorted in increasing order.

input

  • This is the control input file: it's an interactive file that sends commands to the program
  • The possible commands are: top, end. More details below.

output

  • This is the control output file: it's an interactive file where the program writes requested data

stream1, stream2, stream3, stream4

  • These are the bids streams: they are interactive files that periodically receive bids

Bidding via a stream

$ echo >> num >> stream_file_name

where num is the dollar amount of your bid and stream_file_name is the filename of your streaming text file. (stream1, stream2, stream3, or stream4)

Commands via a stream

$ echo >> command >> input_file_name

where command follows the syntax of a command and input_file_name is the filename entered as input in the initial program arguments.

###Commands

top numBids numOutput

where numBids is the number of bids for the program to wait for before executing the top command, and numOutput is the number of top numOutput bids for the program to output to the specified output path.

end

signifies that the trading day has finished and the program can safely exit. A history file of today's bids in ascending order is saved to the history path specified in the initial program arguments.

##Other notes

  • Ensure that stream1, stream2, stream3, stream4, and input are empty files upon program execution.
  • Ensure that the first line in history corresponds to the amount of lines following it.

##Issues Check the issues page for issues.

tsimulator's People

Contributors

clemmy avatar

Watchers

 avatar  avatar

tsimulator's Issues

Need a better Follow() method

The current Follow() method in the StreamStates class is currently an infinite loop. In my implementation of the code, it is run in a background thread, surrounded by the "using {}" wrapper, so the resources allocated are destroyed upon program termination, but the code is very hacky.

Limitation on control input

There is currently no queue implemented for control input operations, so operations are limited to one at a time.

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.