fxdl

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

README

FXDL

fxdl downloads a maximum of 200,000 candles from https://forexsb.com

Install

To install the library, run:

$ go get github.com/MShoaei/fxdl

Example

package main

import "github.com/MShoaei/fxdl"

func main() {
	// create a client and pass the time frame of your choice
	// valid time frames are: M1, M5, M15, M30
	c := NewHistoryClient(M5)
	// you can set a proxy if you need
	c.SetProxy("socks5://127.0.0.1:12123")
	// *Client.Do fetches the data of the symbol in previously provided time frame
	// and returns a slice of candles. the length of slice should be 200,000 
	candles, err := c.Do("EURUSD")
}

Documentation

Index

Constants

View Source
const (
	M1  = period(1 * time.Minute)
	M5  = period(5 * time.Minute)
	M15 = period(15 * time.Minute)
	M30 = period(30 * time.Minute)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Candle

type Candle struct {
	Start      time.Time
	End        time.Time
	OpenPrice  float64
	ClosePrice float64
	MaxPrice   float64
	MinPrice   float64
	Volume     int
}

type Client

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

func NewHistoryClient

func NewHistoryClient(p period) *Client

func (*Client) Do

func (c *Client) Do(symbol string) ([]*Candle, error)

func (*Client) SetProxy

func (c *Client) SetProxy(proxy string)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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