order

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Results map[string]*summary
	// contains filtered or unexported fields
}

func NewController

func NewController(ctx context.Context, exchange exchange.Exchange, storage *ent.Client,
	orderFeed *Feed, notifier notification.Notifier) *Controller

func (*Controller) Account

func (c *Controller) Account() (model.Account, error)

func (*Controller) Cancel

func (c *Controller) Cancel(order model.Order) error

func (*Controller) Order

func (c *Controller) Order(symbol string, id int64) (model.Order, error)

func (*Controller) OrderLimit

func (c *Controller) OrderLimit(side model.SideType, symbol string, size, limit float64) (model.Order, error)

func (*Controller) OrderMarket

func (c *Controller) OrderMarket(side model.SideType, symbol string, size float64) (model.Order, error)

func (*Controller) OrderOCO

func (c *Controller) OrderOCO(side model.SideType, symbol string, size, price, stop,
	stopLimit float64) ([]model.Order, error)

func (*Controller) Position

func (c *Controller) Position(symbol string) (asset, quote float64, err error)

func (*Controller) Start

func (c *Controller) Start()

func (*Controller) Stop

func (c *Controller) Stop()

type DataFeed

type DataFeed struct {
	Data chan model.Order
	Err  chan error
}

type Feed

type Feed struct {
	OrderFeeds            map[string]*DataFeed
	SubscriptionsBySymbol map[string][]Subscription
}

func NewOrderFeed

func NewOrderFeed() *Feed

func (*Feed) Publish

func (d *Feed) Publish(order model.Order, newOrder bool)

func (*Feed) Start

func (d *Feed) Start()

func (*Feed) Subscribe

func (d *Feed) Subscribe(symbol string, consumer FeedConsumer, onlyNewOrder bool)

type FeedConsumer

type FeedConsumer func(order model.Order)

type Subscription

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

Jump to

Keyboard shortcuts

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