Giter VIP home page Giter VIP logo

ruby_stock_server's Introduction

Ruby Stock Trading Server

This is a ruby version of Eric Koslow's Elixir/Erlang Stock Trading Server

https://github.com/ekosz/stock_server

The socket communications and commands are identical to Eric's version. The major difference in function is the price for each stock is the real-time market price retrieved from Google and Yahoo finance. As such the prices will be static except during the hours of 9:30am to 4:00pm EST M-F when the markets are open. Eric's implementation set prices from a replay of historical data as well the effects from the system players.

The Server class sets up a thread to periodically poll the market for price updates. The Server class also spawns a thread to support each client connection that is created when a player joins the system. There shouldn't be any contention or locking, but the threads do access common class variables.

The prices are retrieved using the Marketbeat GEM https://github.com/michaeldv/market_beat

run "bundle install" and then the server can be invoked:

ruby server.rb   ...with defaults of ( port=3000 logging=false scorecard=true )
or with overrides...
ruby server.rb 2000 true false

The sample test client is provided which will register and periodically poll the server and display pricing info for all stocks and portfolio value. By default the test client buys an equal value of all the listed stocks.

ruby test_client.rb <player_name>   ...with defaults: (server_address="localhost" port=3000 )
override example...
ruby test_client.rb DayTrader "stockserver.denenberg.net" 2000

Andy 04/08/2013

ruby_stock_server's People

Contributors

andydenenberg avatar

Watchers

Tony Castiglione 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.