Documentation
¶
Index ¶
- Constants
- Variables
- type Amortization
- type AmortizationListIterator
- type AmortizationListQuery
- type AmortizationType
- type Coupon
- type CouponListIterator
- type CouponListQuery
- type Date
- type DateTime
- type Engine
- type Market
- type MarketData
- type NullableDate
- type Offer
- type OfferListIterator
- type OfferListQuery
- type OfferType
- type Option
- type Property
- type PropertyID
- type PropertyType
- type Provider
- type Security
- type SecurityDescription
- func (desc SecurityDescription) CouponFrequency() (*float64, error)
- func (desc SecurityDescription) FaceUnit() (*string, error)
- func (desc SecurityDescription) InitialFaceValue() (*float64, error)
- func (desc SecurityDescription) IsForQualifiedInvestorsOnly() (bool, error)
- func (desc SecurityDescription) IsHighRisk() (bool, error)
- func (desc SecurityDescription) IssueDate() (*Date, error)
- func (desc SecurityDescription) ListingLevel() (*float64, error)
- func (desc SecurityDescription) MaturityDate() (*Date, error)
- type SecurityListIterator
- type SecurityListQuery
- type SecurityType
- type TradingStatus
Constants ¶
const DefaultURL = "https://iss.moex.com"
DefaultURL содержит корневой URL сервиса ISS по умолчанию
Variables ¶
var ( // EOF обозначает конец выгрузки EOF = errors.New("end of data") )
var ErrWrongPropertyType = errors.New("wrong property type")
Functions ¶
This section is empty.
Types ¶
type Amortization ¶
type Amortization struct { ISIN string `json:"isin"` Name string `json:"name"` IssueValue float64 `json:"issuevalue"` AmortDate NullableDate `json:"amortdate"` InitialFaceValue float64 `json:"initialfacevalue"` FaceValue float64 `json:"facevalue"` FaceUnit string `json:"faceunit"` Value float64 `json:"value"` ValuePercent float64 `json:"valueprc"` ValueRub float64 `json:"value_rub"` Type AmortizationType `json:"data_source"` }
Amortization описывает амортизацию/погашение облигации
type AmortizationListIterator ¶
type AmortizationListIterator interface { // Next загружает следующую страницу данных // Если данных больше нет, то возвращается ошибка EOF Next() ([]*Amortization, error) }
AmortizationListIterator определяет итератор для списка амортизаций
type AmortizationListQuery ¶
type AmortizationListQuery struct { // Дата, больше либо равно From *time.Time // Дата, меньше либо равно Till *time.Time // Статус торгуемой ценной бумаги TradingStatus TradingStatus // Сколько записей выводить Limit int // Сколько записей пропускать Start int }
AmortizationListQuery определяет параметры запроса списка амортизаций
type AmortizationType ¶
type AmortizationType string
AmortizationType описывает тип амортизации
const ( // AmortizationTypeA обозначает тип амортизации - собственно амортизацию AmortizationTypeA AmortizationType = "amortization" // AmortizationTypeM обозначает тип амортизации - погашение AmortizationTypeM AmortizationType = "maturity" )
type Coupon ¶
type Coupon struct { ISIN string `json:"isin"` Name string `json:"name"` IssueValue *float64 `json:"issuevalue"` CouponDate NullableDate `json:"coupondate"` RecordDate NullableDate `json:"recorddate"` StartDate NullableDate `json:"startdate"` InitialFaceValue *float64 `json:"initialfacevalue"` FaceValue *float64 `json:"facevalue"` FaceUnit string `json:"faceunit"` Value *float64 `json:"value"` ValuePercent *float64 `json:"valueprc"` ValueRub *float64 `json:"value_rub"` }
Coupon описывает купон облигации
type CouponListIterator ¶
type CouponListIterator interface { // Next загружает следующую страницу данных // Если данных больше нет, то возвращается ошибка EOF Next() ([]*Coupon, error) }
CouponListIterator определяет итератор для списка купонов
type CouponListQuery ¶
type CouponListQuery struct { // Дата, больше либо равно From *time.Time // Дата, меньше либо равно Till *time.Time // Статус торгуемой ценной бумаги TradingStatus TradingStatus // Сколько записей выводить Limit int // Сколько записей пропускать Start int }
CouponListQuery определяет параметры запроса списка купонов
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
Date представляет дату в JSON формате
func (*Date) UnmarshalJSON ¶
UnmarshalJSON выполняет десериализацию из JSON
type DateTime ¶
type DateTime struct {
// contains filtered or unexported fields
}
DateTime представляет дату и время в JSON формате
func (*DateTime) UnmarshalJSON ¶
UnmarshalJSON выполняет десериализацию из JSON
type MarketData ¶
type MarketData struct { SecurityID string BoardID string AccruedInterest *float64 FaceValue *float64 Currency *string Last *float64 LastChange *float64 ClosePrice *float64 LegalClosePrice *float64 Time *DateTime }
MarketData описывает итоги торгов по облигации
type NullableDate ¶
type NullableDate struct {
// contains filtered or unexported fields
}
NullableDate представляет дату в JSON формате, для которой допускается значение nil
func (NullableDate) Format ¶
func (d NullableDate) Format(layout string) string
Format возвращает строковое представление для значения
func (NullableDate) HasValue ¶
func (d NullableDate) HasValue() bool
HasValue возвращает true, если значение - не nil
func (NullableDate) String ¶
func (d NullableDate) String() string
String возвращает строковое представление для значения
func (*NullableDate) UnmarshalJSON ¶
func (d *NullableDate) UnmarshalJSON(data []byte) error
UnmarshalJSON выполняет десериализацию из JSON
type Offer ¶
type Offer struct { ISIN string `json:"isin"` Name string `json:"name"` IssueValue *float64 `json:"issuevalue"` OfferDate NullableDate `json:"offerdate"` StartOfferDate NullableDate `json:"offerdatestart"` EndOfferDate NullableDate `json:"offerdateend"` FaceValue *float64 `json:"facevalue"` FaceUnit string `json:"faceunit"` Price *float64 `json:"price"` Value *float64 `json:"value"` Agent *string `json:"agent"` Type *OfferType `json:"offertype"` }
Offer описывает оферту по облигации
type OfferListIterator ¶
type OfferListIterator interface { // Next загружает следующую страницу данных // Если данных больше нет, то возвращается ошибка EOF Next() ([]*Offer, error) }
OfferListIterator определяет итератор для списка оферт
type OfferListQuery ¶
type OfferListQuery struct { // Дата, больше либо равно From *time.Time // Дата, меньше либо равно Till *time.Time // Статус торгуемой ценной бумаги TradingStatus TradingStatus // Сколько записей выводить Limit int // Сколько записей пропускать Start int }
OfferListQuery определяет параметры запроса списка оферт
type OfferType ¶
type OfferType string
OfferType содержит тип оферты
const ( // GenericOffer - оферта GenericOffer OfferType = "Оферта" // CompletedGenericOffer - состоявшаяся оферта CompletedGenericOffer OfferType = "Оферта (состоялось)" // CanceledGenericOffer - отмененнная оферта CanceledGenericOffer OfferType = "Оферта (отменено)" // DefaultGenericOffer - дефолт оферты DefaultGenericOffer OfferType = "Оферта (дефолт)" // TechDefaultGenericOffer - технический дефолт оферты TechDefaultGenericOffer OfferType = "Оферта (технический дефолт)" // MaturityOffer - оферта-погашение MaturityOffer OfferType = "Оферта/Погашение" // CanceledMaturityOffer - отмененнная оферта-погашение CanceledMaturityOffer OfferType = "Оферта/Погашение(отменено)" )
type Option ¶
type Option func(p *provider) error
Option конфигурирует провайдера
func WithHTTPClient ¶
WithHTTPClient задает экземпляр http.Client для Provider По умолчанию используется http.DefaultClient
func WithLogger ¶
WithLogger задает логгер для Provider По умолчанию логирование отключено
func WithVerbose ¶
WithVerbose включает подробное логирование для Provider По умолчанию подробное логирование отключено
type Property ¶
type Property struct { Name PropertyID `json:"name"` Value string `json:"value"` Type PropertyType `json:"type"` }
Property содержит отдельный параметр ценной бумаги
type PropertyID ¶
type PropertyID string
PropertyID содержит тип параметра ценной бумаги
const ( IssueDateProperty PropertyID = "ISSUEDATE" MaturityDateProperty PropertyID = "MATDATE" InitialFaceValueProperty PropertyID = "INITIALFACEVALUE" FaceUnitProperty PropertyID = "FACEUNIT" ListingLevelProperty PropertyID = "LISTLEVEL" IsForQualifiedInvestorsOnlyProperty PropertyID = "ISQUALIFIEDINVESTORS" CouponFrequencyProperty PropertyID = "COUPONFREQUENCY" IsHighRiskProperty PropertyID = "HIGHRISK" )
type PropertyType ¶
type PropertyType string
PropertyType содержит тип значения параметра ценной бумаги
const ( StringPropertyType PropertyType = "string" DatePropertyType PropertyType = "date" NumberPropertyType PropertyType = "number" BooleanPropertyType PropertyType = "boolean" )
type Provider ¶
type Provider interface { // ListSecurities возвращает итератор на список ценных бумаг ListSecurities(ctx context.Context, query SecurityListQuery) SecurityListIterator // ListCoupons возвращает итератор на список купонов ListCoupons(ctx context.Context, query CouponListQuery) CouponListIterator // ListAmortizations возвращает итератор на список амортизаций ListAmortizations(ctx context.Context, query AmortizationListQuery) AmortizationListIterator // ListOffers возвращает итератор на список оферт ListOffers(ctx context.Context, query OfferListQuery) OfferListIterator // GetMarketData возвращает текущие рыночные данные GetMarketData(ctx context.Context) ([]*MarketData, error) // GetSecurityDescription возвращает описание ценной бумаги GetSecurityDescription(ctx context.Context, isin string) (*SecurityDescription, error) }
Provider является точкой входа в адаптер для ISS
func NewProvider ¶
NewProvider создает новый экземпляр интерфейса Provider
type Security ¶
type Security struct { ID int `json:"id"` SecurityID string `json:"secid"` ShortName string `json:"shortname"` RegNumber string `json:"regnumber"` Name string `json:"name"` ISIN string `json:"isin"` IsTraded TradingStatus `json:"is_traded"` IssuerId int `json:"emitent_id"` IssuerName string `json:"emitent_title"` IssuerINN *string `json:"emitent_inn"` IssuerOKPO *string `json:"emitent_okpo"` Type SecurityType `json:"type"` PrimaryBoardID string `json:"primary_boardid"` MarketPriceBoardID string `json:"marketprice_boardid"` }
Security описывает ценную бумагу
type SecurityDescription ¶
type SecurityDescription struct {
Properties map[PropertyID]*Property
}
SecurityDescription содержит набор параметров ценной бумаги
func (SecurityDescription) CouponFrequency ¶
func (desc SecurityDescription) CouponFrequency() (*float64, error)
CouponFrequency возвращает значение параметра CouponFrequencyProperty
func (SecurityDescription) FaceUnit ¶
func (desc SecurityDescription) FaceUnit() (*string, error)
FaceUnit возвращает значение параметра FaceUnitProperty
func (SecurityDescription) InitialFaceValue ¶
func (desc SecurityDescription) InitialFaceValue() (*float64, error)
InitialFaceValue возвращает значение параметра InitialFaceValueProperty
func (SecurityDescription) IsForQualifiedInvestorsOnly ¶
func (desc SecurityDescription) IsForQualifiedInvestorsOnly() (bool, error)
IsForQualifiedInvestorsOnly возвращает значение параметра IsForQualifiedInvestorsOnlyProperty
func (SecurityDescription) IsHighRisk ¶
func (desc SecurityDescription) IsHighRisk() (bool, error)
IsHighRisk возвращает значение параметра IsHighRiskProperty
func (SecurityDescription) IssueDate ¶
func (desc SecurityDescription) IssueDate() (*Date, error)
IssueDate возвращает значение параметра IssueDateProperty
func (SecurityDescription) ListingLevel ¶
func (desc SecurityDescription) ListingLevel() (*float64, error)
ListingLevel возвращает значение параметра ListingLevelProperty
func (SecurityDescription) MaturityDate ¶
func (desc SecurityDescription) MaturityDate() (*Date, error)
MaturityDate возвращает значение параметра MaturityDateProperty
type SecurityListIterator ¶
type SecurityListIterator interface { // Next загружает следующую страницу данных // Если данных больше нет, то возвращается ошибка EOF Next() ([]*Security, error) }
SecurityListIterator определяет итератор для списка ценных бумаг
type SecurityListQuery ¶
type SecurityListQuery struct { // Биржа Engine Engine // Рынок Market Market // Статус торгуемой ценной бумаги TradingStatus *TradingStatus // Сколько записей выводить Limit int // Сколько записей пропускать Start int }
SecurityListQuery определяет параметры запроса списка ценных бумаг
type SecurityType ¶
type SecurityType string
SecurityType содержит тип ценной бумаги
const ( // SubfederalBond - субфедеральные облигации SubfederalBond SecurityType = "subfederal_bond" // OFZBond - ОФЗ OFZBond SecurityType = "ofz_bond" // ExchangeBond - биржевые облигации ExchangeBond SecurityType = "exchange_bond" // CBBond - облигации ЦБ CBBond SecurityType = "cb_bond" // MunicipalBond - мунициальные облигации MunicipalBond SecurityType = "municipal_bond" // CorporateBond - корпоративные облигации CorporateBond SecurityType = "corporate_bond" // IFIBond - облигации ИФИ IFIBond SecurityType = "ifi_bond" // EuroBond - еврооблигации EuroBond SecurityType = "euro_bond" )
type TradingStatus ¶
type TradingStatus int
TradingStatus содержит статус торгуемой ценной бумаги
const ( // IsTraded обозначает торгуемые ценные бумаги IsTraded TradingStatus = 1 // IsNotTraded обозначает неторгуемые ценные бумаги IsNotTraded TradingStatus = 0 )