controller

package
v0.0.0-...-0f447c4 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderStatePlaced    OrderState = "ORDER_STATE_PLACED"
	OrderStateFilled    OrderState = "ORDER_STATE_FILLED"
	OrderStateCancelled OrderState = "ORDER_STATE_CANCELED"
	OrderStateStarted   OrderState = "ORDER_STATE_STARTED"

	OrderTypeBuy       OrderType = "ORDER_TYPE_BUY"
	OrderTypeSell      OrderType = "ORDER_TYPE_SELL"
	OrderTypeBuyLimit  OrderType = "ORDER_TYPE_BUY_LIMIT"
	OrderTypeSellLimit OrderType = "ORDER_TYPE_SELL_LIMIT"
	OrderTypeBuyStop   OrderType = "ORDER_TYPE_BUY_STOP"
	OrderTypeSellStop  OrderType = "ORDER_TYPE_SELL_STOP"

	DealEntryIn  DealEntry = "DEAL_ENTRY_IN"
	DealEntryOut DealEntry = "DEAL_ENTRY_OUT"

	DealReasonSL     DealReason = "DEAL_REASON_SL"
	DealReasonTP     DealReason = "DEAL_REASON_TP"
	DealReasonClient DealReason = "DEAL_REASON_CLIENT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

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

func New

func New(exanteApi exante.Iface, exchange exchanges.Api) *Api

func (*Api) Sync

func (a *Api) Sync(accountID string, req SyncRequest) (SyncResponse, error)

type DealEntry

type DealEntry string

type DealReason

type DealReason string

func (DealReason) IsStop

func (r DealReason) IsStop() bool

type Mt5Order

type Mt5Order struct {
	Symbol     string
	Ticket     string
	Volume     float64
	Type       OrderType
	TakeProfit float64
	StopLoss   float64
	Price      float64
	State      OrderState
}

func (Mt5Order) WithTicket

func (m Mt5Order) WithTicket() string

type Mt5OrderHistory

type Mt5OrderHistory struct {
	Ticket    string
	State     OrderState
	UpdatedAt time.Time
}

func (Mt5OrderHistory) WithTicket

func (m Mt5OrderHistory) WithTicket() string

type Mt5Position

type Mt5Position struct {
	Symbol         string
	Ticket         string
	PositionTicket string
	Volume         float64
	TakeProfit     float64
	StopLoss       float64
	Price          float64
}

func (Mt5Position) WithTicket

func (m Mt5Position) WithTicket() string

type Mt5PositionHistory

type Mt5PositionHistory struct {
	Symbol         string
	Entry          DealEntry
	Reason         DealReason
	Ticket         string
	PositionTicket string
	Volume         float64
	TakeProfit     float64
	StopLoss       float64
	Price          float64
}

func (Mt5PositionHistory) ToHistory

func (m Mt5PositionHistory) ToHistory() Mt5Position

func (Mt5PositionHistory) WithTicket

func (m Mt5PositionHistory) WithTicket() string

type Mt5Requests

type Mt5Requests interface {
	WithTicket() string
}

type OrderState

type OrderState string

type OrderType

type OrderType string

func (OrderType) IsLimit

func (t OrderType) IsLimit() bool

type SyncRequest

type SyncRequest struct {
	// for each position the program should:
	// 1. check if there is any empty state on State.ActivePositions
	ActivePositions         []Mt5Position
	RecentInactivePositions []Mt5PositionHistory

	ActiveOrders         []Mt5Order
	RecentInactiveOrders []Mt5Order
}

type SyncResponse

type SyncResponse struct {
	Journal  []string `json:"journal"`
	JournalF string   `json:"journalF"`
}

func (*SyncResponse) AddJournal

func (sr *SyncResponse) AddJournal(txt string)

Jump to

Keyboard shortcuts

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