Documentation ¶
Overview ¶
Package api includes the HTTP client used to access the REST JSON API.
Information about specific endpoints and their parameters can be found at: https://api.test.nordnet.se/api-docs/index.html
Index ¶
- Constants
- Variables
- type APIClient
- func (c *APIClient) Account(accountno int64) (res *AccountInfo, err error)
- func (c *APIClient) AccountLedgers(accountno int64) (res []LedgerInformation, err error)
- func (c *APIClient) AccountOrders(accountno int64, params *Params) (res []Order, err error)
- func (c *APIClient) AccountPositions(accountno int64) (res []Position, err error)
- func (c *APIClient) AccountTrades(accountno int64, params *Params) (res []Trade, err error)
- func (c *APIClient) Accounts() (res []Account, err error)
- func (c *APIClient) ActivateOrder(accountno int64, orderId int64) (res *OrderReply, err error)
- func (c *APIClient) Countries() (res []Country, err error)
- func (c *APIClient) CreateOrder(accountno int64, params *Params) (res *OrderReply, err error)
- func (c *APIClient) DeleteOrder(accountno int64, orderId int64) (res *OrderReply, err error)
- func (c *APIClient) Indicators() (res []Indicator, err error)
- func (c *APIClient) InstrumentLeverageFilters(id int64, params *Params) (res *LeverageFilter, err error)
- func (c *APIClient) InstrumentLeverages(id int64, params *Params) (res []Instrument, err error)
- func (c *APIClient) InstrumentLookup(lookupType string, lookup string) (res []Instrument, err error)
- func (c *APIClient) InstrumentOptionPairFilters(id int64, params *Params) (res *OptionPairFilter, err error)
- func (c *APIClient) InstrumentOptionPairs(id int64, params *Params) (res []OptionPair, err error)
- func (c *APIClient) InstrumentSector(sectors string) (res []Sector, err error)
- func (c *APIClient) InstrumentSectors(params *Params) (res []Sector, err error)
- func (c *APIClient) InstrumentType(instrumentType string) (res []InstrumentType, err error)
- func (c *APIClient) InstrumentTypes() (res []InstrumentType, err error)
- func (c *APIClient) InstrumentUnderlyings(derivateType string, currency string) (res []Instrument, err error)
- func (c *APIClient) Instruments(ids string) (res []Instrument, err error)
- func (c *APIClient) List(id int64) (res []Instrument, err error)
- func (c *APIClient) Lists() (res []List, err error)
- func (c *APIClient) Login() (res *Login, err error)
- func (c *APIClient) Logout() (res *LoggedInStatus, err error)
- func (c *APIClient) LookupCountries(countries string) (res []Country, err error)
- func (c *APIClient) LookupIndicators(indicators string) (res []Indicator, err error)
- func (c *APIClient) Market(ids string) (res []Market, err error)
- func (c *APIClient) Markets() (res []Market, err error)
- func (c *APIClient) News(ids string) (res []NewsItem, err error)
- func (c *APIClient) NewsSources() (res []NewsSource, err error)
- func (c *APIClient) Perform(method, path string, params *Params, res interface{}) (err error)
- func (c *APIClient) RealtimeAccess() (res []RealtimeAccess, err error)
- func (c *APIClient) SearchInstruments(params *Params) (res []Instrument, err error)
- func (c *APIClient) SearchNews(params *Params) (res []NewsPreview, err error)
- func (c *APIClient) SystemStatus() (res *SystemStatus, err error)
- func (c *APIClient) TickSize(ids string) (res []TicksizeTable, err error)
- func (c *APIClient) TickSizes() (res []TicksizeTable, err error)
- func (c *APIClient) Touch() (res *LoggedInStatus, err error)
- func (c *APIClient) TradableInfo(ids string) (res []TradableInfo, err error)
- func (c *APIClient) TradableIntraday(ids string) (res []IntradayGraph, err error)
- func (c *APIClient) TradableTrades(ids string) (res []PublicTrades, err error)
- func (c *APIClient) UpdateOrder(accountno int64, orderId int64, params *Params) (res *OrderReply, err error)
- type APIError
- type Params
Constants ¶
const ( NNBASEURL = `https://www.nordnet.se/next` NNSERVICE = `NEXTAPI` NNAPIVERSION = `2` )
Variables ¶
var (
TooManyRequestsError = errors.New("Too Many Requests, please wait for 10 seconds before trying again")
)
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
URL, Service, Version, Credentials, SessionKey string
ExpiresAt, LastUsageAt time.Time
http.Client
sync.RWMutex
}
APIClient provides all API-endpoints available as methods.
func NewAPIClient ¶
Constructor function takes the credentials string produced by the util package.
func (*APIClient) AccountLedgers ¶
Information about the currency ledgers of an account.
func (*APIClient) AccountOrders ¶
Get all orders beloning to an account.
func (*APIClient) AccountPositions ¶
Returns a list of all positions of the account.
func (*APIClient) AccountTrades ¶
Get all trades belonging to an account.
func (*APIClient) ActivateOrder ¶
Activate an inactive order. Please note that it is not possible to deactivate an order. The order must be entered as inactive.
func (*APIClient) Countries ¶
Get a list of all countries in the system. Please note that trading is not available everywhere.
func (*APIClient) CreateOrder ¶
Enter a new order, market_id + identifier is the identifier of the tradable.
func (*APIClient) DeleteOrder ¶
Delete an order.
func (*APIClient) Indicators ¶
Returns a list indicators that the user has access to.
func (*APIClient) InstrumentLeverageFilters ¶
func (c *APIClient) InstrumentLeverageFilters(id int64, params *Params) (res *LeverageFilter, err error)
Returns valid filter values. Can be used to fill comboboxes in clients to filter leverages results. The same filters can be applied on this request to exclude invalid filter combinations.
func (*APIClient) InstrumentLeverages ¶
Returns a list of leverage instruments that have the current instrument as underlying. Leverage instruments is for example warrants and ETF:s. To get all valid filters for the current underlying please use "Get leverages filters". The filters can be used to narrow the search. If "Get leverages filters" is used to fill comboboxes the same filters can be applied on the that call to hide filter cominations that are not valid. Multiple filters can be applied.
func (*APIClient) InstrumentLookup ¶
func (c *APIClient) InstrumentLookup(lookupType string, lookup string) (res []Instrument, err error)
Lookup specfic instrument with prededfined fields. Please note that this is not a search, only exact matches is returned.
func (*APIClient) InstrumentOptionPairFilters ¶
func (c *APIClient) InstrumentOptionPairFilters(id int64, params *Params) (res *OptionPairFilter, err error)
Returns valid filter values. Can be used to fill comboboxes in clients to filter options pair results. The same filters can be applied on this request to exclude invalid filter combinations.
func (*APIClient) InstrumentOptionPairs ¶
Returns a list of call/put option pairs. They are balanced on strike price. In order to find underlyings with options use "Get underlyings". To get available expiration dates use "Get option pair filters".
func (*APIClient) InstrumentSector ¶
Get one or more sectors
func (*APIClient) InstrumentSectors ¶
Get all instrument sectors or the ones matching the group crtieria
func (*APIClient) InstrumentType ¶
Get info of one orde more instrument type.
func (*APIClient) InstrumentTypes ¶
Get all instrument types. Please note that these types is used for both instrument_type and instrument_group_type.
func (*APIClient) InstrumentUnderlyings ¶
func (c *APIClient) InstrumentUnderlyings(derivateType string, currency string) (res []Instrument, err error)
Get instruments that are underlyings for a specific type of instruments. The query can return instrument that have option derivatives or leverage derivatives. Warrants are included in the leverage derivatives.
func (*APIClient) Instruments ¶
Get one or more instruments, the instrument id is used as key
func (*APIClient) Login ¶
Before any other of the services (except for the system info request) can be called the user must login. The username, password and phrase must be sent encrypted. TODO: move the params into function arguments since its only used here?
func (*APIClient) LookupCountries ¶
Lookup one or more countries by country code. Multiple countries can be queried at the same time by comma separating the country codes. TODO: Merge with Countries call above?
func (*APIClient) LookupIndicators ¶
Returns info of one or more indicators. TODO: Merge with Indicators call above?
func (*APIClient) Market ¶
Lookup one or more markets by market_id. Multiple market can be queried at the same time by comma separating the market_ids. Market 80 is the smart order market. Instruments that can be traded on 2 or more markets gets a tradable on the smart order market. Orders entered with the smart order tradable get smart order routed with the current Nordnet best execution policy.
func (*APIClient) Markets ¶
Get all tradable markets. Market 80 is the smart order market. Instruments that can be traded on 2 or more markets gets a tradable on the smart order market. Orders entered with the smart order tradable get smart order routed with the current Nordnet best execution policy.
func (*APIClient) News ¶
Show one or more news items. Search for news. If no search field is used the last news available to the user is returned.
func (*APIClient) NewsSources ¶
Returns a list of news sources the user has access to
func (*APIClient) RealtimeAccess ¶
Get realtime data access. This applies to the access on the feeds. If the market is missing the user don't have realtime access on that market.
func (*APIClient) SearchInstruments ¶
Free text search. A list of instruments is returned.
func (*APIClient) SearchNews ¶
Search for news. If no search field is used the last news available to the user is returned.
func (*APIClient) SystemStatus ¶
Information about the system status can be retrieved by this HTTP request. This is the only service that can be called without authentication.
func (*APIClient) Touch ¶
If the application needs to keep the session alive the session can be touched. Note the basic auth header field must be set as for all other calls. All calls to any REST service is touching the session. So touching the session manually is only needed if no other calls are done during the session timeout interval.
func (*APIClient) TradableInfo ¶
Get trading calender and allowed trading types for one or more tradable.
func (*APIClient) TradableIntraday ¶
Can be used for populating instrument price graphs for today. Resolution is one minute.
func (*APIClient) TradableTrades ¶
Get all public trades (all trades done on the marketplace) beloning to one ore more tradable.