dtotapi

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 (
	AccountStatusUnspecified = 0
	AccountStatusNew         = 1
	AccountStatusOpen        = 2
	AccountStatusClosed      = 3
)
View Source
const (
	AccountAccessLevelUnspecified = 0
	AccountAccessLevelFullAccess  = 1
	AccountAccessLevelReadOnly    = 2
	AccountAccessLevelNoAccess    = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLevel

type AccessLevel int

type AccountResponse

type AccountResponse struct {
	Id          string
	Type        int
	Name        string
	Status      AccountStatus
	OpenedDate  time.Time
	ClosedData  time.Time
	AccessLevel AccessLevel
}

type AccountStatus

type AccountStatus int

func (AccountStatus) String

func (s AccountStatus) String() string

type AccountsResponse

type AccountsResponse struct {
	Accounts []*AccountResponse
}

func AccountsResponseToDto

func AccountsResponseToDto(resp *investapi.GetAccountsResponse) *AccountsResponse

func (*AccountsResponse) FindAccount

func (ar *AccountsResponse) FindAccount(id string) (*AccountResponse, bool)

FindAccount simplifies search of account by id

type CancelOrderRequest

type CancelOrderRequest struct {
	AccountId string
	OrderId   string
}

func (*CancelOrderRequest) ToTinApi

func (cor *CancelOrderRequest) ToTinApi() *investapi.CancelOrderRequest

type CancelOrderResponse

type CancelOrderResponse struct {
	Time time.Time
}

func CancelOrderResponseToDto

func CancelOrderResponseToDto(resp *investapi.CancelOrderResponse) *CancelOrderResponse

type Instrument

type Instrument struct {
	Figi string
	//0 Undefined
	//1 Min interval
	//2 Five min interval
	Interval int
}

type InstrumentIdType

type InstrumentIdType int
const (
	InstrumentIdUnspecified InstrumentIdType = iota
	InstrumentIdTypeFigi
	InstrumentIdTypeTicker
	InstrumentIdTypeUID
)

type InstrumentRequest

type InstrumentRequest struct {
	IdType    InstrumentIdType
	ClassCode string
	Id        string
}

func (*InstrumentRequest) ToTinApi

func (req *InstrumentRequest) ToTinApi() *investapi.InstrumentRequest

type InstrumentResponse

type InstrumentResponse struct {
	Figi      string
	Ticker    string
	ClassCode string
	Isin      string
	Lot       int64
	Currency  string

	KLong            decimal.Decimal
	KShort           decimal.Decimal
	DLong            decimal.Decimal
	DShort           decimal.Decimal
	DLongMin         decimal.Decimal
	DShortMin        decimal.Decimal
	ShortEnabledFlag bool
	Name             string
	Exchange         string

	CountryOfRisk     string
	CountryOfRiskName string
	InstrumentType    string

	TradingStatus         SecurityTradingStatus
	OtcFlag               bool
	BuyAvailableFlag      bool
	SellAvailableFlag     bool
	MinPriceIncrement     decimal.Decimal
	ApiTradeAvailableFlag bool

	Uid          string
	RealExchange RealExchange
}

func InstrumentResponseToDto

func InstrumentResponseToDto(res *investapi.InstrumentResponse) *InstrumentResponse

func (*InstrumentResponse) IsTradingAvailable

func (ir *InstrumentResponse) IsTradingAvailable() bool

type LastPrice

type LastPrice struct {
	Figi  string
	Price decimal.Decimal
	Time  time.Time
}

type LastPricesRequest

type LastPricesRequest struct {
	Figis []string
}

func (*LastPricesRequest) ToTinApi

func (req *LastPricesRequest) ToTinApi() *investapi.GetLastPricesRequest

type LastPricesResponse

type LastPricesResponse struct {
	LastPrices []*LastPrice
}

func LastPricesResponseToDto

func LastPricesResponseToDto(resp *investapi.GetLastPricesResponse) *LastPricesResponse

func (*LastPricesResponse) GetByFigi

func (lpr *LastPricesResponse) GetByFigi(figi string) *LastPrice

type MoneyValue

type MoneyValue struct {
	Currency string
	Value    decimal.Decimal
}

func MoneyValueToDto

func MoneyValueToDto(q *investapi.MoneyValue) *MoneyValue

func (*MoneyValue) ToTinApi

func (mv *MoneyValue) ToTinApi() *investapi.MoneyValue

type OrderDirection

type OrderDirection int
const (
	OrderDirectionUnspecified OrderDirection = iota
	OrderDirectionBuy
	OrderDirectionSell
)

type OrderStage

type OrderStage struct {
	Price    *MoneyValue
	Quantity int64
	TradeId  string
}

func OrderStageToDto

func OrderStageToDto(os *investapi.OrderStage) *OrderStage

type OrderStateRequest

type OrderStateRequest struct {
	AccountId string
	OrderId   string
}

func (*OrderStateRequest) ToTinApi

func (r *OrderStateRequest) ToTinApi() *investapi.GetOrderStateRequest

type OrderStateResponse

type OrderStateResponse struct {
	OrderId           string //Идентификатор заявки.
	Figi              string
	LotsReq           int64                //Lots requested
	LotsExec          int64                //Lots executed
	ExecStatus        PostOrderExcecStatus //Current order status.
	InitPrice         *MoneyValue          //Initial order price. Multiplication of requested lots quantity by price.
	ExecPrice         *MoneyValue          //Executed order price. Multiplication of average price by number of lots.
	TotalPrice        *MoneyValue          //Final order price with all commissions
	AvrPrice          *MoneyValue          //Average single position price.
	InitCommission    *MoneyValue          //Commission calculated at the order initiation
	ExecCommission    *MoneyValue          //Commission calculated by the order result
	Direction         OrderDirection       //Order direction
	InitSecurityPrice *MoneyValue          //Initial price by one instrument
	Stages            []*OrderStage        //Stages of order execution
	ServiceCommission *MoneyValue          //Service commission
	Currency          string
	Type              OrderType
	OrderDate         time.Time //Order creation time
}

func OrderStateResponseToDto

func OrderStateResponseToDto(osr *investapi.OrderState) *OrderStateResponse

type OrderTrade

type OrderTrade struct {
	TradeTime time.Time
	Price     decimal.Decimal
	Quantity  int64
}

type OrderTrades

type OrderTrades struct {
	OrderId   string
	CreatedAt time.Time
	Direction OrderDirection
	Figi      string
	Trades    []*OrderTrade
	AccountId string
}

func OrderTradesToDto

func OrderTradesToDto(resp *investapi.OrderTrades) *OrderTrades

type OrderType

type OrderType int
const (
	OrderTypeUnspecified OrderType = iota
	OrderTypeLimit
	OrderTypeMarket
)

type PositionsFuture

type PositionsFuture struct {
	Figi    string
	Blocked int64
	Balance int64
}

type PositionsRequest

type PositionsRequest struct {
	AccountId string
}

func (*PositionsRequest) ToTinApi

func (req *PositionsRequest) ToTinApi() *investapi.PositionsRequest

type PositionsResponse

type PositionsResponse struct {
	Money                   []*MoneyValue
	Blocked                 []*MoneyValue
	Securities              []*PositionsSecurity
	LimitsLoadingInProgress bool
	Futures                 []*PositionsFuture
}

func PositionsResponseToDto

func PositionsResponseToDto(resp *investapi.PositionsResponse) *PositionsResponse

func (*PositionsResponse) GetInstrument

func (ps *PositionsResponse) GetInstrument(figi string) *PositionsSecurity

func (*PositionsResponse) GetMoney

func (ps *PositionsResponse) GetMoney(currency string) *MoneyValue

type PositionsSecurity

type PositionsSecurity struct {
	Figi    string
	Blocked int64
	Balance int64
}

type PostOrderExcecStatus

type PostOrderExcecStatus int
const (
	ExecutionReportStatusUnspecified PostOrderExcecStatus = iota
	ExecutionReportStatusFill
	ExecutionReportStatusRejected
	ExecutionReportStatusCancelled
	ExecutionReportStatusNew
	ExecutionReportStatusPartiallyfill
)

type PostOrderRequest

type PostOrderRequest struct {
	Figi       string
	PosNum     int64
	InstrPrice decimal.Decimal
	Direction  OrderDirection
	AccountId  string
	OrderType  OrderType
	OrderId    string
}

func (*PostOrderRequest) ToTinApi

func (pr *PostOrderRequest) ToTinApi() *investapi.PostOrderRequest

type PostOrderResponse

type PostOrderResponse struct {
	OrderId        string
	Figi           string
	LotsReq        int64
	LotsExec       int64
	ExecStatus     PostOrderExcecStatus
	InitPrice      *MoneyValue
	ExecPrice      *MoneyValue
	TotalPrice     *MoneyValue
	InitCommission *MoneyValue
	ExecCommission *MoneyValue
	Aci            *MoneyValue
	Direction      OrderDirection
	Type           OrderType
	Message        string
	InitiOrdPrice  decimal.Decimal
}

func PostOrderResponseToDto

func PostOrderResponseToDto(resp *investapi.PostOrderResponse) *PostOrderResponse

type RealExchange

type RealExchange int
const (
	RealExchangeUnspecified RealExchange = iota
	RealExchangeMoex                     //Moscow exchange
	RealExchangeRts                      //Saint-Petersburg exchange
	RealExchangeOtc                      //External instrument
)

type SecurityTradingStatus

type SecurityTradingStatus int
const (
	SecurityTradingStatusUnspecified            SecurityTradingStatus = iota //Undefined status
	SecurityTradingStatusNotAvailableForTrading                              //Not available for trading
	SecurityTradingStatusOpeningPeriod
	SecurityTradingStatusClosingPeriod
	SecurityTradingStatusBreakInTrading
	SecurityTradingStatusNormalTrading
	SecurityTradingStatusClosingAuction
	SecurityTradingStatusDarkPoolAuction
	SecurityTradingStatusDiscreteAuction
	SecurityTradingStatusOpeningAuctionPeriod
	SecurityTradingStatusTradingAtClosingAuctionPrice
	SecurityTradingStatusSessionAssigned
	SecurityTradingStatusSessionClose
	SecurityTradingStatusSessionOpen
	SecurityTradingStatusDealerNormalTrading
	SecurityTradingStatusDealerBreakInTrading
	SecurityTradingStatusDealerNotAvailableForTrading
)

type ShareResponse

type ShareResponse struct {
	Figi      string
	Ticker    string
	ClassCode string
	Isin      string
	Lot       int64
	Currency  string

	KLong            decimal.Decimal
	KShort           decimal.Decimal
	DLong            decimal.Decimal
	DShort           decimal.Decimal
	DLongMin         decimal.Decimal
	DShortMin        decimal.Decimal
	ShortEnabledFlag bool
	Name             string
	Exchange         string

	IpoDate   time.Time
	IssueSize int64

	CountryOfRisk     string
	CountryOfRiskName string
	Sector            string
	IssueSizePlan     int64
	Nominal           *MoneyValue

	TradingStatus         SecurityTradingStatus
	OtcFlag               bool
	BuyAvailableFlag      bool
	SellAvailableFlag     bool
	DivYieldFlag          bool
	ShareType             int
	MinPriceIncrement     decimal.Decimal
	ApiTradeAvailableFlag bool

	Uid          string
	RealExchange RealExchange
}

type SharesResponse

type SharesResponse struct {
	Instruments []*ShareResponse
}

func SharesResponseToDto

func SharesResponseToDto(res *investapi.SharesResponse) *SharesResponse

type StreamCandleResponse

type StreamCandleResponse struct {
	Figi      string
	Interval  int
	Open      decimal.Decimal
	High      decimal.Decimal
	Low       decimal.Decimal
	Close     decimal.Decimal
	Volume    int64
	TimeStart time.Time
	TimeEnd   time.Time
}

func StreamCandleResponseToDto

func StreamCandleResponseToDto(resp *investapi.Candle) *StreamCandleResponse

type SubscribeCandlesRequest

type SubscribeCandlesRequest struct {
	Instruments []Instrument
}

Jump to

Keyboard shortcuts

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