Uses 211K of libraries. Click here for Pure Java version (11432L/65K).
sclass BitGet { S domain = "https://api.bitget.com"; S webSocketURL = "wss://ws.bitget.com/spot/v1/stream"; Timestamp serverTime() { ret new Timestamp(toLong(loadJSONMapPage(domain + "/api/spot/v1/public/time").get("data"))); } // How much we are ahead or behind of the server's time // (Note: includes network lag) Duration serverTimeDifference() { var serverTime = serverTime(); ret tsNow().minusAsDuration(serverTime); } WebSocketClient printingWebSocketClient() ctex { ret new PrintingWebSocketClient(new URI(webSocketURL)); } S signMessage(S message, BitGetCredentials cred) { ret base64(hmacSHA256(message, hexToBytes(assertNempty(cred.secretKey())))); } Map loginRequest(BitGetCredentials cred) { S timestamp = str(serverTime().unixSeconds()); S messageToSign = timestamp /* + "GET" + "/user/verify"*/; S sign = signMessage(messageToSign, cred); ret litorderedmap( op := "login", args := ll(litorderedmap( apiKey := assertNempty(cred.apiKey), passphrase := assertNempty(cred.passphrase), +timestamp, +sign ))); } }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1036020 |
Snippet name: | BitGet - API to bitget.com |
Eternal ID of this version: | #1036020/16 |
Text MD5: | c0b0d06e67f7093ff2ae301d02d0e2de |
Transpilation MD5: | e92bfe1fe7066dc753df74a19fe72f7d |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-09-01 14:26:19 |
Source code size: | 1194 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 275 / 309 |
Version history: | 15 change(s) |
Referenced in: | [show references] |