Documentation
¶
Overview ¶
Contains everything related to the public and private feeds More information available on https://api.test.nordnet.se/next/2/api-docs/docs/feeds
Index ¶
- type DepthArgs
- type Feed
- type FeedCmd
- type FeedMsg
- type GetState
- type IndicatorArgs
- type LoginArgs
- type NewsArgs
- type PriceArgs
- type PrivateFeed
- type PrivateMsg
- type PrivateOrder
- type PrivateTrade
- type PublicDepth
- type PublicFeed
- type PublicIndicator
- type PublicMsg
- type PublicNews
- type PublicPrice
- type PublicTrade
- type PublicTradingStatus
- type TradeArgs
- type TradingStatusArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Feed ¶
type Feed struct {
// contains filtered or unexported fields
}
Represents the feed connection
type FeedCmd ¶
type FeedCmd struct {
Cmd string `json:"cmd"`
Args interface{} `json:"args"`
}
Used when sending feed commands
type FeedMsg ¶
type FeedMsg struct {
Type string `json:"type"`
Data interface{} `json:"data"`
}
Used for receiving messages
type GetState ¶
type GetState struct {
DeletedOrders bool `json:"deleted_orders"`
Days int64 `json:"days,omitempty"`
}
Arguments for getting orders and trades when logging in
type IndicatorArgs ¶
Arguments for subscribing to indicator updates
type LoginArgs ¶
type LoginArgs struct {
SessionKey string `json:"session_key"`
GetState interface{} `json:"get_state,omitempty"`
}
Arguments for sending the login command
type PrivateFeed ¶
type PrivateFeed struct {
*Feed
}
func NewPrivateFeed ¶
func NewPrivateFeed(address string) (*PrivateFeed, error)
func (*PrivateFeed) Dispatch ¶
func (pf *PrivateFeed) Dispatch(ctx context.Context, msgChan chan *PrivateMsg, errChan chan error)
Starts reading from the connection and sends data through given channels
type PrivateMsg ¶
type PrivateMsg struct {
Type string `json:"t"`
Data interface{} `json:"d"`
}
Represents messages sent by the private feed
func (*PrivateMsg) UnmarshalJSON ¶
func (pm *PrivateMsg) UnmarshalJSON(b []byte) (err error)
Implements the Unmarshaler interface decodes the json into proper data types depending on the type field
type PublicDepth ¶
type PublicDepth struct {
I string `json:"i"`
M int64 `json:"m"`
TickTimestamp int64 `json:"tick_timestamp"`
Bid1 float64 `json:"bid1"`
BidVolume1 float64 `json:"bid_volume1"`
Ask1 float64 `json:"ask1"`
AskVolume1 float64 `json:"ask_volume1"`
Bid2 float64 `json:"bid2"`
BidVolume2 float64 `json:"bid_volume2"`
Ask2 float64 `json:"ask2"`
AskVolume2 float64 `json:"ask_volume2"`
Bid3 float64 `json:"bid3"`
BidVolume3 float64 `json:"bid_volume3"`
Ask3 float64 `json:"ask3"`
AskVolume3 float64 `json:"ask_volume3"`
Bid4 float64 `json:"bid4"`
BidVolume4 float64 `json:"bid_volume4"`
Ask4 float64 `json:"ask4"`
AskVolume4 float64 `json:"ask_volume4"`
Bid5 float64 `json:"bid5"`
BidVolume5 float64 `json:"bid_volume5"`
Ask5 float64 `json:"ask5"`
AskVolume5 float64 `json:"ask_volume5"`
}
Depth data section in the public message
type PublicFeed ¶
type PublicFeed struct {
*Feed
}
func NewPublicFeed ¶
func NewPublicFeed(address string) (*PublicFeed, error)
func (*PublicFeed) Dispatch ¶
func (pf *PublicFeed) Dispatch(ctx context.Context, msgChan chan *PublicMsg, errChan chan error)
func (*PublicFeed) Subscribe ¶
func (f *PublicFeed) Subscribe(args interface{}) error
Sends the Subscribe command with the given args
func (*PublicFeed) Unsubscribe ¶
func (f *PublicFeed) Unsubscribe(args interface{}) error
Sends the Unsubscribe command with the given args
type PublicIndicator ¶
type PublicIndicator struct {
I string `json:"i"`
M string `json:"m"`
TickTimestamp int64 `json:"tick_timestamp"`
High float64 `json:"high"`
Low float64 `json:"low"`
Last float64 `json:"last"`
Close float64 `json:"close"`
}
Indicator data section in the public message
type PublicMsg ¶
type PublicMsg FeedMsg
Represents the messages sent on the public feed
func (*PublicMsg) UnmarshalJSON ¶
Implements the Unmarshaler interface decodes the json into proper data types depending on the type field
type PublicNews ¶
type PublicNews struct {
ItemId string `json:"itemid"`
Lang string `json:"lang"`
Datetime string `json:"datetime"`
SourceId string `json:"sourceid"`
Headline string `json:"headline"`
Instruments []string `json:"instruments"`
}
News data section in the public message
type PublicPrice ¶
type PublicPrice struct {
I string `json:"i"`
M int64 `json:"m"`
TradeTimestamp int64 `json:"trade_timestamp"`
TickTimestamp int64 `json:"tick_timestamp"`
Bid float64 `json:"bid"`
BidVolume float64 `json:"bid_volume"`
Ask float64 `json:"ask"`
AskVolume float64 `json:"ask_volume"`
Close float64 `json:"close"`
High float64 `json:"high"`
Last float64 `json:"last"`
LastVolume float64 `json:"last_volume"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Turnover float64 `json:"turnover"`
TurnoverVolume float64 `json:"turnover_volume"`
EP float64 `json:"ep"`
Paired float64 `json:"paired"`
Imbalance float64 `json:"imbalance"`
}
Price data section in the public message
type PublicTrade ¶
type PublicTrade struct {
I string `json:"i"`
M int64 `json:"m"`
TradeTimestamp int64 `json:"trade_timestamp"`
Price float64 `json:"price"`
Volume float64 `json:"volume"`
BrokerBuying string `json:"broker_buying"`
BrokerSelling string `json:"broker_selling"`
TradeId string `json:"trade_id"`
TradeType string `json:"trade_type"`
}
Trade data section in the public message
type PublicTradingStatus ¶
type PublicTradingStatus struct {
I string `json:"i"`
M int64 `json:"m"`
TickTimestamp int64 `json:"tick_timestamp"`
Status string `json:"status"`
SourceStatus string `json:"source_status"`
Halted string `json:"halted"`
}
Trading Status data section in the public message
type TradingStatusArgs ¶
type TradingStatusArgs feedCmdArgs
Arguments for subscribing to trading status updates