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

Method assignOptions

src/node-binance-api.ts:195–237  ·  view source on GitHub ↗
(opt = {})

Source from the content-addressed store, hash-verified

193 }
194
195 assignOptions(opt = {}) {
196 if (typeof opt === 'string') { // Pass json config filename
197 this.Options = JSON.parse(file.readFileSync(opt) as any);
198 } else this.Options = opt;
199 if (!this.Options.recvWindow) this.Options.recvWindow = this.default_options.recvWindow;
200 if (!this.Options.useServerTime) this.Options.useServerTime = this.default_options.useServerTime;
201 if (!this.Options.reconnect) this.Options.reconnect = this.default_options.reconnect;
202 if (!this.Options.test) this.Options.test = this.default_options.test;
203 if (!this.Options.hedgeMode) this.Options.hedgeMode = this.default_options.hedgeMode;
204 if (!this.Options.log) this.Options.log = this.default_options.log;
205 if (!this.Options.verbose) this.Options.verbose = this.default_options.verbose;
206 if (!this.Options.keepAlive) this.Options.keepAlive = this.default_options.keepAlive;
207 if (!this.Options.localAddress) this.Options.localAddress = this.default_options.localAddress;
208 if (!this.Options.family) this.Options.family = this.default_options.family;
209 if (this.Options.urls !== undefined) {
210 const { urls } = this.Options;
211 if (urls.base) this.base = urls.base;
212 if (urls.wapi) this.wapi = urls.wapi;
213 if (urls.sapi) this.sapi = urls.sapi;
214 if (urls.fapi) this.fapi = urls.fapi;
215 if (urls.fapiTest) this.fapiTest = urls.fapiTest;
216 if (urls.stream) this.stream = urls.stream;
217 if (urls.combineStream) this.combineStream = urls.combineStream;
218 if (urls.fstream) this.fstream = urls.fstream;
219 if (urls.fstreamSingle) this.fstreamSingle = urls.fstreamSingle;
220 if (urls.fstreamTest) this.fstreamTest = urls.fstreamTest;
221 if (urls.fstreamSingleTest) this.fstreamSingleTest = urls.fstreamSingleTest;
222 if (urls.dstream) this.dstream = urls.dstream;
223 if (urls.dstreamSingle) this.dstreamSingle = urls.dstreamSingle;
224 if (urls.dstreamTest) this.dstreamTest = urls.dstreamTest;
225 if (urls.dstreamSingleTest) this.dstreamSingleTest = urls.dstreamSingleTest;
226 }
227
228 if (this.Options.APIKEY) this.APIKEY = this.Options.APIKEY;
229 if (this.Options.APISECRET) this.APISECRET = this.Options.APISECRET;
230 if (this.Options.PRIVATEKEY) this.PRIVATEKEY = this.Options.PRIVATEKEY;
231 if (this.Options.PRIVATEKEYPASSWORD) this.PRIVATEKEYPASSWORD = this.Options.PRIVATEKEYPASSWORD;
232 if (this.Options.test) this.test = true;
233 if (this.Options.demo) this.demo = true;
234 if (this.Options.headers) this.headers = this.Options.Headers;
235 if (this.Options.domain) this.domain = this.Options.domain;
236 if (this.Options.httpsProxy) this.httpsProxy = this.Options.httpsProxy;
237 }
238
239 async setOptions(opt = {}): Promise<Binance> {
240

Callers 1

setOptionsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected