ECN Documentation
  • Home
  • Quick Start
  • Reference
    • API Reference
      • Connection Test
      • Securities
      • Client
      • Trade
      • Wallet
      • Websocket
        • Portfolio
        • Order Book
      • Security Prices
Powered by GitBook
On this page
  1. Reference
  2. API Reference

Websocket

PreviousWalletNextPortfolio

Last updated 3 years ago

Our WebSocket uses for parameters encryption. This means that all Websocket output will be encrypted using this algorithm with the keys that have been shared.

API_KEY

API Key that is shared

HASH

Request Hash

REQUEST_TS

Random string of 18 digits

Generating HASH-KEY

from random import choice
import hashlib

API_SECRET = '...'
API_KEY = '...'

def generate_digits(code_length) -> str:
    code = ""
    for i in range(code_length):
        code += choice(digits)
    return code

request_ts = generate_digits(18)
concatenated_string = API_SECRET + request_ts + API_KEY
hash_string = hashlib.sha256((concatenated_string).encode('utf8')).hexdigest()

API_KEY # API_KEY
hash_string # HASH
request_ts # REQUEST_TS
AES 256 Algorithm