Skip to content
This repository was archived by the owner on Sep 13, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fugle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface FugleParams {
export class Fugle {
private static BASE_REALTIME_URL = 'https://api.fugle.tw/realtime';
private static BASE_REALTIME_WS = 'wss://api.fugle.tw/realtime';
private static VERSION = 'v0.2';
private static VERSION = 'v0.3';
private _apiToken: string;

constructor(options: FugleOptions = {}) {
Expand Down
6 changes: 3 additions & 3 deletions test/fugle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ describe('Fugle', () => {
describe('#api', () => {
it('should invoke axios with compiled url', () => {
const fugle = new Fugle({ apiToken: 'demo' });
const url = 'https://api.fugle.tw/realtime/v0/intraday/quote?apiToken=demo&oddLot=false&symbolId=2884';
const url = 'https://api.fugle.tw/realtime/v0.3/intraday/quote?apiToken=demo&oddLot=false&symbolId=2884';
fugle.api('/intraday/quote', { symbolId: '2884' });
expect(axios).toBeCalledWith(url);
});
});

it('should invoke axios with compiled url for intraday odd lot trading', () => {
const fugle = new Fugle({ apiToken: 'demo' });
const url = 'https://api.fugle.tw/realtime/v0/intraday/quote?apiToken=demo&oddLot=true&symbolId=2884';
const url = 'https://api.fugle.tw/realtime/v0.3/intraday/quote?apiToken=demo&oddLot=true&symbolId=2884';
fugle.api('/intraday/quote', { symbolId: '2884', oddLot: true });
expect(axios).toBeCalledWith(url);
});

describe('#ws', () => {
it('should invoke ws with compiled url', () => {
const fugle = new Fugle({ apiToken: 'demo' });
const url = 'wss://api.fugle.tw/realtime/v0/intraday/quote?apiToken=demo&symbolId=2884';
const url = 'wss://api.fugle.tw/realtime/v0.3/intraday/quote?apiToken=demo&symbolId=2884';
fugle.ws('/intraday/quote', { symbolId: '2884' });
expect(WebSocket).toBeCalledWith(url);
});
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3786,9 +3786,9 @@ path-key@^3.0.0, path-key@^3.1.0:
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==

path-parse@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==

path-type@^1.0.0:
version "1.1.0"
Expand Down