coinrayjs 1.9.12 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coinrayjs.es.js +13082 -0
- package/dist/coinrayjs.es.js.map +1 -0
- package/dist/coinrayjs.js +52 -0
- package/dist/coinrayjs.js.map +1 -0
- package/package.json +50 -81
- package/dist/candles-cache.d.ts +0 -7
- package/dist/candles-cache.js +0 -57
- package/dist/candles-cache.js.map +0 -1
- package/dist/coinray-cache.d.ts +0 -47
- package/dist/coinray-cache.js +0 -249
- package/dist/coinray-cache.js.map +0 -1
- package/dist/coinray.d.ts +0 -183
- package/dist/coinray.js +0 -1118
- package/dist/coinray.js.map +0 -1
- package/dist/crypto.d.ts +0 -1
- package/dist/crypto.js +0 -57
- package/dist/crypto.js.map +0 -1
- package/dist/current-market.d.ts +0 -62
- package/dist/current-market.js +0 -285
- package/dist/current-market.js.map +0 -1
- package/dist/errors.d.ts +0 -25
- package/dist/errors.js +0 -50
- package/dist/errors.js.map +0 -1
- package/dist/event-emitter.d.ts +0 -9
- package/dist/event-emitter.js +0 -36
- package/dist/event-emitter.js.map +0 -1
- package/dist/exchange.d.ts +0 -55
- package/dist/exchange.js +0 -167
- package/dist/exchange.js.map +0 -1
- package/dist/i18n/locales.d.ts +0 -21
- package/dist/i18n/locales.js +0 -21
- package/dist/i18n/locales.js.map +0 -1
- package/dist/i18n.d.ts +0 -4
- package/dist/i18n.js +0 -16
- package/dist/i18n.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.js +0 -10
- package/dist/index.js.map +0 -1
- package/dist/lru.d.ts +0 -26
- package/dist/lru.js +0 -93
- package/dist/lru.js.map +0 -1
- package/dist/market.d.ts +0 -65
- package/dist/market.js +0 -162
- package/dist/market.js.map +0 -1
- package/dist/orders/base.d.ts +0 -29
- package/dist/orders/base.js +0 -47
- package/dist/orders/base.js.map +0 -1
- package/dist/orders/index.d.ts +0 -6
- package/dist/orders/index.js +0 -7
- package/dist/orders/index.js.map +0 -1
- package/dist/orders/limit-ladder.d.ts +0 -87
- package/dist/orders/limit-ladder.js +0 -229
- package/dist/orders/limit-ladder.js.map +0 -1
- package/dist/orders/limit.d.ts +0 -47
- package/dist/orders/limit.js +0 -86
- package/dist/orders/limit.js.map +0 -1
- package/dist/orders/market.d.ts +0 -37
- package/dist/orders/market.js +0 -60
- package/dist/orders/market.js.map +0 -1
- package/dist/orders/oco.d.ts +0 -54
- package/dist/orders/oco.js +0 -70
- package/dist/orders/oco.js.map +0 -1
- package/dist/orders/stop-limit.d.ts +0 -42
- package/dist/orders/stop-limit.js +0 -33
- package/dist/orders/stop-limit.js.map +0 -1
- package/dist/orders/validate.d.ts +0 -2
- package/dist/orders/validate.js +0 -6
- package/dist/orders/validate.js.map +0 -1
- package/dist/trade.d.ts +0 -10
- package/dist/trade.js +0 -32
- package/dist/trade.js.map +0 -1
- package/dist/types.d.ts +0 -213
- package/dist/types.js +0 -59
- package/dist/types.js.map +0 -1
- package/dist/util.d.ts +0 -48
- package/dist/util.js +0 -407
- package/dist/util.js.map +0 -1
package/dist/coinray.d.ts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { AccountTestParams, CancelOrderParams, Candle, CandleParam, CandlesParam, CreateOrderParams, MarketParam, SmartOrderParams, UpdateOrderParams } from "./types";
|
|
2
|
-
import Exchange from "./exchange";
|
|
3
|
-
import I18n from "./i18n";
|
|
4
|
-
export declare class CoinrayError extends Error {
|
|
5
|
-
errorCode: number;
|
|
6
|
-
errorMessage: string;
|
|
7
|
-
exchange: any;
|
|
8
|
-
constructor({ code, message, exchange }: {
|
|
9
|
-
code: any;
|
|
10
|
-
message: any;
|
|
11
|
-
exchange: any;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
export default class Coinray {
|
|
15
|
-
static I18n: typeof I18n;
|
|
16
|
-
config: {
|
|
17
|
-
apiEndpoint: string;
|
|
18
|
-
orderEndpoint: string;
|
|
19
|
-
websocketEndpoint: string;
|
|
20
|
-
};
|
|
21
|
-
_token: string;
|
|
22
|
-
private _sessionKey;
|
|
23
|
-
private _credential;
|
|
24
|
-
private _firstOpen;
|
|
25
|
-
private _onTokenExpired?;
|
|
26
|
-
private _tokenCheckTimeout;
|
|
27
|
-
private _onError?;
|
|
28
|
-
private _onOpen?;
|
|
29
|
-
private _socket?;
|
|
30
|
-
private _sockets;
|
|
31
|
-
private _transport;
|
|
32
|
-
private _tickerListeners;
|
|
33
|
-
private _tradeListeners;
|
|
34
|
-
private _tradeSnapshots;
|
|
35
|
-
private _orderbookListeners;
|
|
36
|
-
private _orderbookSnapshots;
|
|
37
|
-
private _candleTradeListeners;
|
|
38
|
-
private _candleListeners;
|
|
39
|
-
private _candles;
|
|
40
|
-
private _timers;
|
|
41
|
-
private _channels;
|
|
42
|
-
private _connected;
|
|
43
|
-
private markConnected;
|
|
44
|
-
private _publicKey;
|
|
45
|
-
_refreshingToken: Promise<string>;
|
|
46
|
-
private onReconnect;
|
|
47
|
-
private _nonceOffset;
|
|
48
|
-
private tickersSubscribed;
|
|
49
|
-
private tradesSubscribed;
|
|
50
|
-
private orderBookSubscribed;
|
|
51
|
-
private _timeOffset;
|
|
52
|
-
private _timeOffsetTimeout;
|
|
53
|
-
private _candleCache;
|
|
54
|
-
private _candleCacheCreatedAt;
|
|
55
|
-
constructor(token: string, { apiEndpoint, orderEndpoint, websocketEndpoint }?: {
|
|
56
|
-
apiEndpoint: string;
|
|
57
|
-
orderEndpoint: string;
|
|
58
|
-
websocketEndpoint: string;
|
|
59
|
-
});
|
|
60
|
-
authenticateDevice: (credential: string, sessionKey: string) => void;
|
|
61
|
-
destroy: () => void;
|
|
62
|
-
checkToken: (loop?: boolean) => Promise<boolean>;
|
|
63
|
-
setTransport: (transport: any) => void;
|
|
64
|
-
onTokenExpired: (callback: () => Promise<string>) => void;
|
|
65
|
-
refreshToken: (token: string) => void;
|
|
66
|
-
getNonce: () => number;
|
|
67
|
-
getTime: () => number;
|
|
68
|
-
loadTimeOffset: () => Promise<void>;
|
|
69
|
-
getToken: () => Promise<string>;
|
|
70
|
-
reconnect: () => void;
|
|
71
|
-
disconnect: () => void;
|
|
72
|
-
connect: () => Promise<void>;
|
|
73
|
-
onOpen: (callback: (event: any) => void) => void;
|
|
74
|
-
onError: (callback: (event: any) => void) => void;
|
|
75
|
-
resubscribe: () => void;
|
|
76
|
-
subscribeTickers: (exchangeCode: string, callback: (payload: any) => void) => Promise<(payload: any) => void>;
|
|
77
|
-
unsubscribeTickers: (exchangeCode: string, callback?: (payload: any) => void) => void;
|
|
78
|
-
subscribeTrades: ({ coinraySymbol }: MarketParam, callback: (payload: any) => void) => Promise<(payload: any) => void>;
|
|
79
|
-
unsubscribeTrades: ({ coinraySymbol }: MarketParam, callback?: (payload: any) => void) => void;
|
|
80
|
-
subscribeOrderBook: ({ coinraySymbol }: MarketParam, callback: (payload: any) => void) => Promise<(payload: any) => void>;
|
|
81
|
-
unsubscribeOrderBook: ({ coinraySymbol }: MarketParam, callback?: (payload: any) => void) => void;
|
|
82
|
-
subscribeCandles: ({ coinraySymbol, resolution, lastCandle }: CandleParam, callback: (payload: any) => void) => Promise<(payload: any) => void>;
|
|
83
|
-
startNewCandleTimer: ({ candleId, resolution, coinraySymbol }: {
|
|
84
|
-
candleId: any;
|
|
85
|
-
resolution: any;
|
|
86
|
-
coinraySymbol: any;
|
|
87
|
-
}) => void;
|
|
88
|
-
unsubscribeCandles: ({ coinraySymbol, resolution }: CandleParam, callback?: (payload: any) => void) => void;
|
|
89
|
-
fetchFirstCandleTime: ({ coinraySymbol, resolution }: {
|
|
90
|
-
coinraySymbol: any;
|
|
91
|
-
resolution: any;
|
|
92
|
-
}) => Promise<Date>;
|
|
93
|
-
fetchCandles: ({ coinraySymbol, resolution, start, end, useWebSocket }: CandlesParam) => Promise<Candle[]>;
|
|
94
|
-
flushCache: () => void;
|
|
95
|
-
getWebsocketCandles: (coinraySymbol: any, resolution: any) => Promise<Candle[]>;
|
|
96
|
-
getOpenCandles: (useWebSocket: any, getParams: any) => Promise<Candle[]>;
|
|
97
|
-
getHistoryCandles: (getParams: any) => Promise<Candle[]>;
|
|
98
|
-
candleCacheKey: ({ symbol, resolution, year, month, day, week, prefix }: {
|
|
99
|
-
symbol: string;
|
|
100
|
-
resolution: string;
|
|
101
|
-
year: any;
|
|
102
|
-
month?: any;
|
|
103
|
-
day?: any;
|
|
104
|
-
week?: any;
|
|
105
|
-
prefix?: string;
|
|
106
|
-
}) => string;
|
|
107
|
-
fetchExchanges: (callback: (payload: any) => Exchange, cachedExchanges: any) => Promise<Exchange[]>;
|
|
108
|
-
fetchMarkets: (exchange: Exchange, cachedMarkets: any) => Promise<object[]>;
|
|
109
|
-
createCredential: (deviceId: string, password: string) => Promise<any>;
|
|
110
|
-
wrapApiKey: (apiKeySettings: {}, preWrapped: false) => Promise<any>;
|
|
111
|
-
testAccount: (accountTest: AccountTestParams) => Promise<any>;
|
|
112
|
-
createSmartOrderSignature: (smartOrder: SmartOrderParams) => Promise<any>;
|
|
113
|
-
createOrder: (order: CreateOrderParams) => Promise<any>;
|
|
114
|
-
updateOrder: (order: UpdateOrderParams) => Promise<any>;
|
|
115
|
-
cancelOrder: (order: CancelOrderParams) => Promise<any>;
|
|
116
|
-
createWebSocketToken: ({ exchangeCode, encryptedApiKey }: {
|
|
117
|
-
exchangeCode: any;
|
|
118
|
-
encryptedApiKey: any;
|
|
119
|
-
}) => Promise<any>;
|
|
120
|
-
fetchPositions: ({ exchangeCode, encryptedApiKey }: {
|
|
121
|
-
exchangeCode: any;
|
|
122
|
-
encryptedApiKey: any;
|
|
123
|
-
}) => Promise<any>;
|
|
124
|
-
getBalances: ({ exchangeCode, encryptedApiKey }: {
|
|
125
|
-
exchangeCode: any;
|
|
126
|
-
encryptedApiKey: any;
|
|
127
|
-
}) => Promise<{
|
|
128
|
-
balances: any;
|
|
129
|
-
positions: any;
|
|
130
|
-
}>;
|
|
131
|
-
setLeverage: ({ coinraySymbol, leverage, encryptedApiKey }: {
|
|
132
|
-
coinraySymbol: any;
|
|
133
|
-
leverage: any;
|
|
134
|
-
encryptedApiKey: any;
|
|
135
|
-
}) => Promise<any>;
|
|
136
|
-
setMarginType: ({ coinraySymbol, marginType, encryptedApiKey }: {
|
|
137
|
-
coinraySymbol: any;
|
|
138
|
-
marginType: any;
|
|
139
|
-
encryptedApiKey: any;
|
|
140
|
-
}) => Promise<any>;
|
|
141
|
-
getProxyList({ exchangeCode, credentialVersion }: {
|
|
142
|
-
exchangeCode?: string;
|
|
143
|
-
credentialVersion?: string;
|
|
144
|
-
}): Promise<any>;
|
|
145
|
-
publicKey(): Promise<any>;
|
|
146
|
-
get clientId(): string;
|
|
147
|
-
private get socket();
|
|
148
|
-
private getChannel;
|
|
149
|
-
get: (endpoint: string, { apiEndpoint, version, headers, params, secret }?: {
|
|
150
|
-
apiEndpoint?: any;
|
|
151
|
-
version?: string;
|
|
152
|
-
headers?: {};
|
|
153
|
-
params?: {};
|
|
154
|
-
secret?: string;
|
|
155
|
-
}) => Promise<{
|
|
156
|
-
result: any;
|
|
157
|
-
_headers: any;
|
|
158
|
-
}>;
|
|
159
|
-
post: (endpoint: string, attributes: any) => Promise<{
|
|
160
|
-
result: any;
|
|
161
|
-
_headers: any;
|
|
162
|
-
}>;
|
|
163
|
-
patch: (endpoint: string, attributes: any) => Promise<{
|
|
164
|
-
result: any;
|
|
165
|
-
_headers: any;
|
|
166
|
-
}>;
|
|
167
|
-
delete: (endpoint: string, attributes: any) => Promise<{
|
|
168
|
-
result: any;
|
|
169
|
-
_headers: any;
|
|
170
|
-
}>;
|
|
171
|
-
private _request;
|
|
172
|
-
private static _parseOrderBookSnapshot;
|
|
173
|
-
private static _parseOrderBookUpdate;
|
|
174
|
-
private static _updateOrderBook;
|
|
175
|
-
private static _parseBidAsk;
|
|
176
|
-
private static _parseCandle;
|
|
177
|
-
private static _parseTrade;
|
|
178
|
-
private static _parseTicker;
|
|
179
|
-
private static _parseBalance;
|
|
180
|
-
private static _tradesToLastCandle;
|
|
181
|
-
private static _mergeCandle;
|
|
182
|
-
private static _resolutionToSeconds;
|
|
183
|
-
}
|