You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git clone https://github.com/binance/binance-connector-typescript.git
cd binance-connector-typescript
npm i
npx ts-node examples/websocketAPI/account/account.ts
Output:
Sending Websocket connection to: wss://ws-api.binance.com:443/ws-api/v3
Connected to the Websocket Server: wss://ws-api.binance.com:443/ws-api/v3
Connected with Websocket server
Send message to Binance Websocket API Server: {
id: '5d36aa1ea1794bd60aab4e095ea56183',
method: 'account.status',
params: {
apiKey: '',
recvWindow: 5000,
timestamp: 1699267938214,
signature: '69747bd04025d929283ecc978fffd664987f7ce6ae3481b19cffe9b8872aa4db'
}
}
Data: {
id: '5d36aa1ea1794bd60aab4e095ea56183',
status: 400,
error: { code: -1105, msg: "Parameter 'apiKey' was empty." },
rateLimits: [
{
rateLimitType: 'REQUEST_WEIGHT',
interval: 'MINUTE',
intervalNum: 1,
limit: 6000,
count: 3
}
]
}
Disconnected with Binance Websocket Server
Replace the import path of the second import with npm:@binance/connector-typescript.
Replace process.env with Deno.env.
Save it as deno-bug.ts:
import { WebsocketAPI, WsAccountTypes } from 'npm:@binance/connector-typescript';
const apiKey = Deno.env.get('BINANCE_API_KEY') || '';
const apiSecret = Deno.env.get('BINANCE_API_SECRET') || '';
const options: WsAccountTypes.accountOptions = {
recvWindow: 5000
};
const callbacks = {
open: (client: WebsocketAPI) => {
console.log('Connected with Websocket server');
// get account info after connection established
client.account(options);
},
close: () => console.log('Disconnected with Websocket server'),
message: (data: string) => {
const parseData = JSON.parse(data);
console.info('Data: ', parseData);
}
};
const websocketAPIClient = new WebsocketAPI(apiKey, apiSecret, { callbacks });
Run it:
deno run --allow-read --allow-env --allow-net deno-bug.ts
Output:
Warning: Not implemented: ClientRequest.options.createConnection
Sending Websocket connection to: wss://ws-api.binance.com:443/ws-api/v3
Connected to the Websocket Server: wss://ws-api.binance.com:443/ws-api/v3
Connected with Websocket server
Send message to Binance Websocket API Server: {
id: "a145b17698dbe8f69d721c9055720219",
method: "account.status",
params: {
apiKey: "",
recvWindow: 5000,
timestamp: 1699268000282,
signature: "deed7c2c8e81d11cb43d0b0c956650094beadd15864584f6e83854f885812c14"
}
}
error: Uncaught (in promise) TypeError: expected i32
at Zlib.write (ext:deno_node/_zlib_binding.mjs:120:10)
at DeflateRaw.Zlib._processChunk (ext:deno_node/_zlib.mjs:548:26)
at DeflateRaw.Zlib._transform (ext:deno_node/_zlib.mjs:498:8)
at DeflateRaw.Transform._write (ext:deno_node/_stream.mjs:4990:12)
at doWrite (ext:deno_node/_stream.mjs:3963:16)
at clearBuffer (ext:deno_node/_stream.mjs:4101:11)
at onwrite (ext:deno_node/_stream.mjs:4000:11)
at ext:deno_node/_stream.mjs:5003:11
at Zlib.callback (ext:deno_node/_zlib.mjs:623:5)
at ext:deno_node/_zlib_binding.mjs:132:14
Warning: Not implemented: ClientRequest.options.createConnection is being tracked on #19507.
The text was updated successfully, but these errors were encountered:
Versions
Deno 1.38.0
Binance connector in Typescript v0.3.3
Node.js code
Output:
Deno port
In the same file:
dotenv
import.npm:@binance/connector-typescript
.process.env
withDeno.env
.deno-bug.ts
:Output:
Warning: Not implemented: ClientRequest.options.createConnection
is being tracked on #19507.The text was updated successfully, but these errors were encountered: