moexiss

package module
v0.0.0-...-cc6cf16 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT Imports: 17 Imported by: 0

README

MOEXISS Golang  codecov  Go Report Card

An unofficial client of Application Programming Interface for the Moscow Exchange(MOEX) ISS(Informational & Statistical Server) on Golang.
Неофициальный клиент для получения информации и статистики Московской биржи MOEX на Golang.

stability-experimental

Under active development, pls, do not use it
Находится в разработке, не стоит использовать

Usage

Construct a new MOEX ISS client, then use the various services on the client to access different parts of the MOEX ISS API.
For example:

client := moexiss.NewClient(nil)

// Get current turnover on all the markets.
turnovers, err := client.Turnovers.GetTurnovers(context.Background(), nil)
Getting ISS reference

Getting initial ISS reference:

client := moexiss.NewClient(nil)

result, err := client.Index.List(context.Background(), nil)

Request options (not mandatory) for initial ISS reference:

  • Engine() - options for the list of trading systems.

    • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.
  • Market() - options for the list of available markets.

    • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.
  • Board() - options for the list of trading modes.

    • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.
  • BoardGroup() - options for the list of board groups.

    • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.
    • IsTraded(bool) - show traded only currently traded board groups. false by default.
    • WithEngine(EngineName) - filtering by an engine.
  • Duration() - selection for the list of available calculation intervals of candles in the HLOCV format.

    • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.
  • SecurityType() - options for the list of securities.

    • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.
    • WithEngine(EngineName) - filtering by an engine.
  • SecurityGroup() - options for the list of security groups.

    • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.
    • WithEngine(EngineName) - filtering by an engine.
    • HideInactive(bool) - filtering by activity. false by default.
  • SecurityCollection() - options of collections of the securities list.

    • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.

An example:

client := moexiss.NewClient(nil)
	
bld := moexiss.NewIndexReqOptionsBuilder()
bld.BoardGroup().Lang(moexiss.LangEn).WithEngine(moexiss.EngineStock).IsTraded(true)
bld.Engine().Lang(moexiss.LangEn)
options := bld.Build()
	
result, err := client.Index.List(context.Background(), options)
Getting trading results

Getting aggregated trading results for the date by market:

client := moexiss.NewClient(nil)
ticker := "sberp"
result, err := client.Aggregates.GetAggregates(context.Background(), ticker, nil)

Optional query parameters:

  • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.
  • Date(time.Date) - date of the results. The last date of aggregated trading results by default.

An example:

client := moexiss.NewClient(nil)
ticker := "sberp"
opt := moexiss.NewAggregateReqOptionsBuilder().
Lang(moexiss.LangEn).
Date(time.Date(2021/*year*/, 2/*month*/, 24/*day*/, 12, 0, 0, 0, time.UTC)).
Build()
result, err := client.Aggregates.GetAggregates(context.Background(), ticker, opt)
Getting a list of indices that include a security

How to get a list of indices that include a security:

client := moexiss.NewClient(nil)
ticker := "sberp"
result, err := client.Indices.GetIndices(context.Background(), ticker, nil)

Optional query parameters:

  • Lang(Language) - the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.

An example:

client := moexiss.NewClient(nil)
ticker := "sberp"
opt := moexiss.NewIndicesReqOptionsBuilder().
Lang(moexiss.LangEn).
Build()
result, err := client.Indices.GetIndices(context.Background(), ticker, opt)
Get turnovers on all the markets

How to get turnovers on all the markets:

client := moexiss.NewClient(nil)
turnovers, err := client.Turnovers.GetTurnovers(context.Background(), nil)

Optional query parameters:

  • Lang(Language) — the language of the result. Possible values moexiss.LangEn, moexiss.LangRu. By default, moexiss.LangRu.
  • Date(time.Date) — date for which you want to display data. Today — by default.
  • IsTonightSession(bool) — show turnovers for the evening session. false — by default.

For example:

client := moexiss.NewClient(nil)
options := moexiss.NewTurnoverReqOptionsBuilder().
Lang(moexiss.LangEn).
Date(time.Date(2021/*year*/, 2/*month*/, 24/*day*/, 12, 0, 0, 0, time.UTC)).
IsTonightSession(true).
Build()
result, err := client.Turnovers.GetTurnovers(context.Background(), options)
Listing of securities
  • Getting information on when securities were traded on which boards:
client := moexiss.NewClient(nil)
engine := moexiss.EngineStock
market := "shares"
result, err := client.HistoryListing.
	GetListing(context.Background(), engine, market, nil)
  • Getting data on the listing of securities for a given board:
client := moexiss.NewClient(nil)
engine := moexiss.EngineStock
market := "shares"
board := "TQTD"
result, err := client.HistoryListing.
   GetListingByBoard(context.Background(), engine, market, board, nil)
  • Getting data on the listing of securities for a given group of boards:
client := moexiss.NewClient(nil)
engine := moexiss.EngineStock
market := "shares"
boardGroupId := "6"
result, err := client.HistoryListing.
	GetListingByBoardGroup(context.Background(), engine, market, boardGroupId, nil)

Использование

Создайте новый MOEX ISS клиент, а затем используйте различные сервисы клиента для доступа к различным частям MOEX ISS API.
Например:

client := moexiss.NewClient(nil)

// Получить сводные обороты по рынкам.
turnovers, err := client.Turnovers.GetTurnovers(context.Background(), nil)
Получение ISS справочников

Получить глобальные справочники ISS:

client := moexiss.NewClient(nil)

result, err := client.Index.List(context.Background(), nil)

Опции запроса(не являются обязательными) для получения глобальных справочников ISS:

  • Engine() - опции для списка торговых систем.

    • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.
  • Market() - опции для списка доступных рынков.

    • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.
  • Board() - опции для списка режимов торгов.

    • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.
  • BoardGroup() - опции для списка групп режимов торгов.

    • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.
    • IsTraded(bool) - показывать торгуемые только торгующиеся в настоящий момент группы режимов торгов. Значение по умолчанию - false.
    • WithEngine(EngineName) - фильтрация по торговой системе.
  • Duration() - опции для списка доступных расчетных интервалов свечей в формате HLOCV.

    • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.
  • SecurityType() - опции для списка инструментов.

    • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.
    • WithEngine(EngineName) - фильтрация по торговой системе.
  • SecurityGroup() - опции для списка групп инструментов.

    • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.
    • WithEngine(EngineName) - фильтрация по торговой системе.
    • HideInactive(bool) - фильтрация по активности. Значение по умолчанию - false.
  • SecurityCollection() - опции для списка коллекций инструментов.

    • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.

Пример:

client := moexiss.NewClient(nil)
	
bld := moexiss.NewIndexReqOptionsBuilder()
bld.BoardGroup().Lang(moexiss.LangEn).WithEngine(moexiss.EngineStock).IsTraded(true)
bld.Engine().Lang(moexiss.LangEn)
options := bld.Build()
	
result, err := client.Index.List(context.Background(), options)
Получение итогов торгов

Получить агрегированные итоги торгов за дату по рынкам:

client := moexiss.NewClient(nil)
ticker := "sberp"
result, err := client.Aggregates.GetAggregates(context.Background(), ticker, nil)

Опции запроса(не являются обязательными):

  • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.
  • Date(time.Date) - дата за которую необходимо отобразить данные. По умолчанию за последнюю дату в итогах торгов.

Пример:

client := moexiss.NewClient(nil)
ticker := "sberp"
opt := moexiss.NewAggregateReqOptionsBuilder().
Lang(moexiss.LangEn).
Date(time.Date(2021/*год*/, 2/*месяц*/, 24/*день*/, 12, 0, 0, 0, time.UTC)).
Build()
result, err := client.Aggregates.GetAggregates(context.Background(), ticker, opt)
Получение списка индексов по бумаге

Получить список индексов в которые входит бумага:

client := moexiss.NewClient(nil)
ticker := "sberp"
result, err := client.Indices.GetIndices(context.Background(), ticker, nil)

Опции запроса(не являются обязательными):

  • Lang(Language) - язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию - moexiss.LangRu.

Пример:

client := moexiss.NewClient(nil)
ticker := "sberp"
opt := moexiss.NewIndicesReqOptionsBuilder().
Lang(moexiss.LangEn).
Build()
result, err := client.Indices.GetIndices(context.Background(), ticker, opt)
Получение сводных оборотов по рынкам

Получить сводные обороты по рынкам:

client := moexiss.NewClient(nil)
turnovers, err := client.Turnovers.GetTurnovers(context.Background(), nil)

Опции запроса(не являются обязательными):

  • Lang(Language) — язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию — moexiss.LangRu.
  • Date(time.Date) — дата за которую необходимо отобразить данные. По умолчанию — сегодня.
  • IsTonightSession(bool) — показывать обороты за вечернюю сессию. Значение по умолчанию — false.

Пример:

client := moexiss.NewClient(nil)
options := moexiss.NewTurnoverReqOptionsBuilder().
Lang(moexiss.LangEn).
Date(time.Date(2021/*год*/, 2/*месяц*/, 24/*день*/, 12, 0, 0, 0, time.UTC)).
IsTonightSession(true).
Build()
result, err := client.Turnovers.GetTurnovers(context.Background(), options)
Получение данных по листингу бумаг
  • Список неторгуемых/торгуемых инструментов с указанием интервалов торгуемости по режимам:
client := moexiss.NewClient(nil)
engine := moexiss.EngineStock
market := "shares"
result, err := client.HistoryListing.
	GetListing(context.Background(), engine, market, nil)
  • Получить данные по листингу бумаг в историческом разрезе по указанному режиму:
client := moexiss.NewClient(nil)
engine := moexiss.EngineStock
market := "shares"
board := "TQTD"
result, err := client.HistoryListing.
   GetListingByBoard(context.Background(), engine, market, board, nil)
  • Получить данные по листингу бумаг в историческом разрезе по указанной группе режимов:
client := moexiss.NewClient(nil)
engine := moexiss.EngineStock
market := "shares"
boardGroupId := "6"
result, err := client.HistoryListing.
	GetListingByBoardGroup(context.Background(), engine, market, boardGroupId, nil)

Опции запроса(не являются обязательными):

  • Lang(Language) — язык результата. Возможные значения moexiss.LangEn, moexiss.LangRu. Значение по умолчанию — moexiss.LangRu.
  • Status(HistoryListingTradingStatus) — фильтр торгуемости инструментов: moexiss.ListingTradingStatusTraded, moexiss.ListingTradingStatusNotTraded или moexiss.ListingTradingStatusAll. По умолчанию — moexiss.ListingTradingStatusAll.
  • Start(int) — номер строки (отсчет с нуля), с которой следует начать порцию возвращаемых данных. Значение по умолчанию — 0. Получение ответа без данных означает, что указанное значение превышает число строк, возвращаемых запросом.

Пример:

client := moexiss.NewClient(nil)
engine := moexiss.EngineStock
market := "shares"
boardGroupId := "6"
opt := moexiss.NewHistoryListingReqOptionsBuilder().
    Status(moexiss.ListingTradingStatusNotTraded).
    Start(42).
    Lang(moexiss.LangEn).
    Build()
result, err := client.HistoryListing.
    GetListingByBoardGroup(context.Background(), engine, market, boardGroupId, opt)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNonNilContext          = errors.New("context must be non-nil")
	ErrUnexpectedDataType     = errors.New("unexpected data type")
	ErrNilPointer             = errors.New("nil pointer error")
	ErrBadSecurityParameter   = errors.New("bad 'security' parameter")
	ErrBadEngineParameter     = errors.New("bad 'engine' parameter")
	ErrBadMarketParameter     = errors.New("bad 'market' parameter")
	ErrBadBoardParameter      = errors.New("bad 'board' parameter")
	ErrBadBoardGroupParameter = errors.New("bad 'boardgroup' parameter")
	ErrEmptyServerResult      = errors.New("the empty answer")
)

A section of general errors

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range

Types

type Aggregate

type Aggregate struct {
	MarketName   string  // "market_name"
	MarketTitle  string  // "market_title"
	Engine       string  // "engine"
	TradeDate    string  // "tradedate"
	SecurityId   string  // "secid"
	Value        float64 // "value"
	Volume       int64   // "volume"
	NumberTrades int64   // "numtrades"
	UpdatedAt    string  // "updated_at"
}

Aggregate struct represents aggregated trading results for the date by the security by markets

type AggregateReqOptionsBuilder

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

AggregateReqOptionsBuilder represents a builder of AggregateRequestOptions struct

func NewAggregateReqOptionsBuilder

func NewAggregateReqOptionsBuilder() *AggregateReqOptionsBuilder

NewAggregateReqOptionsBuilder is a constructor of AggregateReqOptionsBuilder

func (*AggregateReqOptionsBuilder) Build

Build builds AggregateRequestOptions from AggregateReqOptionsBuilder

func (*AggregateReqOptionsBuilder) Date

Date sets 'date' parameter to a request 'date' is the date for which you want to display the data. By default(if none), for the last date in the trading results.

func (*AggregateReqOptionsBuilder) Lang

Lang sets 'lang' parameter to a request

type AggregateRequestOptions

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

AggregateRequestOptions contains options which can be used as arguments for building requests to get aggregated trading results for the date by market. MoEx ISS API docs: https://iss.moex.com/iss/reference/214

type AggregateService

type AggregateService service

AggregateService gets aggregated trading results in the MoEx ISS API.

MoEx ISS API docs: https://iss.moex.com/iss/reference/214

func (*AggregateService) GetAggregates

func (a *AggregateService) GetAggregates(ctx context.Context, security string, opt *AggregateRequestOptions) (*AggregatesResponse, error)

GetAggregates provides GetAggregates of MoEx ISS

type AggregatesResponse

type AggregatesResponse struct {
	SecurityId string
	Aggregates []Aggregate
	DatesFrom  string //
	DatesTill  string
}

AggregatesResponse struct represents a response with aggregated trading results

type Board

type Board struct {
	Id           int64
	BoardGroupId int64
	EngineId     int64
	MarketId     int64
	BoardId      string
	BoardTitle   string
	IsTraded     bool
	HasCandles   bool
	IsPrimary    bool
}

Board represent a description of the board and its attributes

type BoardGroup

type BoardGroup struct {
	Engine     Engine
	MarketId   int64
	MarketName string
	GeneralFields
	IsDefault bool
	IsTraded  bool
}

BoardGroup represent a description of the board group and its attributes

type Client

type Client struct {

	// Base URL for API requests.
	BaseURL *url.URL

	// User agent used when communicating with the MoEx Iss API.
	UserAgent string

	Securities     *SecuritiesService
	Index          *IndexService
	Turnovers      *TurnoverService
	Aggregates     *AggregateService
	Indices        *IndicesService
	HistoryListing *HistoryListingService
	Stats          *StatsService
	// contains filtered or unexported fields
}

Client structure represents a client of MoEx ISS API

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient creates an instance of Client

func (*Client) BareDo

func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, error)

BareDo sends an API request and lets you handle the api response. If an error or API Error occurs, the error will contain more information. Otherwise you are supposed to read and close the response's Body.

The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If v is nil, and no error happens, the response is returned as is.

The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

type Duration

type Duration struct {
	Interval int64
	Duration int64
	Title    string
	Hint     string
}

Duration represent a description of the duration and its attributes

type Engine

type Engine struct {
	GeneralFields
}

Engine represents a description of the trading system in directories named in MoEx ISS API as 'engine'

type EngineName

type EngineName string

EngineName represents the known Engine names of MoEx ISS API

const (
	EngineUndefined     EngineName = ""
	EngineStock         EngineName = "stock"
	EngineState         EngineName = "state"
	EngineCurrency      EngineName = "currency"
	EngineFutures       EngineName = "futures"
	EngineCommodity     EngineName = "commodity"
	EngineInterventions EngineName = "interventions"
	EngineOffBoard      EngineName = "offboard"
	EngineAgro          EngineName = "agro"
)

A section of EngineName values

func (EngineName) String

func (s EngineName) String() string

string representations of EngineName values

type GeneralFields

type GeneralFields struct {
	Id    int64
	Name  string
	Title string
}

GeneralFields it contains general fields of some other structures

type HistoryListingRequestOptions

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

HistoryListingRequestOptions contains options which can be used as arguments for building requests to get listing information. MoEx ISS API docs:

https://iss.moex.com/iss/reference/118 https://iss.moex.com/iss/reference/119 https://iss.moex.com/iss/reference/120

type HistoryListingRequestOptionsBuilder

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

HistoryListingRequestOptionsBuilder represents a builder of HistoryListingRequestOptions struct

func NewHistoryListingReqOptionsBuilder

func NewHistoryListingReqOptionsBuilder() *HistoryListingRequestOptionsBuilder

NewHistoryListingReqOptionsBuilder is a constructor of HistoryListingRequestOptionsBuilder

func (*HistoryListingRequestOptionsBuilder) Build

Build builds HistoryListingRequestOptions from HistoryListingRequestOptionsBuilder

func (*HistoryListingRequestOptionsBuilder) Lang

Lang sets 'lang' parameter to a request Language of the result set: 'ru' or 'en' 'ru' by default

func (*HistoryListingRequestOptionsBuilder) Start

Start sets 'start' parameter to a request Row number (the number of the first row is 0) to begin the result set with. If the result set contains no data then the specified number is greater than the total number of rows available. 0 by default

func (*HistoryListingRequestOptionsBuilder) Status

Status sets 'status' parameter to a request Trading status filter: ListingTradingStatusAll, ListingTradingStatusNotTraded or ListingTradingStatusTraded ListingTradingStatusAll status by default

type HistoryListingService

type HistoryListingService service

HistoryListingService gets a list of tradable/non-tradable securities with indication of tradability intervals by modes from the MoEx ISS API.

MoEx ISS API docs: https://iss.moex.com/iss/reference/118 https://iss.moex.com/iss/reference/119 https://iss.moex.com/iss/reference/120

func (*HistoryListingService) GetListing

GetListing provides a list of tradable/non-tradable securities

func (*HistoryListingService) GetListingByBoard

func (hl *HistoryListingService) GetListingByBoard(ctx context.Context, engine EngineName, market string, boardId string, opt *HistoryListingRequestOptions) (*ListingResponse, error)

GetListingByBoard provides security listing information for a given board

func (*HistoryListingService) GetListingByBoardGroup

func (hl *HistoryListingService) GetListingByBoardGroup(ctx context.Context, engine EngineName, market string, boardGroupId string, opt *HistoryListingRequestOptions) (*ListingResponse, error)

GetListingByBoardGroup provides security listing information for a given boardgroup

type HistoryListingTradingStatus

type HistoryListingTradingStatus string

HistoryListingTradingStatus represents a type of trading status for listing of MoEx ISS API

const (
	ListingTradingStatusUndefined HistoryListingTradingStatus = ""
	ListingTradingStatusAll       HistoryListingTradingStatus = "all"
	ListingTradingStatusNotTraded HistoryListingTradingStatus = "nottraded"
	ListingTradingStatusTraded    HistoryListingTradingStatus = "traded"
)

A section of HistoryListingTradingStatus values

func (HistoryListingTradingStatus) String

func (hlt HistoryListingTradingStatus) String() string

String representations of HistoryListingTradingStatus values

type Index

type Index struct {
	Engines             []Engine
	Markets             []Market
	Boards              []Board
	BoardGroups         []BoardGroup
	Durations           []Duration
	SecurityTypes       []SecurityType
	SecurityGroups      []SecurityGroup
	SecurityCollections []SecurityCollection
}

Index represents a result of the request of the index

type IndexReqOptionsBoardBuilder

type IndexReqOptionsBoardBuilder struct {
	IndexReqOptionsBuilder
}

IndexReqOptionsBoardBuilder facet of IndexReqOptionsBuilder

func (*IndexReqOptionsBoardBuilder) Lang

Lang sets 'boardsLang' parameter to a request of directories of Board

type IndexReqOptionsBoardGroupBuilder

type IndexReqOptionsBoardGroupBuilder struct {
	IndexReqOptionsBuilder
}

IndexReqOptionsBoardGroupBuilder facet of IndexReqOptionsBuilder

func (*IndexReqOptionsBoardGroupBuilder) IsTraded

IsTraded sets 'boardGroupsIsTraded' parameter to a request of directories of BoardGroup

func (*IndexReqOptionsBoardGroupBuilder) Lang

Lang sets 'boardGroupsLang' parameter to a request of directories of BoardGroup

func (*IndexReqOptionsBoardGroupBuilder) WithEngine

WithEngine sets 'boardGroupsEngine' parameter to a request of directories of BoardGroup

type IndexReqOptionsBuilder

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

IndexReqOptionsBuilder represents a builder of IndexRequestOptions struct

func NewIndexReqOptionsBuilder

func NewIndexReqOptionsBuilder() *IndexReqOptionsBuilder

NewIndexReqOptionsBuilder is a constructor for IndexReqOptionsBuilder

func (*IndexReqOptionsBuilder) Board

Board chains to type *IndexReqOptionsBuilder and returns *IndexReqOptionsBoardBuilder

func (*IndexReqOptionsBuilder) BoardGroup

BoardGroup chains to type *IndexReqOptionsBuilder and returns *IndexReqOptionsBoardGroupBuilder

func (*IndexReqOptionsBuilder) Build

Build builds IndexRequestOptions from IndexReqOptionsBuilder

func (*IndexReqOptionsBuilder) Duration

Duration chains to type *IndexReqOptionsBuilder and returns *IndexReqOptionsDurationBuilder

func (*IndexReqOptionsBuilder) Engine

Engine chains to type *IndexReqOptionsBuilder and returns *IndexReqOptionsEngineBuilder

func (*IndexReqOptionsBuilder) Market

Market chains to type *IndexReqOptionsBuilder and returns *IndexReqOptionsMarketBuilder

func (*IndexReqOptionsBuilder) SecurityCollection

SecurityCollection chains to type *IndexReqOptionsBuilder and returns *IndexReqOptionsSecurityCollectionBuilder

func (*IndexReqOptionsBuilder) SecurityGroup

SecurityGroup chains to type *IndexReqOptionsBuilder and returns *IndexReqOptionsSecurityGroupBuilder

func (*IndexReqOptionsBuilder) SecurityType

SecurityType chains to type *IndexReqOptionsBuilder and returns *IndexReqOptionsSecurityTypeBuilder

type IndexReqOptionsDurationBuilder

type IndexReqOptionsDurationBuilder struct {
	IndexReqOptionsBuilder
}

IndexReqOptionsDurationBuilder facet of IndexReqOptionsBuilder

func (*IndexReqOptionsDurationBuilder) Lang

Lang sets 'durationsLang' parameter to a request of directories of Duration and returns *IndexReqOptionsDurationBuilder

type IndexReqOptionsEngineBuilder

type IndexReqOptionsEngineBuilder struct {
	IndexReqOptionsBuilder
}

IndexReqOptionsEngineBuilder facet of IndexReqOptionsBuilder

func (*IndexReqOptionsEngineBuilder) Lang

Lang sets 'enginesLang' parameter to a request of directories of Engine

type IndexReqOptionsMarketBuilder

type IndexReqOptionsMarketBuilder struct {
	IndexReqOptionsBuilder
}

IndexReqOptionsMarketBuilder facet of IndexReqOptionsBuilder

func (*IndexReqOptionsMarketBuilder) Lang

Lang sets 'marketsLang' parameter to a request of directories of Market

type IndexReqOptionsSecurityCollectionBuilder

type IndexReqOptionsSecurityCollectionBuilder struct {
	IndexReqOptionsBuilder
}

IndexReqOptionsSecurityCollectionBuilder facet of IndexReqOptionsBuilder

func (*IndexReqOptionsSecurityCollectionBuilder) Lang

Lang sets 'securityCollectionsLang' parameter to a request of directories of SecurityCollection

type IndexReqOptionsSecurityGroupBuilder

type IndexReqOptionsSecurityGroupBuilder struct {
	IndexReqOptionsBuilder
}

IndexReqOptionsSecurityGroupBuilder facet of IndexReqOptionsBuilder

func (*IndexReqOptionsSecurityGroupBuilder) HideInactive

HideInactive sets 'securityGroupsHideInactive' parameter to a request of directories of SecurityGroup

func (*IndexReqOptionsSecurityGroupBuilder) Lang

Lang sets 'securityGroupsLang' parameter to a request of directories of SecurityGroup

func (*IndexReqOptionsSecurityGroupBuilder) WithEngine

WithEngine sets 'securityGroupsEngine' parameter to a request of directories of SecurityGroup

type IndexReqOptionsSecurityTypeBuilder

type IndexReqOptionsSecurityTypeBuilder struct {
	IndexReqOptionsBuilder
}

IndexReqOptionsSecurityTypeBuilder facet of IndexReqOptionsBuilder

func (*IndexReqOptionsSecurityTypeBuilder) Lang

Lang sets 'securityTypesLang' parameter to a request of directories of SecurityType

func (*IndexReqOptionsSecurityTypeBuilder) WithEngine

WithEngine sets 'securityTypesEngine' parameter to a request of directories of SecurityType

type IndexRequestOptions

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

IndexRequestOptions contains options which can be used as arguments for building requests of 'Index' MoEx ISS API docs: https://iss.moex.com/iss/reference/28

type IndexService

type IndexService service

IndexService provides access to the index related functions in the MoEx ISS API.

MoEx ISS API docs: https://iss.moex.com/iss/reference/28

func (*IndexService) List

func (s *IndexService) List(ctx context.Context, opt *IndexRequestOptions) (*Index, error)

List provides a list of references of MoEx ISS

type Indices

type Indices struct {
	IndexId   string // "SECID"
	IndexName string // "SHORTNAME"
	From      string // "FROM"
	Till      string // "TILL"
}

Indices struct represents a list of the indices that include the security

type IndicesRequestOptions

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

IndicesRequestOptions contains options which can be used as arguments for building requests to get a list of indices that include the security. MoEx ISS API docs: https://iss.moex.com/iss/reference/160

type IndicesRequestOptionsBuilder

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

IndicesRequestOptionsBuilder represents a builder of IndicesRequestOptions struct

func NewIndicesReqOptionsBuilder

func NewIndicesReqOptionsBuilder() *IndicesRequestOptionsBuilder

NewIndicesReqOptionsBuilder is a constructor of IndicesRequestOptionsBuilder

func (*IndicesRequestOptionsBuilder) Build

Build builds IndicesRequestOptions from IndicesRequestOptionsBuilder

func (*IndicesRequestOptionsBuilder) Lang

Lang sets 'lang' parameter to a request

type IndicesResponse

type IndicesResponse struct {
	SecurityId string
	Indices    []Indices
}

IndicesResponse struct represents a response with the list of the indices

type IndicesService

type IndicesService service

IndicesService gets a list of the indices that include the security from the MoEx ISS API.

MoEx ISS API docs: https://iss.moex.com/iss/reference/160

func (*IndicesService) GetIndices

func (i *IndicesService) GetIndices(ctx context.Context, security string, opt *IndicesRequestOptions) (*IndicesResponse, error)

GetIndices provides a list of the indices that include the security of MoEx ISS

type Language

type Language string

Language represents a language of answers of MoEx ISS API

const (
	LangUndefined Language = ""
	LangEn        Language = "en"
	LangRu        Language = "ru"
)

Possible values of Language type

func (Language) String

func (s Language) String() string

string representations of Language values

type Listing

type Listing struct {
	Ticker    string // "SECID"
	ShortName string // "SHORTNAME"
	FullName  string // "NAME"
	BoardId   string // "BOARDID"
	Decimals  int64  // "decimals"
	From      string // "history_from"
	Till      string // "history_till"
}

Listing struct represents listing of the security

type ListingResponse

type ListingResponse struct {
	Engine       EngineName
	Market       string
	BoardGroupId string
	Listing      []Listing
}

ListingResponse struct represents a response with listing of the security

type Market

type Market struct {
	Engine Engine
	GeneralFields
	MarketPlace string
}

Market represents a description of the market and its attributes

type Response

type Response struct {
	*http.Response
}

Response represent a response of BareDo an Do functions

type SecStat

type SecStat struct {
	Ticker           string         // "SECID"
	BoardId          string         // "BOARDID"
	TrSession        TradingSession // "TRADINGSESSION"
	Time             string         // "TIME"
	PriceMinusPrevPr float64        // "PRICEMINUSPREVWAPRICE"
	VolToday         int64          // "VOLTODAY"
	ValToday         int64          // "VALTODAY"
	HighBid          float64        // "HIGHBID"
	LowOffer         float64        // "LOWOFFER"
	LastOffer        float64        // "LASTOFFER"
	LastBid          float64        // "LASTBID"
	Open             float64        // "OPEN"
	Low              float64        // "LOW"
	High             float64        // "HIGH"
	Last             float64        // "LAST"
	LClosePrice      float64        // "LCLOSEPRICE"
	NumTrades        int64          // "NUMTRADES"
	WaPrice          float64        // "WAPRICE"
	AdmittedQuote    float64        // "ADMITTEDQUOTE"
	MarketPrice      float64        // "MARKETPRICE2"
	LCurrentPrice    float64        // "LCURRENTPRICE"
	ClosingAucPrice  float64        // "CLOSINGAUCTIONPRICE"
}

SecStat struct represents intermediate day summary by the security by markets

type SecStatResponse

type SecStatResponse struct {
	Engine   EngineName
	Market   string
	SecStats []SecStat
}

SecStatResponse struct represents a response with intermediate day summary

type SecuritiesService

type SecuritiesService service

SecuritiesService provides access to the security related functions in the MoEx ISS API.

MoEx ISS API docs: https://iss.moex.com/iss/reference/5

func (*SecuritiesService) List

func (s *SecuritiesService) List(ctx context.Context) (*[]Security, error)

List allows to get a list of securities

type Security

type Security struct {
	Id                 int64  //"0"
	SecId              string //"1"
	ShortName          string //"2"
	RegNumber          string //"3"
	Name               string //"4"
	Isin               string //"5"
	IsTraded           bool   //"6"
	EmitentId          string //"7"
	EmitentTitle       string //"8"
	EmitentInn         string //"9"
	EmitentOkpo        string //"10"
	GosReg             string //"11"
	Type               string //"12"
	Group              string //"13"
	PrimaryBoardId     string //"14"
	MarketPriceBoardId string //"15"
}

Security represent a security

type SecurityCollection

type SecurityCollection struct {
	GeneralFields
	SecurityGroupId int64
}

SecurityCollection represent a description of the security collection and its attributes

type SecurityGroup

type SecurityGroup struct {
	GeneralFields
	IsHidden bool
}

SecurityGroup represent a description of the security group and its attributes

type SecurityType

type SecurityType struct {
	Engine Engine
	GeneralFields
	SecurityGroupName string
}

SecurityType represent a description of the security type and its attributes

type StatReqOptionsBuilder

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

StatReqOptionsBuilder represents a builder of StatRequestOptions struct

func NewStatReqOptionsBuilder

func NewStatReqOptionsBuilder() *StatReqOptionsBuilder

NewStatReqOptionsBuilder is a constructor of StatReqOptionsBuilder

func (*StatReqOptionsBuilder) AddBoard

func (b *StatReqOptionsBuilder) AddBoard(boardId string) *StatReqOptionsBuilder

AddBoard adds a board to a request Filter the output by trading mode. No more than 10 boards.

func (*StatReqOptionsBuilder) AddTicker

func (b *StatReqOptionsBuilder) AddTicker(ticker string) *StatReqOptionsBuilder

AddTicker adds a ticker to a request It allows to show data only for the required tickers. No more than 10 tickers.

func (*StatReqOptionsBuilder) Build

Build builds StatRequestOptions from StatReqOptionsBuilder

func (*StatReqOptionsBuilder) TypeTradingSession

func (b *StatReqOptionsBuilder) TypeTradingSession(ts TradingSession) *StatReqOptionsBuilder

TypeTradingSession sets a type of trading session parameter to a request It allows to show data only for the required session.

type StatRequestOptions

type StatRequestOptions struct {
	TradingSessionType TradingSession // `tradingsession` query parameter in url.URL
	TickerIds          []string       // `securities` query parameter in url.URL
	BoardId            []string       // `boardid` query parameter in url.URL
}

StatRequestOptions contains options which can be used as arguments for building requests to get intermediate day summary. MoEx ISS API docs: https://iss.moex.com/iss/reference/823

type StatsService

type StatsService service

StatsService gets intermediate day summary from the MoEx ISS API.

MoEx ISS API docs: https://iss.moex.com/iss/reference/823

func (*StatsService) GetSecStats

func (s *StatsService) GetSecStats(ctx context.Context, engine EngineName, market string, opt *StatRequestOptions) (*SecStatResponse, error)

GetSecStats provides an intermediate day summary

type TradingSession

type TradingSession uint8

TradingSession represents a type of trading sessions for intermediate day summary of MoEx ISS API

const (
	TradingSessionUndefined  TradingSession = 0
	TradingSessionMain       TradingSession = 1
	TradingSessionAdditional TradingSession = 2
	TradingSessionTotal      TradingSession = 3
)

These constants represent possible values of TradingSession

func (TradingSession) String

func (ts TradingSession) String() string

String representations of TradingSession values

type Turnover

type Turnover struct {
	Name        string  // "NAME" Market text identifier
	Id          int64   // "ID" Market ID
	ValToday    float64 // "VALTODAY" Value of Concluded Transactions, million RUB
	ValTodayUsd float64 // "VALTODAY_USD" Value of Concluded Transactions, million USD
	NumTrades   int64   // "NUMTRADES" Quantity of Trades per Day, units
	UpdateTime  string  // "UPDATETIME" Time of Last Updating
	Title       string  // "TITLE" Market title
}

Turnover struct represents market turnovers

type TurnoverReqOptionsBuilder

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

TurnoverReqOptionsBuilder represents a builder of TurnoverRequestOptions struct

func NewTurnoverReqOptionsBuilder

func NewTurnoverReqOptionsBuilder() *TurnoverReqOptionsBuilder

NewTurnoverReqOptionsBuilder is a constructor for TurnoverReqOptionsBuilder

func (*TurnoverReqOptionsBuilder) Build

Build builds TurnoverRequestOptions from TurnoverReqOptionsBuilder

func (*TurnoverReqOptionsBuilder) Date

Date sets 'date' parameter to a request of the current turnover

func (*TurnoverReqOptionsBuilder) IsTonightSession

func (b *TurnoverReqOptionsBuilder) IsTonightSession(isTonightSession bool) *TurnoverReqOptionsBuilder

IsTonightSession sets 'is_tonight_session' parameter to a request of the current turnover

func (*TurnoverReqOptionsBuilder) Lang

Lang sets 'lang' parameter to a request of the current turnover

type TurnoverRequestOptions

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

TurnoverRequestOptions contains options which can be used as arguments for building requests to get current turnover on all the markets. MoEx ISS API docs: https://iss.moex.com/iss/reference/24

type TurnoverService

type TurnoverService service

TurnoverService gets turnovers on all the markets in the MoEx ISS API.

MoEx ISS API docs: https://iss.moex.com/iss/reference/24

func (*TurnoverService) GetTurnovers

func (s *TurnoverService) GetTurnovers(ctx context.Context, opt *TurnoverRequestOptions) (*[]Turnover, error)

GetTurnovers provides a list of turnovers of markets of MoEx ISS

Jump to

Keyboard shortcuts

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