thetruetrade / gotrade

Golang stock market technical analysis library
MIT License
145 stars 47 forks source link

gotrade

Golang stock market technical analysis library

Build Status

Stories in Ready

GoTrade is in early design and development

Below is a look at the basic API so far

    csvFeed := feeds.NewCSVFileFeedWithDOHLCVFormat("../github.com/thetruetrade/gotrade/testdata/JSETOPI.2013.data",
        feeds.DashedYearDayMonthDateParserForLocation(time.Local))

    priceStream := gotrade.NewDailyDOHLCVStream()
    sma, _ := indicators.NewSMAForStream(priceStream, 20, gotrade.UseClosePrice)
    ema, _ := indicators.NewEMAForStream(priceStream, 20, gotrade.UseClosePrice)
    bb, _ := indicators.NewBollingerBandsForStream(priceStream, 20, gotrade.UseClosePrice)

    csvFeed.FillDOHLCVStream(priceStream)

    fmt.Println("price stream has data of length: ", len(priceStream.Data))
    fmt.Println("price stream has min date: ", priceStream.MinDate())
    fmt.Println("price stream has max date: ", priceStream.MaxDate())

    fmt.Println("sma has data of length: ", len(sma.Data))
    fmt.Println("sma is valid from price stream bar number: ", sma.ValidFromBar())
    fmt.Println("sma max: ", sma.MaxValue(), " sma min: ", sma.MinValue())

    fmt.Println("ema has data of length: ", len(ema.Data))
    fmt.Println("ema is valid from price stream bar number: ", ema.ValidFromBar())
    fmt.Println("ema max: ", ema.MaxValue(), " ema min: ", ema.MinValue())

    fmt.Println("bollinger bands has data of length: ", len(bb.Data))
    fmt.Println("bollinger bands is valid from price stream bar number: ", bb.ValidFromBar())
    fmt.Println("bollinger bands max: ", bb.MaxValue(), " sma min: ", bb.MinValue())

Tasks for the near future include: