Fugle API Client
[DEPRECATED] Fugle API client library for JavaScript
Deprecation Notice
This package is deprecated. Please use @fugle/realtime instead.
Install
$ npm install --save fugle
Browser
Add a <script>
to your index.html
:
<script src="/node_modules/fugle/dist/fugle.min.js"></script>
Node.js / Webpack
Import the module to your *.js
file:
const Fugle = require('fugle')
Usage
The library support for REST API and WebSocket.
REST API
const fugle = new Fugle({ apiToken: 'demo' })
fugle
.api('/intraday/quote', { symbolId: '2884' })
.then(res => console.log(res.data))
Intraday odd lot trading:
fugle
.api('/intraday/quote', { symbolId: '2884', oddLot: true })
.then(res => console.log(res.data))
WebSocket
const fugle = new Fugle({ apiToken: 'demo' })
fugle
.ws('/intraday/quote', { symbolId: '2884' })
.onmessage = message => console.log(message.data)