Coder Social home page Coder Social logo

indicatoralpaca's Introduction

GoDoc License Go Report Card Go CI codecov

Indicator Alpaca

Indicator Alpaca provides Alpaca Markets integration for Indicator Golang module that provides a rich set of technical analysis indicators, strategies, and a framework for backtesting.

Example

This example showcases Alpaca Markets data access within the Indicator library.

// Initialize a new Alpaca Markets repository
repository := indicatoralpaca.NewAlpacaBarsRepository("key", "secret")

// Make any necessary changes in GetBarsRequest
repository.GetBarsRequestTempalte.Adjustment = "raw"
repository.GetBarsRequestTemplate.Currency = "usd"

// Use the Alpaca Markets repository in backtesting
backtest := strategy.NewBacktest(repository, "output")
backtest.Names = append(backtest.Names, "brk-b")
backtest.Strategies = append(backtest.Strategies, trend.NewAroonStrategy())

err = backtest.Run()

indicatoralpaca

import "github.com/cinar/indicatoralpaca"

Package indicatoralpaca provides Alpaca Markets inintegration for the Indicator technical analysis library.

Index

Constants

const (
	// DefaultAlpacaBarsRepositoryTimeFrameUnit is the default time frame unit of a day.
	DefaultAlpacaBarsRepositoryTimeFrameUnit = marketdata.Day
)

type AlpacaBarsRepository

AlpacaBarsRepository provides access to financial market data, retrieving asset snapshots, by interacting with the Alpaca Markets API. To use this repository, you'll need a valid API key from https://alpaca.markets.

type AlpacaBarsRepository struct {

	// GetBarsRequestTemplate is the request template used to get the bars.
	GetBarsRequestTemplate marketdata.GetBarsRequest
	// contains filtered or unexported fields
}

func NewAlpacaBarsRepository

func NewAlpacaBarsRepository(apiKey, apiSecret string) *AlpacaBarsRepository

NewAlpacaBarsRepository initializes an Alpaca Markets repository with the given API key and API secret.

func NewAlpacaBarsRepositoryWithClient

func NewAlpacaBarsRepositoryWithClient(client *marketdata.Client) *AlpacaBarsRepository

NewAlpacaBarsRepositoryWithClient initializes an Alpaca Markets repository with the given client.

func (*AlpacaBarsRepository) Append

func (*AlpacaBarsRepository) Append(_ string, _ <-chan *asset.Snapshot) error

Append adds the given snapshows to the asset with the given name.

func (*AlpacaBarsRepository) Assets

func (*AlpacaBarsRepository) Assets() ([]string, error)

Assets returns the names of all assets in the repository.

func (*AlpacaBarsRepository) Get

func (r *AlpacaBarsRepository) Get(name string) (<-chan *asset.Snapshot, error)

Get attempts to return a channel of snapshots for the asset with the given name.

func (*AlpacaBarsRepository) GetSince

func (r *AlpacaBarsRepository) GetSince(name string, date time.Time) (<-chan *asset.Snapshot, error)

GetSince attempts to return a channel of snapshots for the asset with the given name since the given date.

func (*AlpacaBarsRepository) LastDate

func (r *AlpacaBarsRepository) LastDate(name string) (time.Time, error)

LastDate returns the date of the last snapshot for the asset with the given name.

Generated by gomarkdoc

Contributing to the Project

Anyone can contribute to Indicator library. Please make sure to read our Contributor Covenant Code of Conduct guide first. Follow the How to Contribute to Indicator to contribute. Signining a Contributor Agreement is also required to contribute to the project.

Disclaimer

The information provided on this project is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.

License

Indicator libary dual-licensed under GNU AGPLv3 License and a commercial license. For free use and modifications of the code, you can use the AGPLv3 license. If you require commercial license with different terms, please contact me.

Copyright (c) 2021-2024 Onur Cinar.    
The source code is provided under GNU AGPLv3 License.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

indicatoralpaca's People

Contributors

cinar avatar

Watchers

Lucian avatar  avatar

Forkers

iocron

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.