nordnet

module
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

README

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/0dayfall/nordnet

Usage

REST API Client
package main

import (
	"fmt"
	"github.com/0dayfall/nordnet/api"
	"github.com/0dayfall/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/0dayfall/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)
	}
}

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.
cmd
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