feed

package
v0.0.0-...-0ea1e00 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 4 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DepthArgs

type DepthArgs feedCmdArgs

Arguments for subscribing to depth updates

type Feed

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

Represents the feed connection

func (*Feed) Close

func (f *Feed) Close() error

Feed implements the Closer interface closes the underlying conneciton

func (*Feed) Login

func (f *Feed) Login(session string, getState interface{}) error

Send the login command with the specified session key

func (*Feed) Write

func (f *Feed) Write(any interface{}) error

Feed implements the Writer interface

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

type IndicatorArgs struct {
	T string `json:"t"`
	I string `json:"i"`
	M string `json:"m"`
}

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 NewsArgs

type NewsArgs struct {
	T     string `json:"t"`
	S     int64  `json:"s"`
	Delay bool   `json:"delay,omitempty"`
}

Arguments for subscribing to news updates

type PriceArgs

type PriceArgs feedCmdArgs

Arguments for subscribing to price updates

type PrivateFeed

type PrivateFeed struct {
	*Feed
}

func NewPrivateFeed

func NewPrivateFeed(address string) (*PrivateFeed, error)

func (*PrivateFeed) Dispatch

func (pf *PrivateFeed) Dispatch(msgChan chan *PrivateMsg, errChan chan error)

Starts reading from the connection and sends data through given channels

type PrivateMsg

type PrivateMsg FeedMsg

Represents the messages sent on 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 PrivateOrder

type PrivateOrder models.Order

Order data section in the private message

type PrivateTrade

type PrivateTrade models.Trade

Trade data section in the private message

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(msgChan chan *PublicMsg, errChan chan error)

Starts reading from the connection and sends data through given channels

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

func (pm *PublicMsg) UnmarshalJSON(b []byte) (err error)

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 TradeArgs

type TradeArgs feedCmdArgs

Arguments for subscribing to trade updates

type TradingStatusArgs

type TradingStatusArgs feedCmdArgs

Arguments for subscribing to trading status updates

Jump to

Keyboard shortcuts

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