order

package
v0.0.0-...-9b4e82f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run()

Types

type BasicResponse

type BasicResponse struct {
	Order        Order   `json:"order"`
	OrderDetails Details `json:"details,omitempty"`
	Success      bool    `json:"success"`
	Err          string  `json:"err,omitempty"`
}

func (*BasicResponse) GetError

func (br *BasicResponse) GetError() string

func (*BasicResponse) IsSuccess

func (br *BasicResponse) IsSuccess() bool

type Details

type Details struct {
	SharePrice    int64    `json:"share_price"`
	ShareCount    int64    `json:"share_count"`
	ShareValue    int64    `json:"shares_valuere"`
	Tax           int64    `json:"tax"`
	Fees          int64    `json:"fees"`
	Bonus         int64    `json:"bonus"`
	Result        int64    `json:"result"`
	ActiveEffects []string `json:"active_effects"`
}

type Order

type Order interface {
	// contains filtered or unexported methods
}

type ProspectOrder

type ProspectOrder struct {
	ValuableID      string        `json:"stock_id"`
	PortfolioID     string        `json:"portfolio"`
	ExchangeID      string        `json:"-"`
	Amount          int64         `json:"amount"`
	ResponseChannel chan Response `json:"-"`
}

func MakeProspect

func MakeProspect(valuableID, portfolioUUID string, amount int64) *ProspectOrder

type Response

type Response interface {
	IsSuccess() bool
	GetError() string
	// contains filtered or unexported methods
}

type TradeOrder

type TradeOrder struct {
	ValuableID      string        `json:"stock_id"`
	PortfolioID     string        `json:"portfolio"`
	ExchangeID      string        `json:"-"`
	Amount          int64         `json:"amount"`
	ResponseChannel chan Response `json:"-"`
}

* Purchase order represents a single order

func MakePurchaseOrder

func MakePurchaseOrder(valuableID, portfolioUUID string, amount int64) *TradeOrder

note this does not validate if the stock exists or not, that's done in the trade() function

type TradeOrderHistory

type TradeOrderHistory struct {
	StockUuid string
	Time      time.Time
	Portfolio string
	NextOrder Order
}

type TransferOrder

type TransferOrder struct {
	ReceiverID      string        `json:"receiver"`
	PortfolioID     string        `json:"giver"`
	Amount          int64         `json:"amount"`
	ResponseChannel chan Response `json:"-"`
}

func MakeTransferOrder

func MakeTransferOrder(giver, receiver string, amount int64) *TransferOrder

Jump to

Keyboard shortcuts

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