Giter Site home page Giter Site logo

ordernetapi's Introduction

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

ordernetapi's People

Contributors

assafmo avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

amitkendler

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.