ordernet-api

1.2.5 • Public • Published

OrdernetAPI

A simple tool for querying https://spark{nesua,meitav,psagot}.ordernet.co.il/api.
Right now only returns total balance for each account.

npm version

CLI

npm install -g ordernet-api

Options

$ ordernet-api -h
Options:
  -u, --user, --username  Username for login into Spark.     [string] [required]
  -p, --pass, --password  Password for login into Spark.     [string] [required]
  -b, --broker            Broker name.
                      [string] [required] [choices: "nesua", "meitav", "psagot"]
  -a, --account-key       Print balance only for these account keys. This is
                          usually much faster. An account key has the form
                          "ACC_XXX-YYYYYY". You can find it out using the
                          --verbose flag.                                [array]
  -v, --verbose           Print log messages                           [boolean]
  -h, --help              Show help                                    [boolean]
  -V, --version           Show version number                          [boolean]
 
Examples:
  cli.js -u 1234 -p abcd -b nesua           Print the balance for each account
                                            associated with this Spark user.
  cli.js -u 1234 -p abcd -a ACC_000-111111  Print the balance only for the
  -b nesua                                  account key ACC_000-111111.
  cli.js -u 1234 -p abcd -a ACC_000-111111  Print the balance only for the
  -a ACC_000-222222 -b nesua                account keys ACC_000-111111 and
                                            ACC_000-222222.
 
For more info visit https://github.com/assafmo/OrdernetAPI

Library API

npm install ordernet-api

or

yarn add ordernet-api

Constants

config : Config

The internal config object.

Functions

authenticate(username, password, broker)Void

Authenticate against the Spark system of the broker. This function must be called first as it initializes the apiUrl and authorization fields in the internal config. That way we won't need to authenticate again for each API call. Uses /api/Auth/Authenticate.

getAccounts()Array.<Account>

Get all the accounts listed under this Spark user. Uses /api/DataProvider/GetStaticData.

getAccountBalance(account)number

Get total balance of an account. Uses /api/Account/GetAccountSecurities.

accountKeyToNumber(key)string

Convert account key to account number.

Typedefs

Config : Object
Account : Object

config : Config

The internal config object.

Kind: global constant

authenticate(username, password, broker) ⇒ Void

Authenticate against the Spark system of the broker. This function must be called first as it initializes the apiUrl and authorization fields in the internal config. That way we won't need to authenticate again for each API call. Uses /api/Auth/Authenticate.

Kind: global function

Param Type Description
username string The Spark username
password string The Spark password
broker string Used to get the API URL like this: https://spark${broker}.ordernet.co.il/api. E.g. nesua, meitav, psagot

getAccounts() ⇒ Array.<Account>

Get all the accounts listed under this Spark user. Uses /api/DataProvider/GetStaticData.

Kind: global function
Returns: Array.<Account> - - All accounts listed under this Spark user

getAccountBalance(account) ⇒ number

Get total balance of an account. Uses /api/Account/GetAccountSecurities.

Kind: global function
Returns: number - - Total balance of the account

Param Type Description
account Account Account to get balance for

accountKeyToNumber(key) ⇒ string

Convert account key to account number.

Kind: global function
Returns: string - - The account number

Param Type Description
key string The account key for API usage (ACC_XXX-YYYYYY)

Config : Object

Kind: global typedef
Properties

Name Type Description
apiUrl string The API URL to send requests to. Probably one of https://sparknesua.ordernet.co.il/api, https://sparkmeitav.ordernet.co.il/api or https://sparkpsagot.ordernet.co.il/api.
authorization string The bearer token to pass for authentication in each API call

Account : Object

Kind: global typedef
Properties

Name Type Description
key string The account key for API usage (ACC_XXX-YYYYYY)
name string The name listed on the account
number number The account number (YYYYYY)

Refs

Readme

Keywords

none

Package Sidebar

Install

npm i ordernet-api

Weekly Downloads

0

Version

1.2.5

License

MIT

Unpacked Size

14.3 kB

Total Files

5

Last publish

Collaborators

  • assafmo