Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a stock market trading game in RoR, what libraries are available?

I'd like to build a relatively simple online stock trading application (in RoR). It would just be a game so no real trades- just an online simulation based on real market data.

A good example being http://www.wallstreetsurvivor.com/ or http://www.weseed.com/ (any ideas what libs / platforms they are using?)

There will be no CFD Trading, Spread Betting, Currency Trading or Fixed Odds. It will just be stock trading - using market / stop / limit orders.

Naturally, it will need to generate visualisations and pull in market data.

Can someone point me in the right direction regarding libraries (stuff like yahoo finance gem) / platforms I can use to get me started?

There seems to be some existing java platforms but they are very much geared towards single users.

Also, I'd much prefer to use Rails. If there's a real problem with this then I'd be open to switching platform/language.

like image 513
digitalWestie Avatar asked May 30 '11 13:05

digitalWestie


People also ask

What can you do with the stock market learning platform?

The platform seeks to make it easier for students to apply concepts covered in class in the real world. Similarly, students can trade U.S stocks in real-time. In addition to stock trading, students can finesse their trading skills around cryptos as well as options and futures.

What are stock market games and how do they work?

Stock market games, often referred to as paper trading, allow individuals to buy and sell stocks, options, commodities, futures, swaps, and recently crypto currencies, depending on the platform, using play money. Some platforms only have stocks, some only commodities, some a mixture of any or all of the aforementioned.

Should there be an app for beginners to trade stocks?

The trading awards encourage things such as day-trading, penny stock trading, and buying on margin which may encourage unhealthy investing behaviors. There is also a messaging application but rather than messaging other beginners, it would be more worthwhile for users to utilize professionals or chat through Stocktwits.

Can R be used for automated trading?

An automated trading system is not an exception. Whether you are doing high-frequency trading, day trading, swing trading, or even value investing, you can use R to build a trading robot that watches the market closely and trades the stocks or other financial instruments on your behalf.


2 Answers

A little searching reveals a handful of options (disclaimer: I haven't used any of these, so I can't vouch for them!).

For financial/stock data:

  • yahoo_stock gem -- interface to Yahoo! Finance API
  • ystock gem -- similar to above
  • ruby/finance -- lots of data-fetching options

For creating charts:

  • GoogleCharts gem -- interface to Google's chart API
  • gchart gem -- similar to above
  • rChart gem -- port of the pChart library

I would suggest some of your best places to search would be RubyGems.org and GitHub.com.

like image 141
ewall Avatar answered Sep 26 '22 04:09

ewall


It's probably worth looking into JRuby, then you can mix Rails with any Java libraries you might need.

like image 23
Andy Waite Avatar answered Sep 22 '22 04:09

Andy Waite