Extends EventEmitter
A simple-to-use Node.js wrapper around the Nordnet nExt API.
Parameters
config
Call one of the API endpoints.
Parameters
method
string HTTP method to use when calling.endpoint
string The endpoint to call.data
Object JSON data to send with the request.
Returns (Object | boolean) Returns an object upon success or error, or a simple boolean false if this method is called without the client being authenticated.
Authenticate the client and receive a session key. The function also keeps track of when the session key expires and reauthenticates automatically just before it does.
Parameters
credentials
Object Nordnet nExt API credentials.
Returns boolean True if the authentication went OK, false otherwise.
Subscribe the public feed to a specific type of events.
Parameters
type
string The type of events to start listening to.args
Object Arguments to pass together with the subscription command.
Returns Promise Resolves when the feed is subscribed.
Authenticate all feeds and start listening for input.
Parameters
config
Object The configuration object for all feeds.
Returns Promise Resolves all authenticated feeds.
Authenticate a single feed.
Parameters
FEED_HANDLE
stringconfig
Object Configuration for this feed.sessionKey
string The session key received at login.
Returns Promise Description
Convert a value to base64.
Parameters
Returns string A base64 encoded version of the value.
Builder to be used when sending commands to the sockets.
Parameters
cmd
string A valid feed command. One oflogin
,subscribe
orunsibscribe
.args
Object Arguments to pass conjointly with the command.
Returns string A stringified verson of the data, with a line break at the end.
Base64 encodes the username, password and a timestamp, joins the strings with colons, encrypts the joined string using Nordnet's public RSA key, and finally base64 encodes the encrypted string. Phew.
Parameters
Returns string The encrypted, base64 encoded authentication string.