https://github.com/simov/stocktwits
StockTwits API wrapper
https://github.com/simov/stocktwits
Last synced: 9 months ago
JSON representation
StockTwits API wrapper
- Host: GitHub
- URL: https://github.com/simov/stocktwits
- Owner: simov
- License: mit
- Created: 2013-10-10T21:00:06.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2018-06-15T00:39:51.000Z (over 7 years ago)
- Last Synced: 2025-03-24T09:47:00.466Z (10 months ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 7
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
stocktwits
==========
```bash
$ npm install stocktwits
$ npm test
```
##GET
Accepts API string, query string params (optional) and a callback.
```js
var st = require('stocktwits');
// without additional parameters
st.get('streams/user/StockTwits', function (err, res) {
console.log(res.body);
});
// pass optional parameters
st.get('streams/user/StockTwits', {limit:15, filter:'links'}, function (err, res) {
console.log(res.body);
});
// for requests that require authentication
st.get('streams/friends', {access_token:'token', filter:'charts'}, function (err, res) {
console.log(res.body);
});
```
Note that some parameters are appended to the API string! Refer to the StockTwits documentation.
##POST
Accepts API string, query string params, POST data and a callback.
```js
// the access token is required for all POST requests
st.post('messages/create', {access_token:'token'}, {body:'message'}, function (err, res) {
console.log(res.body);
});
```
##RESPONSE
###err
`err` is one of:
- network error
- generic error from StockTwits (usually html page)
- API error (JSON error response)
###res
`res` is a generic nodejs response object extended with:
- **body** - parsed JSON response from the server
- **raw** - the response as string
- **limit** - the API limit for this type of request
- **remainig** - remaining request for this time window
- **reset** - rate limit reset date