broker

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

* Copyright 2023 The Cerebro Authors * * Licensed under the GNU General Public License v3.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * <https:fsf.org/> * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotEnoughStock      = errors.New("Not Enough Stock")
	ErrNotEnoughMoney      = errors.New("Not Enough Money")
	ErrPositionExists      = errors.New("Broker Position is Exists")
	ErrPositionNotExists   = errors.New("Broker Position is not Exists")
	ErrLowSizeThenPosition = errors.New("Low Size then position")
	ErrPriceIsZero         = errors.New("Price is Zero")
	ErrOrderSizeIsZero     = errors.New("Order Size is Zero")
)

Functions

This section is empty.

Types

type Broker

type Broker struct {
	EventEngine event.Broadcaster
	// contains filtered or unexported fields
}

func NewDefaultBroker added in v0.0.3

func NewDefaultBroker(eventEngine event.Broadcaster, store market.Market, logger log.Logger) *Broker

func (*Broker) Listen

func (b *Broker) Listen(e interface{})

func (*Broker) Order

func (b *Broker) Order(ctx context.Context, o order.Order, safe bool) error

func (*Broker) Orders added in v0.0.3

func (b *Broker) Orders(code string) []order.Order

func (*Broker) Position

func (b *Broker) Position(ticker string) (position.Position, bool)

Jump to

Keyboard shortcuts

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