func (c *APIClient) SearchNews(params *Params) (res []NewsPreview, err error) {
	res = []NewsPreview{}
	err = c.Perform("GET", "news", params, &res)
	return
}
Search for news. If no search field is used the last news available to the user is returned.
package api
import (
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"sync"
	"time"
	. "github.com/denro/nordnet/util/models"
)
const (
	NNBASEURL     = `https: 
	NNTESTBASEURL = `https: 
	NNSERVICE     = `NEXTAPI`
	NNAPIVERSION  = `2`
)
var (
	TooManyRequestsError = errors.New("Too Many Requests, please wait for 10 seconds before trying again")
)
type APIError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}
func (e APIError) Error() string {
	return fmt.Sprintf("%v: %v", e.Code, e.Message)
}
type Params map[string]string
type APIClient struct {
	URL, Service, Version, Credentials, SessionKey string
	ExpiresAt, LastUsageAt                         time.Time
	http.Client
	sync.RWMutex
}
func NewAPIClient(credentials string) *APIClient {
	return &APIClient{
		URL:         NNBASEURL,
		Service:     NNSERVICE,
		Version:     NNAPIVERSION,
		Credentials: credentials,
	}
}
func NewAPITestClient(credentials string) *APIClient {
	return &APIClient{
		URL:         NNTESTBASEURL,
		Service:     NNSERVICE,
		Version:     NNAPIVERSION,
		Credentials: credentials,
	}
}
func (c *APIClient) SystemStatus() (res *SystemStatus, err error) {
	res = &SystemStatus{}
	err = c.Perform("GET", "", nil, res)
	return
}
func (c *APIClient) Accounts() (res []Account, err error) {
	res = []Account{}
	err = c.Perform("GET", "accounts", nil, &res)
	return
}
func (c *APIClient) Account(accountno int64) (res *AccountInfo, err error) {
	res = &AccountInfo{}
	err = c.Perform("GET", fmt.Sprintf("accounts/%d", accountno), nil, res)
	return
}
func (c *APIClient) AccountLedgers(accountno int64) (res []LedgerInformation, err error) {
	res = []LedgerInformation{}
	err = c.Perform("GET", fmt.Sprintf("accounts/%d/ledgers", accountno), nil, &res)
	return
}
func (c *APIClient) AccountOrders(accountno int64, params *Params) (res []Order, err error) {
	res = []Order{}
	err = c.Perform("GET", fmt.Sprintf("accounts/%d/orders", accountno), params, &res)
	return
}
func (c *APIClient) CreateOrder(accountno int64, params *Params) (res *OrderReply, err error) {
	res = &OrderReply{}
	err = c.Perform("POST", fmt.Sprintf("accounts/%d/orders", accountno), params, res)
	return
}
func (c *APIClient) ActivateOrder(accountno int64, orderId int64) (res *OrderReply, err error) {
	res = &OrderReply{}
	err = c.Perform("PUT", fmt.Sprintf("accounts/%d/orders/%d/activate", accountno, orderId), nil, res)
	return
}
func (c *APIClient) UpdateOrder(accountno int64, orderId int64, params *Params) (res *OrderReply, err error) {
	res = &OrderReply{}
	err = c.Perform("PUT", fmt.Sprintf("accounts/%d/orders/%d", accountno, orderId), params, res)
	return
}
func (c *APIClient) DeleteOrder(accountno int64, orderId int64) (res *OrderReply, err error) {
	res = &OrderReply{}
	err = c.Perform("DELETE", fmt.Sprintf("accounts/%d/orders/%d", accountno, orderId), nil, res)
	return
}
func (c *APIClient) AccountPositions(accountno int64) (res []Position, err error) {
	res = []Position{}
	err = c.Perform("GET", fmt.Sprintf("accounts/%d/positions", accountno), nil, &res)
	return
}
func (c *APIClient) AccountTrades(accountno int64, params *Params) (res []Trade, err error) {
	res = []Trade{}
	err = c.Perform("GET", fmt.Sprintf("accounts/%d/trades", accountno), params, &res)
	return
}
func (c *APIClient) Countries() (res []Country, err error) {
	res = []Country{}
	c.Perform("GET", "countries", nil, &res)
	return
}
func (c *APIClient) LookupCountries(countries string) (res []Country, err error) {
	res = []Country{}
	err = c.Perform("GET", fmt.Sprintf("countries/%s", countries), nil, &res)
	return
}
func (c *APIClient) Indicators() (res []Indicator, err error) {
	res = []Indicator{}
	err = c.Perform("GET", "indicators", nil, &res)
	return
}
func (c *APIClient) LookupIndicators(indicators string) (res []Indicator, err error) {
	res = []Indicator{}
	err = c.Perform("GET", fmt.Sprintf("indicators/%s", indicators), nil, &res)
	return
}
func (c *APIClient) SearchInstruments(params *Params) (res []Instrument, err error) {
	res = []Instrument{}
	err = c.Perform("GET", "instruments", params, &res)
	return
}
func (c *APIClient) Instruments(ids string) (res []Instrument, err error) {
	res = []Instrument{}
	err = c.Perform("GET", fmt.Sprintf("instruments/%s", ids), nil, &res)
	return
}
func (c *APIClient) InstrumentLeverages(id int64, params *Params) (res []Instrument, err error) {
	res = []Instrument{}
	err = c.Perform("GET", fmt.Sprintf("instruments/%d/leverages", id), params, &res)
	return
}
func (c *APIClient) InstrumentLeverageFilters(id int64, params *Params) (res *LeverageFilter, err error) {
	res = &LeverageFilter{}
	err = c.Perform("GET", fmt.Sprintf("instruments/%d/leverages/filters", id), params, res)
	return
}
func (c *APIClient) InstrumentOptionPairs(id int64, params *Params) (res []OptionPair, err error) {
	res = []OptionPair{}
	err = c.Perform("GET", fmt.Sprintf("instruments/%d/option_pairs", id), params, &res)
	return
}
func (c *APIClient) InstrumentOptionPairFilters(id int64, params *Params) (res *OptionPairFilter, err error) {
	res = &OptionPairFilter{}
	err = c.Perform("GET", fmt.Sprintf("instruments/%d/option_pairs/filters", id), params, res)
	return
}
func (c *APIClient) InstrumentLookup(lookupType string, lookup string) (res []Instrument, err error) {
	res = []Instrument{}
	err = c.Perform("GET", fmt.Sprintf("instruments/lookup/%s/%s", lookupType, lookup), nil, &res)
	return
}
func (c *APIClient) InstrumentSectors(params *Params) (res []Sector, err error) {
	res = []Sector{}
	err = c.Perform("GET", "instruments/sectors", params, &res)
	return
}
func (c *APIClient) InstrumentSector(sectors string) (res []Sector, err error) {
	res = []Sector{}
	err = c.Perform("GET", fmt.Sprintf("instruments/sectors/%s", sectors), nil, &res)
	return
}
func (c *APIClient) InstrumentTypes() (res []InstrumentType, err error) {
	res = []InstrumentType{}
	err = c.Perform("GET", "instruments/types", nil, &res)
	return
}
func (c *APIClient) InstrumentType(instrumentType string) (res []InstrumentType, err error) {
	res = []InstrumentType{}
	err = c.Perform("GET", fmt.Sprintf("instruments/types/%s", instrumentType), nil, &res)
	return
}
func (c *APIClient) InstrumentUnderlyings(derivateType string, currency string) (res []Instrument, err error) {
	res = []Instrument{}
	err = c.Perform("GET", fmt.Sprintf("instruments/underlyings/%s/%s", derivateType, currency), nil, &res)
	return
}
func (c *APIClient) Lists() (res []List, err error) {
	res = []List{}
	err = c.Perform("GET", "lists", nil, &res)
	return
}
func (c *APIClient) List(id int64) (res []Instrument, err error) {
	res = []Instrument{}
	err = c.Perform("GET", fmt.Sprintf("lists/%d", id), nil, &res)
	return
}
func (c *APIClient) Login() (res *Login, err error) {
	res = &Login{}
	c.RLock()
	params := &Params{"auth": c.Credentials, "service": c.Service}
	c.RUnlock()
	err = c.Perform("POST", "login", params, res)
	c.Lock()
	c.SessionKey = res.SessionKey
	c.Unlock()
	return
}
func (c *APIClient) Logout() (res *LoggedInStatus, err error) {
	res = &LoggedInStatus{}
	err = c.Perform("DELETE", "login", nil, res)
	return
}
func (c *APIClient) Touch() (res *LoggedInStatus, err error) {
	res = &LoggedInStatus{}
	err = c.Perform("PUT", "login", nil, res)
	return
}
func (c *APIClient) Markets() (res []Market, err error) {
	res = []Market{}
	err = c.Perform("GET", "markets", nil, &res)
	return
}
func (c *APIClient) Market(ids string) (res []Market, err error) {
	res = []Market{}
	err = c.Perform("GET", fmt.Sprintf("markets/%s", ids), nil, &res)
	return
}