denro / nordnet

Nordnet External API client for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nordnet

Build Status GoDoc Go Report Card

Go implementation of the Nordnet External API.

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

Installation

go get github.com/denro/nordnet

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())
}

To use Nordnet test credentials, try client := api.NewAPITestClient(cred).

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 := make(chan *PrivateMsg)
	errChan := make(chan error)
	feed.Dispatch(msgChan, errChan)

	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

About

Nordnet External API client for Go

License:MIT License


Languages

Language:Go 100.0%