3.0.4 • Published 9 years ago

barchart-instruments-client v3.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

search-client

Javascript library for querying/searching Barchart data

This library allows a user to lookup, search, and query instruments, exchanges, and elevators.

##Unit Testing

Gulp and Jasmine are used. Execute unit tests, as follows:

> npm install
> gulp test

##Complete Documentation

You can generate complete JSDoc documentation, as follows:

> npm install
> gulp document

The output will be available here:

./docs/index.html

##Quick Start

###Example Page

./example/browser/example.html

###instantiate

var searchManager = new Barchart.Search.SearchManager();

The constructor can also take multiple arguments:

var searchManager = new Barchart.Search.SearchManager(host, port, mode, secure);
  • host: (optional) search service hostname
  • port: (optional) search service' port number
  • mode: (optional) either 'rest' or 'socket.io'

###connect

searchManager.connect()
	.then(function() {
	
	});

###lookupInstrument

Returns an instrument, given the instrument's symbol.

searchManager.lookupInstrument('AAPL')
	.then(function(response) {

	});

response:

{
	"symbol": "AAPL",
	"instrument": {
        "symbol": "AAPL",
        "name": "Apple Inc",
        "unitcode": 2,
        "exchange": "NASDAQ",
        "symbolType": 1
	}
}

###searchInstruments

Runs a full-text search of the instrument database searching both the symbol and the name properties.

searchManager.searchInstruments('AA')
	.then(function(response) {

	});

response:

{
	"query":"AA",
	"instruments": [
	    {
            "symbol": "AA",
            "name": "Alcoa Inc",
            "unitcode": 2,
            "exchange": "NYSE",
            "symbolType": 1
		}, {
           "symbol": "AAPL",
           "name": "Apple Inc",
           "unitcode": 2,
           "exchange": "NASDAQ",
           "symbolType": 1
        }
	]
}

###queryInstruments

Searches the instrument database for instruments that match specified criteria.

var exchange = 'NYSE';

searchManager.queryInstruments(exchange)
	.then(function(response) {

	});

response:

{
	"exchange":"NYSE",
	"instruments": [
	    {
            "symbol": "AA",
            "name": "Alcoa Inc",
            "unitcode": 2,
            "exchange": "NYSE",
            "symbolType": 1
		}, {
            "symbol": "AAP",
            "name": "Advance Auto Parts Inc",
            "unitcode": 2,
            "exchange": "NYSE",
            "symbolType": 1
       }
	]
}

###lookupExchange

Returns an exchange, given the exchange's ID.

searchManager.lookupExchange('NYSE')
	.then(function(response) {

	});

response:

{
    "id": "NYSE",
    "exchange": {
        "id": "NYSE",
        "description": "New York Stock Exchange",
        "frequency": 13,
        "delay": 15
    }
}

###queryExchanges

Retuns a complete list of exchanges.

searchManager.queryExchanges()
	.then(function(response) {

	});

response:

[
    "exchange": {
        "id": "NYSE",
        "description": "New York Stock Exchange",
        "frequency": 13,
        "delay": 15
    },
    {
        id: "BSE",
        description: "Budapest Stock Exchange",
        frequency: 1,
        delay: 1440
    }
]

###dispose

Closes the connection to the server.

searchManager.dispose();
3.0.4

9 years ago

3.0.3

9 years ago

3.0.2

9 years ago

3.0.1

9 years ago

2.1.8

9 years ago

2.1.7

9 years ago

2.1.6

9 years ago

2.1.5

10 years ago

2.1.4

10 years ago

2.1.3

10 years ago

2.1.2

10 years ago

2.0.4

10 years ago

2.0.3

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago