nordnet

module
v0.0.0-...-3ac149e Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2015 License: MIT

README

nordnet

Go implementation of the Nordnet External API.

https://api.test.nordnet.se/api-docs/index.html

Installation

The APIClient is used for making REST requests, such as making orders.

$ go get github.com/denro/nordnet/api

The Feed package is for reading realtime prices and trades.

$ go get github.com/denro/nordnet/feed

Util contains authentication.

$ go get github.com/denro/nordnet/util

Usage

REST API Client
package main

import (
	"fmt"
	"github.com/denro/nordnet/api"
	"github.com/denro/nordnet/util"
)

var (
	pemData = []byte(`-----BEGIN PUBLIC KEY-----`)
	user    = []byte(`...`)
	pass    = []byte(`...`)
)

func main() {
	cred, _ := util.GenerateCredentials(user, pass, pemData)
	client := api.NewAPIClient(cred)
	client.Login()

	fmt.Println(client.Accounts())
}
Feed Client
package main

import (
	"fmt"
	"github.com/denro/nordnet/feed"
)

var (
	sessionKey = "..."
	address    = "..."
)

func main() {
	feed, _ := feed.NewPrivateFeed(address)
	feed.Login(sessionKey, nil)

	msgChan, errChan := feed.Dispatch()

	for _, msg := range msgChan {
		fmt.Println(msg)
	}
}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Directories

Path Synopsis
Package api includes the HTTP client used to access the REST JSON API.
Package api includes the HTTP client used to access the REST JSON API.
Contains everything related to the public and private feeds More information available on https://api.test.nordnet.se/next/2/api-docs/docs/feeds
Contains everything related to the public and private feeds More information available on https://api.test.nordnet.se/next/2/api-docs/docs/feeds
Package util contains utility functions
Package util contains utility functions
models
Package models represents data returned by the API and in the private feed
Package models represents data returned by the API and in the private feed

Jump to

Keyboard shortcuts

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