Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

ydm/dola

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dola

Що се рекло от три наречници,
що се рекло и се извършило...

Dola is a cryptocurrency trading library that provides:

Exchanges

Dola expects to find a configuration file at ~/.dola/config.json. See an example here.

NB: Dola needs just the exchanges section.

Strategies

Each strategy is an implementation of the following interface. Dola has the responsibility of invoking all of the Strategy methods. Strategy.On* methods are invoked whenever there is new data from one of the registered exchanges. If you need a strategy that supports just one exchange (out of many), take a look at DedicatedStrategy.

type Strategy interface {
	Init(k *Keep, e exchange.IBotExchange) error
	OnFunding(k *Keep, e exchange.IBotExchange, x stream.FundingData) error
	OnPrice(k *Keep, e exchange.IBotExchange, x ticker.Price) error
	OnKline(k *Keep, e exchange.IBotExchange, x stream.KlineData) error
	OnOrderBook(k *Keep, e exchange.IBotExchange, x orderbook.Base) error
	OnOrder(k *Keep, e exchange.IBotExchange, x order.Detail) error
	OnModify(k *Keep, e exchange.IBotExchange, x order.Modify) error
	OnBalanceChange(k *Keep, e exchange.IBotExchange, x account.Change) error
	OnUnrecognized(k *Keep, e exchange.IBotExchange, x interface{}) error
	Deinit(k *Keep, e exchange.IBotExchange) error
}

Example

package main

import (
	"context"
	"github.com/ydm/dola"
)

func main() {
	keep, _ := dola.NewKeepBuilder().Build()
	keep.Root.Add("verbose", dola.VerboseStrategy{})
	keep.Run(context.Background())
}

Augment config

keep, _ := dola.NewKeepBuilder().Augment(func (c *config.Config) erro {
    doSomething(c)
}).Build()

Use custom exchanges

creator := func() (exchange.IBotExchange, error) {
  return NewCustomExchange()
}
keep, _ := dola.NewKeepBuilder().CustomExchange(name, creator).Build()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •