hypecheck

package module
v0.0.0-...-41cc446 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2013 License: Unlicense Imports: 14 Imported by: 0

README

hypecheck

Look over stock market data to see if large price swings in any one direction had tendency to reverse

Documentation

Overview

The ideas in this code and the load balancer are taken from http://concur.rspace.googlecode.com/hg/talk/concur.html#slide-51

Took substantitial portions of code from https://github.com/michaeldv/mop for this

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyzeAllResponses

func AnalyzeAllResponses(a *Analyzer, ar []*Response)

Analyze all significant dates with a histogram. But also write any significant data to a csv file so we can do further processing in R

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

func NewAnalyzer

func NewAnalyzer(days int, threshold float64) *Analyzer

func (*Analyzer) AnalyzeStock

func (a *Analyzer) AnalyzeStock(resp *Response) (ois []OfInterest)

Analyze the stock data

type Balancer

type Balancer struct {
	Pool *Pool
	// contains filtered or unexported fields
}

func NewBalancer

func NewBalancer(n int) (b *Balancer)

Constructor method for the Load Balancer

func (*Balancer) Balance

func (b *Balancer) Balance(work chan Request)

type OfInterest

type OfInterest struct {
	Index int
	Ret   float64
	Stock Stock
	Swing float64
}

type Options

type Options struct {
	Values url.Values
}

func NewOptions

func NewOptions() *Options

func (*Options) Add

func (o *Options) Add(name string, value interface{})

Really just a convenience method. All possible optional values we are able to add can be found at http://www.gummy-stuff.org/Yahoo-data.htm

type Pool

type Pool []*Worker

func (Pool) Len

func (p Pool) Len() int

func (Pool) Less

func (p Pool) Less(i, j int) bool

func (*Pool) Pop

func (p *Pool) Pop() interface{}

func (*Pool) Push

func (p *Pool) Push(x interface{})

func (Pool) Swap

func (p Pool) Swap(i, j int)

type Request

type Request struct {
	Options  *Options
	Response chan *Response
	Symbol   string
}

func NewRequest

func NewRequest(c chan *Response, symbol string, values map[string]interface{}) (r *Request)

func (*Request) Execute

func (r *Request) Execute() (resp *Response)

Execute the request to the Yahoo finance API. Get the necessary data and then return it to the requester object so it can be processed

type Requester

type Requester struct {

	// Channel of active work
	Work chan Request
	// contains filtered or unexported fields
}

func NewRequester

func NewRequester(a *Analyzer, maxRequests, requestDelay int) (r *Requester)

Make a new Requester object.

func (*Requester) MakeRequests

func (r *Requester) MakeRequests(companies []string)

Given a map of companies and their corresponding wikipedia pages, make requests to stats.grok.se so that we can get statistics as to how frequently people are viewing their pages

type Response

type Response struct {
	Stock  []Stock
	Symbol string
}

type Stock

type Stock struct {
	Date   string
	Open   float64 // market open price.
	High   float64 // day's high.
	Low    float64 // day's low.
	Close  float64 // closing price
	Volume int     // volume.
	Adj    float64 // closing price adjusted for inflation and other junk
}

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Taken from https://gist.github.com/kylelk/6396070 and modified
Taken from https://gist.github.com/kylelk/6396070 and modified

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL