10 examples of 'mytrades' in JavaScript

Every line of 'mytrades' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
45trades({ limit = 100, since = 0 }: {
46 limit: number,
47 since: number,
48} = {}, callback?: Function): Promise<Object> {
49 return nodeify.extend(this.fetchPublic(`trades?limit=${limit}&since=${since}`)).nodeify(callback);
50}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

260async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
261 await this.loadMarkets ();
262 const market = this.market (symbol);
263 const request = {
264 'currency': market['id'],
265 'period': 'hour',
266 'format': 'json',
267 };
268 const response = await this.publicGetTrades (this.extend (request, params));
269 return this.parseTrades (response['completeOrders'], market, since, limit);
270}
230async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
231 await this.loadMarkets ();
232 let market = this.market (symbol);
233 let trades = await this.publicGetTrades (this.extend ({
234 'currency': market['id'],
235 }, params));
236 return this.parseTrades (trades, market, since, limit);
237}
122fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
123 return this.privatePostOrdersHistory (this.extend ({
124 'cointype': this.marketId (symbol),
125 }, params));
126}
494async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
495 await this.loadMarkets ();
496 const market = this.market (symbol);
497 const request = {
498 'symbol': market['id'],
499 };
500 if (limit !== undefined) {
501 request['limit'] = limit; // default 50, max 100
502 }
503 const response = await this.publicGetMarketDataTradesSymbol (this.extend (request, params));
504 //
505 // {
506 // "pairId":370,
507 // "symbol":"ETHBTC",
508 // "tradeCount":51,
509 // "trades": [
510 // {
511 // side: 'buy',
512 // price: 0.33634,
513 // amount: 0.01,
514 // timestamp: 1564240008000 // milliseconds
515 // }
516 // ]
517 // }
518 //
519 const trades = this.safeValue (response, 'trades', []);
520 return this.parseTrades (trades, market, since, limit);
521}
190async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
191 await this.loadMarkets ();
192 let market = this.market (symbol);
193 let response = await this.publicPostGetTrades (this.extend ({
194 'ins': market['id'],
195 'startIndex': -1,
196 }, params));
197 return this.parseTrades (response['trades'], market, since, limit);
198}
284async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
285 await this.loadMarkets ();
286 const market = this.market (symbol);
287 const request = {
288 'pair': market['id'],
289 };
290 let response = await this.publicGetTradesPair (this.extend (request, params));
291 const numTrades = response.length;
292 if (numTrades === 1) {
293 const firstTrade = response[0];
294 if (!Object.keys (firstTrade).length) {
295 response = [];
296 }
297 }
298 return this.parseTrades (response, market, since, limit);
299}
178async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
179 let market = this.market (symbol);
180 let response = await this.publicGetRecentTransactionsCurrency (this.extend ({
181 'currency': market['base'],
182 'count': 100, // max = 100
183 }, params));
184 return this.parseTrades (response['data'], market);
185}
151async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
152 let market = this.market (symbol);
153 let response = await this.publicGetTransactions (this.extend ({
154 'currencyPair': market['id'],
155 'minutesIntoHistory': 10,
156 }, params));
157 return this.parseTrades (response['data'], market, since, limit);
158}
361public async listAccountTrades(
362 marketId: string,
363 page?: number,
364 perPage?: number
365): Promise<TradeList> {
366 const data = await this.apiHandler.get(
367 join('markets', marketId, 'trades', 'mine'),
368 { page, perPage },
369 true
370 );
371 return new TradeList(data);
372}

Related snippets