Home > red_money

red_money

Red_money is a project mainly written in Ruby, based on the View license.

A simple ruby based trading system

= Red Money Project

Simple trading system

This project is in a very alpha stage at the moment. Most functionality is not yet implemented.

== Indicator Functionality

The indicator module provides methods for performing indicator calculations, over a data set that implements the Enumerable interface.

data = [1,2,3,4,5] sma = Sma.new(:test, 3) # Create a Sma of length 3 with name 'test' result = sma.process_array data # Calculate the result

The HasIndicators mixin module also provides the ability to add indicators to your collection classes. The example below extends the built-in Array class:

class Array include HasIndicators end

The array can now be used as follows:

Create the array

l = [1,2,3,4,5]

Call the SMA indicator and pass it a argument of 3 (thus performing

a 3 point SMA.

l.setup_has_indicator_mixin result = l.run_indicator :sma_3

== Portfolio Functionality A portfolio is a collection of data and indicators to run over the data.

p = Portfolio.new do name :Tradeables

symbol :NAB, :AX
symbol :CBA, :AX
symbol :WOW, :AX

indicator :ema_13
indicator :ema_25
indicator :max_10

end

To retrieve the symbol data from the data source (the default is to use the yahoofinance gem) do the following: p.update_symbol_data

To run all the indicators p.run_indicators

To use the symbol data and the calculated indicators puts "Date,Close,EMA_13,EMA_25,MAX_10" p[:NAB].each do |bar| puts "#{bar.date}, #{bar.close}, #{bar.ema_13}, #{bar.ema_25}" end

== Trading System This part of the design is still forming. See link:examples for my initial thoughts.

== Copyright

Copyright (c) 2011 Michael Lamb. See LICENSE for details.

Previous:socketbroker