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

Commit

Permalink
feat: upgrade api version to v0.3 (#14)
Browse files Browse the repository at this point in the history
Co-authored-by: Haikyo <[email protected]>
  • Loading branch information
2 people authored and chunkai1312 committed Sep 13, 2021
1 parent 02877a0 commit 4164804
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 4164804

Please sign in to comment.