1.2.5 • Published 4 years ago

ordernet-api v1.2.5

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

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

Functions

Typedefs

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

ParamTypeDescription
usernamestringThe Spark username
passwordstringThe Spark password
brokerstringUsed 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

ParamTypeDescription
accountAccountAccount to get balance for

accountKeyToNumber(key) ⇒ string

Convert account key to account number.

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

ParamTypeDescription
keystringThe account key for API usage (ACC_XXX-YYYYYY)

Config : Object

Kind: global typedef
Properties

NameTypeDescription
apiUrlstringThe 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.
authorizationstringThe bearer token to pass for authentication in each API call

Account : Object

Kind: global typedef
Properties

NameTypeDescription
keystringThe account key for API usage (ACC_XXX-YYYYYY)
namestringThe name listed on the account
numbernumberThe account number (YYYYYY)

Refs

1.2.5

4 years ago

1.2.4

4 years ago

1.2.0

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.2

4 years ago

1.0.1

4 years ago