dto

package
v0.0.0-...-51300c0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstrAmountField string = "instrAmount"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlgorithmResponse

type AlgorithmResponse struct {
	AlgorithmID uint
	Strategy    string            `json:"strategy"`
	AccountId   string            `json:"accountId"`
	Figis       []string          `json:"figis"`
	MoneyLimits []*MoneyValue     `json:"moneyLimits"`
	Params      map[string]string `json:"params"`
	IsActive    bool              `json:"isActive"`
	InstrAvail  *InstrumentsInfo  `json:"instrAvail"` //Information about available instruments for algorithm
	CreatedAt   time.Time         `json:"createdAt"`
	UpdatedAt   time.Time         `json:"updatedAt"`
}

type AlgorithmsResponse

type AlgorithmsResponse struct {
	Algorithms []*AlgorithmResponse `json:"algorithms"`
}

AlgorithmsResponse represents algorithm list response

type CreateAlgorithmRequest

type CreateAlgorithmRequest struct {
	AccountId string            `json:"accountId"`
	Figis     []string          `json:"figis"`
	Strategy  string            `json:"strategy"`
	Limits    []MoneyValue      `json:"limits"` //Algorithm limits on using money
	Params    map[string]string `json:"params"`
	InstrInit *InstrumentsInfo  `json:"instrInit"` //Optional - to specify initial instrument available
}

CreateAlgorithmRequest request to create new trade algorithm or history algorithm config

type HistStatIdDto

type HistStatIdDto struct {
	Id       uint
	HistStat *HistStatResponse
	Param    map[string]string
}

HistStatIdDto represents auxiliary dto used by range analysis

func (HistStatIdDto) String

func (hs HistStatIdDto) String() string

type HistStatInRangeResponse

type HistStatInRangeResponse struct {
	BestRes *HistStatResponse `json:"bestRes"` //best stat result
	Params  map[string]string `json:"params"`  //best stat result parameters
}

HistStatInRangeResponse history range analysis result

type HistStatResponse

type HistStatResponse struct {
	BuyOpNum   uint                       `json:"buyOpNum"`   //Number of buy operations
	SellOpNum  uint                       `json:"sellOpNum"`  //Number of sell operations
	CurBalance map[string]decimal.Decimal `json:"curBalance"` //Result profit
}

HistStatResponse statistics retrieved by algorithm analysis CurBalance is result balance by the end algorithm simulation. If there are not sold instruments, price is taken from the last data and converted to currency

type InstrumentInfo

type InstrumentInfo struct {
	Figi        string          `json:"figi"`     //Instrument figi
	Amount      int64           `json:"amount"`   //Amount of instrument available
	BuyPosPrice decimal.Decimal `json:"buyPrice"` //To specify instrument bought price if it is
}

type InstrumentStat

type InstrumentStat struct {
	InstrFigi     string          //Instrument figi
	FinalAmount   int64           //Final amount of lots of instrument
	OperationNum  uint            //Number of success operations with instrument made by algorithm
	LastLotPrice  decimal.Decimal //Last price of instrument
	FinalMoneyVal decimal.Decimal //Final money balance by operations with instrument (sum of money spend/receive by instrument figi)
	Currency      string          //Currency of instrument
}

type InstrumentValue

type InstrumentValue struct {
	Figi   string          `json:"figi"`
	Amount int64           `json:"amount"`
	Price  decimal.Decimal `json:"price"`
}

type InstrumentsInfo

type InstrumentsInfo struct {
	Instruments []*InstrumentInfo `json:"instruments"`
}

type LoadHistoryRequest

type LoadHistoryRequest struct {
	Figis     []string                 `json:"figis"`
	StartTime int64                    `json:"start_time"` //Start time unix time ms
	EndTime   int64                    `json:"end_time"`   //End time unix time ms
	Interval  investapi.CandleInterval `json:"interval,default=5"`
}

type MoneyStat

type MoneyStat struct {
	Currency     string          //Currency of money
	FinalValue   decimal.Decimal //Final value of currency balance (starting value as 0)
	OperationNum uint            //Number of success operations with currency
}

type MoneyValue

type MoneyValue struct {
	Currency string          `json:"currency"`
	Value    decimal.Decimal `json:"value"`
}

type StatAlgoRequest

type StatAlgoRequest struct {
	AlgorithmID uint `form:"algorithm_id"`
}

type StatAlgoResponse

type StatAlgoResponse struct {
	AlgorithmID       uint
	SuccessOrders     uint             //Number of success orders
	FailedOrders      uint             //Number of failed orders
	CanceledOrders    uint             //Number of cancelled orders
	MoneyChanges      []MoneyStat      //Data about how money amount changed by each currency
	InstrumentChanges []InstrumentStat //Data about how instrument amount changed by each instrument
}

type StopAlgorithmRequest

type StopAlgorithmRequest struct {
	AlgorithmId uint `form:"algorithmId"`
}

type StopAlgorithmResponse

type StopAlgorithmResponse struct {
	IsStopped bool   `json:"isStopped"`
	Info      string `json:"info"`
}

type TradeStartResponse

type TradeStartResponse struct {
	Info        string
	AlgorithmID uint
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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