Skip to content

Commit 1e3005f

Browse files
committed
feat: method aliases
1 parent 6e41d07 commit 1e3005f

12 files changed

+127
-10
lines changed

lib/client.ts

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,97 @@ export class Client {
8888
return fromSnakeCaseToCamelCase(response);
8989
}
9090

91+
92+
//////////////
93+
// ALIASES //
94+
/////////////
95+
// MARKET DATA
96+
97+
/**
98+
* alias of {@link getTicker}
99+
*/
100+
getTickerBySymbol = this.getTicker;
101+
/**
102+
* alias of {@link getTicker}
103+
*/
104+
getTickerOfSymbol = this.getTicker;
105+
/**
106+
* alias of {@link getTickerLastPrice}
107+
*/
108+
getTickerPriceBySymbol = this.getTickerLastPrice;
109+
/**
110+
* alias of {@link getTickerLastPrice}
111+
*/
112+
getTickerPriceOfSymbol = this.getTickerLastPrice;
113+
/**
114+
* Alias of {@link getTradesBySymbol}
115+
*/
116+
getTradesOfSymbol = this.getTradesBySymbol;
117+
/**
118+
* alias of {@link getOrderBook}
119+
*/
120+
getOrderbookBySymbol = this.getOrderBook;
121+
/**
122+
* alias of {@link getOrderBook}
123+
*/
124+
getOrderbookOfSymbol = this.getOrderBook;
125+
/**
126+
* alias of {@link getOrderBookVolume}
127+
*/
128+
getOrderBookVolumeBySymbol = this.getOrderBookVolume;
129+
/**
130+
* alias of {@link getOrderBookVolume}
131+
*/
132+
getOrderBookVolumeOfSymbol = this.getOrderBookVolume;
133+
/**
134+
* alias of {@link getCandlesBySymbol}
135+
*/
136+
getCandlesOfSymbol = this.getCandlesBySymbol;
137+
/**
138+
* alias of {@link getConvertedCandlesBySymbol}
139+
*/
140+
getConvertedCandlesOfSymbol = this.getConvertedCandlesBySymbol;
141+
142+
// SPOT TRADING
143+
144+
/**
145+
* alias of {@link getSpotTradingBalance}
146+
*/
147+
getSpotTradingBalanceOfCurrency = this.getSpotTradingBalance;
148+
/**
149+
* alias of {@link getSpotTradingBalance}
150+
*/
151+
getSpotTradingBalanceByCurrency = this.getSpotTradingBalance;
152+
/**
153+
* alias of {@link getTradingCommission}
154+
*/
155+
getTradingCommissionOfSymbol = this.getTradingCommission;
156+
/**
157+
* alias of {@link getTradingCommission}
158+
*/
159+
getTradingCommissionBySymbol = this.getTradingCommission;
160+
161+
// WALLET MANAGEMENT
162+
163+
/**
164+
* alias of {@link getWalletBalance}
165+
*/
166+
getWalletBalanceOfCurrency = this.getWalletBalance;
167+
/**
168+
* alias of {@link getWalletBalance}
169+
*/
170+
getWalletBalanceByCurrency = this.getWalletBalance;
171+
/**
172+
* alais of {@link getDepositCryptoAddress}
173+
*/
174+
getDepositCryptoAddressByCurrency = this.getDepositCryptoAddress;
175+
/**
176+
* alias of {@link getDepositCryptoAddress}
177+
*/
178+
getDepositCryptoAddressOfCurrency = this.getDepositCryptoAddress;
179+
180+
181+
91182
//////////////////
92183
// PUBLIC CALLS //
93184
//////////////////

lib/websocket/marketDataClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export class MarketDataClient extends WSClientBase {
206206
*
207207
* @param {function} callback a function that recieves notifications as a dict of candles indexed by symbol, and the type of notification (either SNAPSHOT or UPDATE)
208208
* @param {function} params.targetCurrency Target currency for conversion
209-
* @param {PERIOD} params.period A valid tick interval. 'M1' (one minute), 'M3', 'M5', 'M15', 'M30', 'H1' (one hour), 'H4', 'D1' (one day), 'D7', '1M' (one month). Default is 'M30'
209+
* @param {PERIOD} params.period A valid tick interval. 'M1' (one minute), 'M3', 'M5', 'M15', 'M30', 'H1' (one hour), 'H4', 'D1' (one day), 'D7', '1M' (one month).
210210
* @param {string[]} params.symbols A list of symbol ids
211211
* @param {number} [params.limit] Optional. Number of historical entries returned in the first feed. Min is 0. Max is 1000. Default is 0
212212
* @return A promise that resolves when subscribed with a list of the successfully subscribed symbols

lib/websocket/tradingClient.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ export class TradingClient extends AuthClient {
229229
return this.makeRequest<Balance>({ method: "spot_balance", params: { currency } });
230230
}
231231

232+
/**
233+
* alias of {@link getSpotTradingBalance}
234+
*/
235+
getSpotTradingBalanceOfCurrency = this.getSpotTradingBalance;
236+
232237
/**
233238
* Get the personal trading fee rates for all symbols
234239
*
@@ -254,6 +259,15 @@ export class TradingClient extends AuthClient {
254259
return fromSnakeCaseToCamelCase(commission)
255260
}
256261

262+
/**
263+
* alias of {@link getSpotFee}
264+
*/
265+
getSpotFeeOfSymbol = this.getSpotFee;
266+
/**
267+
* alias of {@link getSpotFee}
268+
*/
269+
getSpotFeeBySymbol = this.getSpotFee;
270+
257271
///////////////////
258272
// subscriptions //
259273
///////////////////

lib/websocket/walletClient.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ export class WalletClient extends AuthClient {
6666
return { available: response.available, reserved: response.reserved, currency: currency };
6767
}
6868

69+
/**
70+
* alias of {@link getWalletBalance}
71+
*/
72+
getWalletBalanceOfCurrency = this.getWalletBalance;
73+
/**
74+
* alias of {@link getWalletBalance}
75+
*/
76+
getWalletBalanceByCurrency = this.getWalletBalance;
77+
6978
/**
7079
* Get the transaction history of the account
7180
*

test/rest/spotTrading.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
goodTradingCommission,
1414
listSize,
1515
} from "../testHelpers";
16-
const keys = require("../../keys.json");
16+
const keys = require("../../../../keys.json");
1717

1818
describe("spot trading", () => {
1919
let client = new Client(keys.apiKey, keys.apiSecret);

test/rest/spotTradingHistory.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import assert from "assert";
22
import { Client } from "../../lib";
33
import { goodList, goodOrder, goodTrade } from "../testHelpers";
4-
const keys = require("../../keys.json");
5-
4+
const keys = require("../../../../keys.json");
65
import "mocha";
76

87
describe("spot trading history", () => {

test/rest/walletManagement.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
goodTransaction,
1313
} from "../testHelpers";
1414
import { Address } from "../../lib/models";
15-
const keys = require("../../keys.json");
15+
const keys = require("../../../../keys.json");
1616

1717
describe("wallet management", () => {
1818
let client = new Client(keys.apiKey, keys.apiSecret);

test/websocket/marketData.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe("websocket market data client", function () {
5454
});
5555

5656

57-
describe.only("subscribe to converted candles", function () {
57+
describe("subscribe to converted candles", function () {
5858
it("gets a feed of candles", async function () {
5959
this.timeout(0);
6060
await wsclient.connect();

test/websocket/trading.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const keys = require("../../keys.json");
1+
2+
const keys = require("../../../../keys.json");
23
import { expect } from "chai";
34
import "mocha";
45
import { WSTradingClient } from "../../lib";

test/websocket/tradingSubscriptions.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const keys = require("../../keys.json");
1+
2+
const keys = require("../../../../keys.json");
23
import { expect } from "chai";
34
import { WSTradingClient } from "../../lib";
45
import { SUBSCRIPTION_MODE } from "../../lib/constants";

0 commit comments

Comments
 (0)