MCPcopy Create free account
hub / github.com/ccxt/node-binance-api / futuresRequest

Method futuresRequest

src/node-binance-api.ts:601–638  ·  view source on GitHub ↗

* Used to make a request to the futures API, this is a generic function that can be used to make any request to the futures API * @param url * @param data * @param method * @param isPrivate * @returns

(url: string, data: Dict = {}, method: HttpMethod = 'GET', isPrivate = false)

Source from the content-addressed store, hash-verified

599 * @returns
600 */
601 async futuresRequest(url: string, data: Dict = {}, method: HttpMethod = 'GET', isPrivate = false) {
602 let query = '';
603 const headers = {
604 'User-Agent': this.userAgent,
605 'Content-type': 'application/x-www-form-urlencoded'
606 } as Dict;
607
608 if (isPrivate) {
609 if (!data.recvWindow) data.recvWindow = this.Options.recvWindow;
610 this.requireApiKey('promiseRequest');
611 headers['X-MBX-APIKEY'] = this.APIKEY;
612 }
613
614 const opt = {
615 headers: this.extend(headers, this.headers),
616 url: url,
617 method: method,
618 timeout: this.Options.recvWindow,
619 followAllRedirects: true
620 };
621 query = this.makeQueryString(data);
622 if (method === 'GET') {
623 opt.url = `${url}?${query}`;
624 }
625 if (isPrivate) {
626 data.timestamp = new Date().getTime();
627 if (this.timeOffset) {
628 data.timestamp += this.timeOffset;
629 }
630 query = this.makeQueryString(data);
631 data.signature = this.generateSignature(query);
632 opt.url = `${url}?${query}&signature=${data.signature}`;
633 }
634 (opt as any).qs = data;
635 const response = await this.proxyRequest(opt);
636 return response;
637
638 }
639
640 // ------ Request Related Functions ------ //
641

Callers 2

privateFuturesRequestMethod · 0.95

Calls 4

requireApiKeyMethod · 0.95
makeQueryStringMethod · 0.95
generateSignatureMethod · 0.95
proxyRequestMethod · 0.95

Tested by

no test coverage detected