Skip to content
This repository has been archived by the owner on Sep 13, 2021. It is now read-only.

fugle-dev/fugle-api-client

Repository files navigation

Fugle API Client

NPM version Build Status Coverage Status

[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)

Reference

Fugle API

License

MIT